Rest API returning wrong result - here-api

I was planning to migrate from the json API to the rest API, however, the results are not matching, the reverse geocode of the rest API is returning the wrong result. has anyone faced that issue before? Find sample below:
https://revgeocode.search.hereapi.com/v1/revgeocode?at=-32.05786%2C115.93382&lang=en-US&apiKey={KEY}
enter code here {
"items": [
{
"title": "Reece Australia",
"id": "here:pds:place:036qd63w-93b4e78634c7482aa36a7140fde9701b",
"resultType": "place",
"address": {
"label": "Reece Australia, Thornlie WA 6108, Australia",
"countryCode": "AUS",
"countryName": "Australia",
"state": "Western Australia",
"city": "Perth",
"district": "Thornlie",
"postalCode": "6108"
},
"position": {
"lat": -32.05779,
"lng": 115.93393
},
"access": [
{
"lat": -32.05779,
"lng": 115.93393
}
],
"distance": 13,
"categories": [
{
"id": "700-7400-0366",
"primary": true
}
]
}
]
}
https://reverse.geocoder.ls.hereapi.com/6.2/reversegeocode.json?apiKey={APIKEY}&mode=retrieveAddresses&prox=-32.05786,115.93382&maxresults=1
enter code here {
"Response": {
"MetaInfo": {
"Timestamp": "2020-06-25T05:17:32.232+0000",
"NextPageInformation": "2"
},
"View": [
{
"_type": "SearchResultsViewType",
"ViewId": 0,
"Result": [
{
"Relevance": 1.0,
"Distance": 2.1,
"MatchLevel": "street",
"MatchQuality": {
"Country": 1.0,
"State": 1.0,
"City": 1.0,
"District": 1.0,
"Street": [
1.0
],
"PostalCode": 1.0
},
"Location": {
"LocationId": "NT_K800C2SShmW5hJiQktPlsB_l_133454375_L",
"LocationType": "point",
"DisplayPosition": {
"Latitude": -32.0578752,
"Longitude": 115.9338325
},
"MapView": {
"TopLeft": {
"Latitude": -32.05782,
"Longitude": 115.9337
},
"BottomRight": {
"Latitude": -32.05798,
"Longitude": 115.9339
}
},
"Address": {
"Label": "Bannister Rd, Canning Vale WA 6155, Australia",
"Country": "AUS",
"State": "WA",
"City": "Perth",
"District": "Canning Vale",
"Street": "Bannister Rd",
"PostalCode": "6155",
"AdditionalData": [
{
"value": "Australia",
"key": "CountryName"
},
{
"value": "Western Australia",
"key": "StateName"
}
]
},
"MapReference": {
"ReferenceId": "133454375",
"Spot": 0.66,
"SideOfStreet": "neither",
"CountryId": "1469256839",
"StateId": "1469256834",
"CityId": "1469263736",
"DistrictId": "1469282231"
}
}
}
]
}
]
}
}

Result given by Rest API is correct as you are getting accurate result at that coordinate.
while in JSON API you are passing proximities with retrieveAddresses which always search for the closest street address or addresses in the given proximities.
for more details you can visit the documentations for both API.
https://developer.here.com/documentation/geocoding-search-api/api-reference-swagger.html
https://developer.here.com/documentation/geocoder/dev_guide/topics/resource-reverse-geocode.html

Related

Vega-lite interactive Bar Chart

