0

API: https://geocode.search.hereapi.com/v1/geocode

That is the random house in the Spain, Alicante, what I just picked to show the problem.

So, we have two queries:

Calle de los Montesinos, 3
    q=calle+de+los+montesinos%2C+3&qq=city%3DAlicante%3Bstate%3DAlicante%3Bcountry%3DEspa%C3%B1a

[id] => here:af:street:MS23.2XYayGBPuciUbFFAA

returns the street, instead on house number.

But

Calle de los Montesinos, 3, 03015
q=calle+de+los+montesinos%2C+3%2C+03015&qq=city%3DAlicante%3Bstate%3DAlicante%3Bcountry%3DEspa%C3%B1a

[id] => here:af:streetsection:FXw-CIgiEIF2be8V7fRDYD:CggIBCCtiqCqAhABGgEz

returns house object as it should. But of course nobody want's to add the postal code every time.

What is going on?

2 Answers2

0

You can use the ‘q’ query parameter (which accepts free flow text) only (no qq!), it gives you desired result.

  • q = Calle de los Montesinos 3
  • q = Calle de los Montesinos 3 Alicante
  • q = Calle de los Montesinos 3 Alicante Spain

All of the above will give you desired id - "id": "here:af:streetsection:FXw-CIgiEIF2be8V7fRDYD:CggIBCCtiqCqAhABGgEz"

You can filter/parse the output based on resultType and scoring depending on your use case.

If you can tell me more about your use case I will be able to help in a better way.

  • https://developer.here.com/documentation/geocoding-search-api/api-reference-swagger.html "Note: Either q or qq-parameter is required on this endpoint. Both parameters can be provided in the same request." Q or QQ - it was in Open Street Map. I need to find what user want's on limited previously location. Using only "q" makes result worsts, because I don't know what user will fill inside the q. – wokenlex Jul 01 '21 at 09:59
0

HERE Geocoding and Search provide customers a flexible way to retrieve relevant results for textual queries.

All results are typed: Each result item contains a response element resultType with a well-defined value.

There are currently 9 values in this resultType, which is an enum of place, locality, street, house number, administrative area, address block, intersection, postal code point, chainQuery, category query.

https://developers.here.com/documentation/geocoding-search-api/dev_guide/topics/result-types-address.html

houseNumber results are address results containing house-level address details.

Results of type houseNumber have an additional field houseNumberType that further defines results of types: interpolated, PA

PA stands for "point address" and denotes a very accurate position for the house. interpolated results are slightly less accurate, but are based on a highly optimized interpolation algorithm.

For Example :

  • q = Invalidenstraße 116, 10115 Berlin, Germany:

enter image description here

Street

Result type street has no further subdivision in input address.

For example, Avenue des Champs-Élysées, 75008 Paris, France:

enter image description here

  • Question was not about types. It was about wrong behavior. You are trying to find the home with that concrete exampled address - and it shows the street in results. You are adding the postalCode to query - and oops - home address is right here. It's not happening everywhere. – wokenlex Jul 08 '21 at 12:48
  • [Please don't hide textual information like code in images](https://meta.stackoverflow.com/a/285557/354577). Post it as code formatted _text_ so it can be indexed (and therefore searched), copied, read by screen readers, etc. – ChrisGPT was on strike Jul 09 '21 at 22:00