maptiler / maptiler-client-js

MapTiler APIs wrapper in JavaScript & TypeScript
https://docs.maptiler.com/client-js/
BSD 3-Clause "New" or "Revised" License
14 stars 7 forks source link

context is missing when requesting a place by its id #14

Closed younes0 closed 1 year ago

younes0 commented 1 year ago

It may be the wrong place to raise this issue but, the context object is not included when searching by feature id https://api.maptiler.com/geocoding/region.26866992?key=XXXXX&language=en%2Cfr There shouldn't be any limitations that would prevent to include this context object right ?

bolollo commented 1 year ago

Hi, currently, the context is not returned if there is no context (for countries) or an object is queried by its ID. Otherwise, the context must be there.

To get context, you can perform reverse geocoding using the (center) coordinates returned in response to a query by ID. Example: https://api.maptiler.com/geocoding/115.0906400755048,-8.330497647109507.json?key=XXXXX&language=en,fr

Any other question or doubt do not hesitate to write us here or create a new issue.

younes0 commented 1 year ago

Hi @bolollo Thanks for your response, actually this is what I'm doing currently: given: https://api.maptiler.com/geocoding/county.26994945.json ("Las Palmas" feature) I get the the center: https://api.maptiler.com/geocoding/-13.516065765662052,29.413087272089275.json

But I see 2 problems here:

Edit: changed URL

younes0 commented 1 year ago

Your solution works, thanks @bolollo I was trying to get the feature "Las Palmas" in the reverse geocoding results but all I need is the first (lowest admin level).feature's context

BTW, I saw that all ids have changed recently, are these ids are stable now ?

bolollo commented 1 year ago

Hi @younes0, I'm glad it works for you. We are making changes to improve the geocoder; recently, we have changed the Ids. At the moment, we only have stable Ids for some elements.

I see you are looking for Las Palmas; we can speak in Spanish if you prefer.

younes0 commented 1 year ago

hello @bolollo sorry for the late response. okay that's good to know that you have stable ids for the main elements (continents, countries, regions & big cities from what I saw)

younes0 commented 1 year ago

Hello there,

Since our last interaction, I saw that the maptiler IDs have been changed for some elements such as subregions. I was just wondering if the IDs were now stable ?

My app would crash with unstable ids. I could rely on the OSM IDs but your API doesn't allow to get a Feature by its OSM ID.

Thanks.

jonathanlurie commented 1 year ago

Hello @younes0 , thanks for the feedback! I'll pass the question to the person in charge of geocoding, and let you know.

younes0 commented 1 year ago

@jonathanlurie thank you @jonathanlurie , please let me know if this is not the appropriate place to ask this. Best.

zdila commented 1 year ago

Hi @younes0. Feature IDs are unfortunately not stable and change every time we update indexes. We may later introduce a service which would map osm ID to feature ID as we know about this problem.

younes0 commented 1 year ago

Hello @zdila, is this mapping service translates to an endpoint that queries by osm ID instead of featureID ? eg: https://api.maptiler.com/geocoding/{osm-id}.json If yes, when do you plan to release this service ? Do you plant to update indexes again before its release ? Best.

zdila commented 1 year ago

No we don't plan this. We use various sources, not only OSM. Also some features in geocoding are derived from multiple features from OSM.

To get feature by OSM ID the best is to use OSM API directly.

younes0 commented 1 year ago

@zdila Thank you for your answer. Unfortunately, I need stable ID.