I am trying to make a basic interactive chart where the user can select a country and observe a single measurement based on the height of the bar. However, prior to selecting a country, the chart shows all the bars stacked on top of each other. once a country is selected i achieve the view that i want.
{"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"data": {
"url": "https://raw.githubusercontent.com/ConorQuah/ConorQuah.github.io/main/Happiness%26liberties_s%26e.csv"
},
"title": {
"text": "Happiness and Liberty",
"subtitle":"view the happiness of different countries. Notice how the colour of the bar changes!",
"subtitleFontStyle":"italic",
"subtitleFontSize":10,
"anchor": "start"
},
"height": 300,
"width": 300,
"transform": [{"filter": {"selection": "Region"}}],
"selection": {
"Region": {
"type": "single",
"fields": ["Country"],
"bind": {
"input": "select",
"options": [
"null",
"Finland",
"Sweden",
"New Zealand",
"United Kingdom",
"Serbia",
"Zimbabwe",
"Afghanistan"
],
"name": "Select a country"
}
}
},
"mark": {"type": "bar", "width":50},
"encoding": {
"color": {
"field": "Civil liberties",
"title": "Civil liberties",
"scale":{"scheme":"redyellowgreen", "domain":[0,60]},
"type": "quantitative"
},
"y": {
"field": "Happiness",
"scale": {"domain": [0,10]},
"type": "quantitative",
"title": "Happiness"
}
}
}
Here you go:
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"data": {
"url": "https://raw.githubusercontent.com/ConorQuah/ConorQuah.github.io/main/Happiness%26liberties_s%26e.csv"
},
"title": {
"text": "Happiness and Liberty",
"subtitle": "view the happiness of different countries. Notice how the colour of the bar changes!",
"subtitleFontStyle": "italic",
"subtitleFontSize": 10,
"anchor": "start"
},
"params": [
{
"name": "p",
"select": {"type": "point", "fields": ["Country"]},
"bind": { "name": "Country",
"input": "select",
"options": [
"Pick a Country",
"Finland",
"Sweden",
"New Zealand",
"United Kingdom",
"Serbia",
"Zimbabwe",
"Afghanistan"
]
}
}
],
"height": 300,
"width": 300,
"transform": [{"filter": "datum.Country ==p_Country"}],
"mark": {"type": "bar", "width": 50},
"encoding": {
"color": {
"field": "Civil liberties",
"title": "Civil liberties",
"scale": {"scheme": "redyellowgreen", "domain": [0, 60]},
"type": "quantitative"
},
"y": {
"field": "Happiness",
"scale": {"domain": [0, 10]},
"type": "quantitative",
"title": "Happiness"
}
}
}

Address in autocomplete results

