I have a problem with google geocoding result
I'm geocoding French Cities and want to get their Postal Code
My problem is Google response with all the data EXCEPT the postal code
For example for Achère City, i get the address_components results :
[
Object { long_name="Cachan", short_name="Cachan", types=[2]},
Object { long_name="Val-de-Marne", short_name="94", types=[2]},
Object { long_name="Île-de-France", short_name="IDF", types=[2]},
Object { long_name="France", short_name="FR", types=[2]}
]
So i get the city name, the "States" name and number and the country name
All the results are "Good" except no response for postal code returned
My problem is ... I only need the postal code :(
I searched on SO and Google docs ( a real jungle, most of their reference data are really not well doccumented ( when it is documented or up to date for V3 ) ) ...
1st Edit :
And just found it's not the only problem ...
An other French City give me this returned response :
[
Object { long_name="Angers", short_name="Angers", types=[2]},
Object { long_name="Maine-et-Loire", short_name="Maine-et-Loire", types=[2]},
Object { long_name="Pays de la Loire", short_name="Pays de la Loire", types=[2]},
Object { long_name="France", short_name="FR", types=[2]}
]
As i can't get the Postal code ( returned only when google is in a good day ) i'm using the 2 digits French State returned
For the first city it return :
Object { long_name="Val-de-Marne", short_name="94", types=[2]},
For the second city, the same line is
Object { long_name="Maine-et-Loire", short_name="Maine-et-Loire", types=[2]},
The value i need is the "94" as given for the 1st city, but not returned by the second city ...
Is there really no possibility to get every data details for every geocoding and for example get some blank when google don't have the data
Because in the present case, it is hard to make a rule working for every returned result ...
Thanks in advance, i'm totally lost with it
2nd Edit :
Seems google return the postal code ... when it wants, i get it for 1 city every ... 10 or 15 cities ( not a problem of localisation as google find adresse, lat, lng etc for EVERY cities i try, just have the problem with the postal code )
Related
My database structure looks something like this (omitted less-important details):
Hospital{
Name,
Variants[] (references HospitalVariant)
}
HospitalVariant{
DiseaseVariant (references Disease),
Description,
Rating
}
Disease{
Name,
slug
}
Now, I want to fetch all hospitals which treats breast-cancer and I only want to fetch breast-cancer from that hospitals array of diseases.
*[_type="Hospital" && Variants[].DiseaseVariant->slug.current match "breast-cancer"]{
...,
Name,
Variants[DiseaseVariant->slug.current match "breast-cancer"]
}
First part of the query is working correctly i.e. it's fetching the hospitals which treats breast-cancer but in the Diseases array, nothing is being fetched.
If I use a non-referenced field, the query is working correctly. i.e.
*[_type="Hospital" && Variants[].DiseaseVariant->slug.current match "breast-cancer"]{
...,
Name,
Variants[Rating > 95]
}
This is returning the correct results. But when I am using referenced Object (Disease), it's not working correctly.
Request: https://reverse.geocoder.api.here.com/6.2/reversegeocode.json?app_id=APP_ID&app_code=APP_CODE&mode=retrieveAreas&prox=35.1377685%2C33.9196697%2C1000&language=en&gen=9
Replace these two by actual values: APP_ID, APP_CODE
This is response:
{
"Response":{
"MetaInfo":{
"Timestamp":"2019-05-06T10:31:19.317+0000"
},
"View":[
{
"_type":"SearchResultsViewType",
"ViewId":0,
"Result":[
{
"Relevance":1.0,
"Distance":-1092.5,
"Direction":149.7,
"MatchLevel":"city",
"MatchQuality":{
"Country":1.0,
"County":1.0,
"City":1.0,
"PostalCode":1.0
},
"Location":{
"LocationId":"NT_iVkNRSYU-2l2WyhtuOg9TB",
"LocationType":"area",
"DisplayPosition":{
"Latitude":35.13116,
"Longitude":33.9244
},
"MapView":{
"TopLeft":{
"Latitude":35.16061,
"Longitude":33.88137
},
"BottomRight":{
"Latitude":35.08291,
"Longitude":33.95569
}
},
"Address":{
"Label":"Karakol, Turkish-Cypriot Administered Area",
"Country":"NCY",
"County":"Famagusta",
"City":"Karakol",
"PostalCode":"99450",
"AdditionalData":[
{
"value":"Turkish-Cypriot Administered Area",
"key":"CountryName"
},
{
"value":"Famagusta",
"key":"CountyName"
}
]
},
"MapReference":{
"ReferenceId":"970895970",
"MapId":"UEAM19108",
"MapVersion":"Q1/2019",
"MapReleaseDate":"2019-04-15",
"SideOfStreet":"neither",
"CountryId":"26569036",
"CountyId":"26569038",
"CityId":"26571374"
}
}
}
]
}
]
}
}
See "Country" field:
"Country":"NCY",
As you can see, country code is NCY. I'm trying to find what country uses that 3-letter code and I can't find it anywhere on the internet.
https://www.worldatlas.com/aatlas/ctycodes.htm
It looks like this is some API issue and it returns wrong country code.
As there is no official answer from HERE, I'll give at least some background info.
NCY is probably a non ISO 3166-1-alpha-3 code that represents Northern Cyprus.
Cyprus is a complicated case, with Greece and Turkey claiming influence. I remember 4 zones modeled, a Greek part, a Turkish part, the UN controlled demilitarized zone in between and a British military base.
You can read more at https://en.wikipedia.org/wiki/Cyprus#Administrative_divisions
I'll go a step further and say this should be filed as a bug, for two reasons.
According to the API Reference, the Address object type is as follow (emphasis mine):
Label Assembled address value for displaying purposes.
Country ISO 3166-alpha-3 country code
[...]
As you noticed, and this is the first reason of why it is a bug, NCY is not a valid ISO 3166-alpha-3 country code
Furthermore, your request does not contain the politicalview query parameter, which allows to deal with disputed territories: for exemple, Crimea would be returned as part of Russia if politicalview=RUS is in the request. If politicalview is not specified, the API assumes the "international view".
However, and this is the second reason, the so-called "Turkish Republic of North Cyprus" is recognized only by Turkey. It does not make sense to return a country code other than CYP, except when politicalview=TUR is specified in the request.
I am trying to get a list of all venues available through the Here API by requesting a venue index. My url looks as follows(with the strings replaced where necessary):
static-3.venue.maps.cit.api.here.com/1/models-poi/index_bb.js?Policy={Policy}&Signature={Signature}&Key-Pair-Id={Key Pair}&app_id={App Id}&app_code={App Code}
This returns a JSON table, which I want, but I only have 155 entries, although there are clearly more. Does anyone know why I don't get the full list? Thanks. Below is the first couple lines of the output I get.
JSON.venues([{ "gml:id" : "DM_8961", "bb": [ [52.4564118412704,13.384279785476354],[52.454433435991014,13.388207656793229] ]},{ "gml:id" : "DM_10465", "bb": [ [52.43143833815419,13.453328297714588],[52.4288047627723,13.45769174285097] ]},{ "gml:id" : "DM_17394", "bb": [ [52.475570406808345,13.458645521436816],
and so on
You're connecting to a CIT Environment where not all Venue Data is exposed.
I get a strange result whenever I try a research with geocode with the address=paris,75000
http://maps.googleapis.com/maps/api/geocode/json?address=paris,75000&sensor=false
This returns me a place in the south of France where there is a little road called Paris !!!
"formatted_address" : "Paris, 83470 Seillons-Source-d'Argens, France",
"geometry" : {
"bounds" : {
"northeast" : {
"lat" : 43.4958460,
"lng" : 5.8980320
},
"southwest" : {
"lat" : 43.49187360,
"lng" : 5.88903480
}
},*
Anybody knows how to fix it ?
Thanx
Adding: region=fr to include region biasingdev-guide-entry helps a little (at least the first result makes more sense and some of the strange results have been removed), but I believe the real problem is that you are submitting an incomplete address.
All of the results that are returned for this request have: partial_match: true, which is basically saying that the geocoder did the best it could with incomplete information in the request. Is there any way you can add more detail to this specific request?
75000 is not a valid postal code. Use 75001 instead (1st district or "arrondissement" in french).
In France certain large cities has several postal codes.
750[01..20] for Paris
132[01..16] for Marseille
It looks like the geocoder is confused by the code 75000. Leaving it out produces different results. I know that each arrondissement gets its own number, 75001, 75002 etc: is 75000 a valid postal code? 75001 produces a valid result.
The workaround is not to use that code, anyway.
I'm trying to set a noDataMessage into a dojox.grid.EnhancedGrid, the grid works fine, when the store get data it show it's row with no problem, but I need that when the store gets no data the grid would show me a personalized message. I set the noDataMessage property which is a string, but nothing happened when has no data.
How can I trigger the event when no data in the store?
I get my data through a SQL query to a database and the answer is JSON serialized data.
here's the code of my grid.
intersGrid = new dojox.grid.EnhancedGrid({
// plugins: {dnd: true},viewInterconsulta
id :"intersGrid",
store: interfiltStore,
structure: intersLayout,
noDataMessage:"<span class=\"dojoxGridNoData\">No hay Datos</span>",
loadingMessage:'Cargando datos. Por favor espere.',
//noDataMessage: 'No existen pacientes esta agenda.',
errorMessage:'No existen datos para esta busqueda.'
}, "intersDiv");
solved.
What you have to do is.
if you get an empty store then set them like these:
$filas = "{ identifier: 'ID', items[]}";
**json_encode($filas)."}";
and then dojo shows the noDataMessage
In my case, I only showed 25 rows and then requested with help of offset & count another 25 when scrolling down the list. In this case, I needed "numRows" - which is the total amount of rows, leaving out offset & count. The "numRows" was set to 0 if no rows where found. But if it was given, the noDataMessage was not shown (btw: An "identifier" is not required).
Also there is a syntax error in your json, add some ":" after "items".
This is the JSON for the store, which shows the noDataMessage of a dojox datagrid:
{"items":[]}
This will not show it:
{"items":[],"numRows":"0"}
Using Dojo 1.6.1, a dojox.grid.DataGrid with a dojox.data.QueryReadStore