When I do an autosuggest request in the address response I only receive the label. The address object is not filled.
This is my request: https://autosuggest.search.hereapi.com/v1/autosuggest?at=48.8578817,2.2791249999999934&limit=5&q=stj&apikey=xxxx
I receive this:
"title": "Top Services (Stj)",
"id": "here:pds:place:250u09wj-afceace0a11b49bca950ea22d0f8e452",
"resultType": "place",
"address": {
"label": "********"
},
I will need to receive the formatted address without the name
How can I fix this?
thanks
We have tried to reproduce your query and it works for us, please see the following code.
Please review the documentation page for detailed information on autosuggest
Documentation link :
https://autosuggest.search.hereapi.com/v1/autosuggest?at=48.8578817,2.2791249999999934&limit=5&q=stj&apikey=XXXX.
Query Result:
{
"items": [
{
"title": "Top Services (Stj)",
"id": "here:pds:place:250u09wj-afceace0a11b49bca950ea22d0f8e452",
"resultType": "place",
"address": {
"label": "Top Services, 61 Rue du Faubourg Saint-Denis, 75010 Paris, France"
},
"position": {
"lat": 48.8721,
"lng": 2.35384
},
"access": [
{
"lat": 48.87208,
"lng": 2.35392
}
],
"distance": 5690,
"categories": [
{
"id": "700-7200-0254",
"name": "Construction",
"primary": true
},
{
"id": "700-7200-0264",
"name": "Services de conseil et de gestion"
},
{
"id": "700-7200-0277",
"name": "Entrepreneur de second œuvre"
}
],
"highlights": {
"title": [
{
"start": 14,
"end": 17
}
],
"address": {
"label": [
]
}
}
},
{
"title": "La Clinique du Scooter d'Occasion (Stj 2 Roues)",
"id": "here:pds:place:250u09tv-591de1b090c54199b11154a72f462c0d",
"resultType": "place",
"address": {
"label": "La Clinique du Scooter d'Occasion, 148 Boulevard du Montparnasse, 75014 Paris, France"
},
"position": {
"lat": 48.84039,
"lng": 2.33383
},
"access": [
{
"lat": 48.84052,
"lng": 2.33393
}
],
"distance": 4451,
"categories": [
{
"id": "400-4200-0241",
"name": "Services logistiques",
"primary": true
}
],
"highlights": {
"title": [
{
"start": 35,
"end": 38
}
],
"address": {
"label": [
]
}
}
},
{
"title": "Stjohn's",
"id": "here:pds:place:2501r4ve-43f913ba8f9b0e7046aaee61bcfe8b9b",
"resultType": "place",
"address": {
"label": "Stjohn's, 11 Rue Edmond Valentin, 75007 Paris, France"
},
"position": {
"lat": 48.85961,
"lng": 2.30159
},
"access": [
{
"lat": 48.85968,
"lng": 2.30157
}
],
"distance": 1655,
"categories": [
{
"id": "700-7400-0141",
"name": "Services aux entreprises",
"primary": true
},
{
"id": "700-7200-0252",
"name": "Publicité, marketing, communication et études de marché"
}
],
"highlights": {
"title": [
{
"start": 0,
"end": 3
}
],
"address": {
"label": [
{
"start": 0,
"end": 3
}
]
}
}
},
{
"title": "Stjohn S",
"id": "here:pds:place:250u09tv-0f38e06dd8634ab4a0d931dad94de24c",
"resultType": "place",
"address": {
"label": "Stjohn S, 4 Rue des Petits-Pères, 75002 Paris, France"
},
"position": {
"lat": 48.86601,
"lng": 2.34027
},
"access": [
{
"lat": 48.8662,
"lng": 2.34023
}
],
"distance": 4564,
"categories": [
{
"id": "700-7200-0252",
"name": "Publicité, marketing, communication et études de marché",
"primary": true
},
{
"id": "700-7200-0271",
"name": "Services financiers et d'assurance"
}
],
"highlights": {
"title": [
{
"start": 0,
"end": 3
}
],
"address": {
"label": [
{
"start": 0,
"end": 3
}
]
}
}
},
{
"title": "Espace St-Jo'",
"id": "here:pds:place:250u09te-220742c64e4a40a48b8772987e7f987c",
"resultType": "place",
"address": {
"label": "Espace St-Jo', 54 Rue du Moulin de Pierres, 92140 Clamart, France"
},
"position": {
"lat": 48.80865,
"lng": 2.26594
},
"access": [
{
"lat": 48.8087,
"lng": 2.2659
}
],
"distance": 5558,
"categories": [
{
"id": "200-2200-0000",
"name": "Théâtre, musique et culture",
"primary": true
},
{
"id": "200-2000-0015",
"name": "Salle de spectacle/concert"
},
{
"id": "550-5520-0000",
"name": "Aire de loisirs"
}
],
"references": [
{
"supplier": {
"id": "yelp"
},
"id": "xJtl5krT8OZ3QYXtMl6Leg"
}
],
"highlights": {
"title": [
{
"start": 7,
"end": 12
}
],
"address": {
"label": [
{
"start": 7,
"end": 12
}
]
}
}
}
],
"queryTerms": [
]
}

Why is averageRating always 0?

I am using the 'Explore Popular Places by Category' API and it always returns averageRating as 0 for all items in the result.
I made this call with various categories such as restaurants and sights-museums, but it always returns 0 for averageRating. Does HERE not provide this detail, and if so, why is it returned in the response?
Some details:
I am making a call to this url:
https://places.ls.hereapi.com/places/v1/discover/explore?at=52.5159%2C13.3777&cat=sights-museums&apiKey={api_key}
and it returns something like this:
{
"results": {
"next": "https://places.ls.hereapi.com/places/v1/discover/explore;context=Y2F0PXNpZ2h0cy1tdXNldW1zJmZsb3ctaWQ9Mjk0ZjU1NTgtMmY0Mi01Y2FiLWJlYWUtOGEyM2ViY2EzMzgzXzE1ODMyNjMyNjEwMzZfMF84NTcyJm9mZnNldD0yMCZzaXplPTIw?at=52.5159%2C13.3777&app_id=LKO34glU2MBEVbcOD5mQ&app_code=A2ta_nQ8HRYwenju5HFG5Q",
"items": [
{
"position": [
52.51629,
13.37817
],
"distance": 54,
"title": "Brandenburg Gate",
"averageRating": 0,
"category": {
"id": "landmark-attraction",
"title": "Landmark/Attraction",
"href": "https://places.ls.hereapi.com/places/v1/categories/places/landmark-attraction?app_id=LKO34glU2MBEVbcOD5mQ&app_code=A2ta_nQ8HRYwenju5HFG5Q",
"type": "urn:nlp-types:category",
"system": "places"
},
"icon": "https://download.vcdn.data.here.com/p/d/places2/icons/categories/38.icon",
"vicinity": "Pariser Platz<br/>Mitte, 10117 Berlin",
"having": [],
"type": "urn:nlp-types:place",
"href": "https://places.ls.hereapi.com/places/v1/places/276u33db-8ee2e0de906e459cbade0593986debe9;context=Zmxvdy1pZD0yOTRmNTU1OC0yZjQyLTVjYWItYmVhZS04YTIzZWJjYTMzODNfMTU4MzI2MzI2MTAzNl8wXzg1NzImcmFuaz0w?app_id=LKO34glU2MBEVbcOD5mQ&app_code=A2ta_nQ8HRYwenju5HFG5Q",
"id": "276u33db-8ee2e0de906e459cbade0593986debe9",
"alternativeNames": [
{
"name": "Brandenburger Tor",
"language": "de"
}
]
},
{
"position": [
52.51373,
13.37976
],
"distance": 279,
"title": "Holocaust Memorial",
"averageRating": 0,
"category": {
"id": "museum",
"title": "Museum",
"href": "https://places.ls.hereapi.com/places/v1/categories/places/museum?app_id=LKO34glU2MBEVbcOD5mQ&app_code=A2ta_nQ8HRYwenju5HFG5Q",
"type": "urn:nlp-types:category",
"system": "places"
},
"icon": "https://download.vcdn.data.here.com/p/d/places2/icons/categories/10.icon",
"vicinity": "Cora-Berliner-Straße 1<br/>Mitte, 10117 Berlin",
"having": [],
"type": "urn:nlp-types:place",
"href": "https://places.ls.hereapi.com/places/v1/places/276u33de-df7d57fd38494a93b2018fe549a0fd75;context=Zmxvdy1pZD0yOTRmNTU1OC0yZjQyLTVjYWItYmVhZS04YTIzZWJjYTMzODNfMTU4MzI2MzI2MTAzNl8wXzg1NzImcmFuaz0x?app_id=LKO34glU2MBEVbcOD5mQ&app_code=A2ta_nQ8HRYwenju5HFG5Q",
"id": "276u33de-df7d57fd38494a93b2018fe549a0fd75",
"openingHours": {
"text": "Tue-Sun: 10:00 - 20:00",
"label": "Opening hours",
"isOpen": false,
"structured": [
{
"start": "T100000",
"duration": "PT10H00M",
"recurrence": "FREQ:DAILY;BYDAY:TU,WE,TH,FR,SA,SU"
}
]
},
"alternativeNames": [
{
"name": "Memorial to the Murdered European Jews",
"language": "en"
},
{
"name": "Memorial to the Murdered Jews of Europe",
"language": "en"
},
{
"name": "Denkmal für die ermordeten Juden Europas",
"language": "de"
}
]
},
{
"position": [
52.51666,
13.40784
],
"distance": 2041,
"title": "Nicholas Quarter",
"averageRating": 0,
"category": {
"id": "museum",
"title": "Museum",
"href": "https://places.ls.hereapi.com/places/v1/categories/places/museum?app_id=LKO34glU2MBEVbcOD5mQ&app_code=A2ta_nQ8HRYwenju5HFG5Q",
"type": "urn:nlp-types:category",
"system": "places"
},
"icon": "https://download.vcdn.data.here.com/p/d/places2/icons/categories/10.icon",
"vicinity": "Nikolaikirchplatz<br/>Mitte, 10178 Berlin",
"having": [],
"type": "urn:nlp-types:place",
"href": "https://places.ls.hereapi.com/places/v1/places/276u33dc-049683d3c6be4bdba823808678a1b164;context=Zmxvdy1pZD0yOTRmNTU1OC0yZjQyLTVjYWItYmVhZS04YTIzZWJjYTMzODNfMTU4MzI2MzI2MTAzNl8wXzg1NzImcmFuaz0xOQ?app_id=LKO34glU2MBEVbcOD5mQ&app_code=A2ta_nQ8HRYwenju5HFG5Q",
"id": "276u33dc-049683d3c6be4bdba823808678a1b164",
"alternativeNames": [
{
"name": "Nikolaiviertel",
"language": "en"
},
{
"name": "Nikolaiviertel",
"language": "de"
}
]
}
]
},
"search": {
"context": {
"location": {
"position": [
52.5159,
13.3777
],
"address": {
"text": "Ebertstraße 22<br/>Mitte, 10117 Berlin<br/>Germany",
"house": "22",
"street": "Ebertstraße",
"postalCode": "10117",
"district": "Mitte",
"city": "Berlin",
"county": "Berlin",
"stateCode": "Berlin",
"country": "Germany",
"countryCode": "DEU"
}
},
"type": "urn:nlp-types:place",
"href": "https://places.ls.hereapi.com/places/v1/places/loc-dmVyc2lvbj0xO3RpdGxlPUViZXJ0c3RyYSVDMyU5RmUrMjI7bGF0PTUyLjUxNTk7bG9uPTEzLjM3Nzc7c3RyZWV0PUViZXJ0c3RyYSVDMyU5RmU7aG91c2U9MjI7Y2l0eT1CZXJsaW47cG9zdGFsQ29kZT0xMDExNztjb3VudHJ5PURFVTtkaXN0cmljdD1NaXR0ZTtzdGF0ZUNvZGU9QmVybGluO2NvdW50eT1CZXJsaW47Y2F0ZWdvcnlJZD1idWlsZGluZztzb3VyY2VTeXN0ZW09aW50ZXJuYWw;context=c2VhcmNoQ29udGV4dD0x?app_id=LKO34glU2MBEVbcOD5mQ&app_code=A2ta_nQ8HRYwenju5HFG5Q"
}
}
}
Does HERE not provide the averageRatings of restaurants or sights-museums?
From the docs it appears if the place hasn't received a rating it'll be 0
Note: If the place has no ratings (yet), both the average and the count values are zero. But if the place cannot be rated (i.e. a street), the whole rating object is not present.
https://developer.here.com/documentation/places/dev_guide/topics/object-rating.html

Here API Indoor discovery

I am trying to get the venue list using the API
https://indoor-discovery.venue.maps.api.here.com/discovery/v2?app_id=XXXXXXXXXXXXXXXXXXXX&app_code=XXXXXXXXXXXXXXXXXXXX&at=31.2403,74.6354,8.6291,77.5743
The "at" parameter almost covers the country. but the results always come back as
{
"hostname": "ip-10-13-214-44",
"type": "venues",
"status": {
"code": "OK",
"reason": "DISCOVERY_SUCCESSFULL"
},
"results": {
"items": []
}
}
The maximum value for the bounding box is at 100km x 100km. If you search within a smaller area you will get some results in the list. Here is one for the coverage of Chennai:
https://indoor-discovery.venue.maps.api.here.com/discovery/v2?app_id=yyy&app_code=xxxx&at=13.2403,79.8454,12.7291,80.5743
{
"hostname": "ip-10-13-214-44",
"type": "venues",
"status": {
"code": "OK",
"reason": "DISCOVERY_SUCCESSFULL"
},
"results": {
"items": [
{
"id": "DM_17331",
"title": "Phoenix Marketcity Mall",
"address": {
"countryCode": "IND",
"city": "Chennai",
"postalCode": "600042",
"street": "Radha Mohan Street",
"house": ""
},
"position": [
12.991487949990416,
80.21652530007341
],
"distance": 1045.380777404391,
"type": "urn:nlp-types:venue",
"vicinity": "Radha Mohan Street,600042,Chennai,IND",
"bbox": [
[
12.992687434189028,
80.21572801724027
],
[
12.990288596080005,
80.21732267846822
]
],
"minFloor": -1,
"maxFloor": 3,
"namespace": "public"
},
{
"id": "DM_3869",
"title": "Maya Plaza",
"address": {
"countryCode": "IND",
"city": "Chennai",
"postalCode": "600017",
"street": "Sir Thyagaraya Road",
"house": ""
},
"position": [
13.041404800089397,
80.23480899848522
],
"distance": 6860.646286724997,
"type": "urn:nlp-types:venue",
"vicinity": "Sir Thyagaraya Road,600017,Chennai,IND",
"bbox": [
[
13.041557002816027,
80.23472596161558
],
[
13.04125261448761,
80.23489217568006
]
],
"minFloor": 0,
"maxFloor": 4,
"namespace": "public"
},
{
"id": "DM_3866",
"title": "Challa Mall",
"address": {
"countryCode": "IND",
"city": "Chennai",
"postalCode": "600017",
"street": "Sir Thyagaraya Road",
"house": ""
},
"position": [
13.040501949969517,
80.24325910031074
],
"distance": 7183.4301593814025,
"type": "urn:nlp-types:venue",
"vicinity": "Sir Thyagaraya Road,600017,Chennai,IND",
"bbox": [
[
13.040704496188196,
80.24306093132118
],
[
13.040299554031115,
80.24345735684514
]
],
"minFloor": -1,
"maxFloor": 1,
"namespace": "public"
},
{
"id": "DM_3871",
"title": "Kasi Arcade Mall",
"address": {
"countryCode": "IND",
"city": "Chennai",
"postalCode": "600017",
"street": "Sir Thyagaraya Road",
"house": ""
},
"position": [
13.040300249964666,
80.24435859999508
],
"distance": 7224.9813794400025,
"type": "urn:nlp-types:venue",
"vicinity": "Sir Thyagaraya Road,600017,Chennai,IND",
"bbox": [
[
13.040532567087016,
80.24415738929856
],
[
13.04006805606027,
80.24455999517599
]
],
"minFloor": -1,
"maxFloor": 1,
"namespace": "public"
},
I had copied the lat/long from google maps, then I realized that the longitude has space, in the beginning, I removed the space and it started to work!

How to get only the road names on a route, with google maps

For a project im doing, I need to get the road names on a route.
So when i go from Amsterdam to Eindhoven, i pass for example the following roads, A4, A5, A27
My question is, how can i get these roads from the google maps api by giving my departure and destination?
All help is very appreciated.
Thanks in advance
Where are you using the Google Maps API you get a JSON format return.
like this;
{
"status": "OK",
"results": [ {
"types": street_address,
"formatted_address": "275-291 Bedford Ave, Brooklyn, NY 11211, USA",
"address_components": [ {
"long_name": "275-291",
"short_name": "275-291",
"types": street_number
}, {
"long_name": "Bedford Ave",
"short_name": "Bedford Ave",
"types": route
}, {
"long_name": "New York",
"short_name": "New York",
"types": [ "locality", "political" ]
}, {
"long_name": "Brooklyn",
"short_name": "Brooklyn",
"types": [ "administrative_area_level_3", "political" ]
}, {
"long_name": "Kings",
"short_name": "Kings",
"types": [ "administrative_area_level_2", "political" ]
}, {
"long_name": "New York",
"short_name": "NY",
"types": [ "administrative_area_level_1", "political" ]
}, {
"long_name": "United States",
"short_name": "US",
"types": [ "country", "political" ]
}, {
"long_name": "11211",
"short_name": "11211",
"types": postal_code
} ],
"geometry": {
"location": {
"lat": 40.7142298,
"lng": -73.9614669
},
"location_type": "RANGE_INTERPOLATED",
"viewport": {
"southwest": {
"lat": 40.7110822,
"lng": -73.9646145
},
"northeast": {
"lat": 40.7173774,
"lng": -73.9583193
}
}
}
},
Pick the long_name, and short_name from address.

Resources