notum-cz / strapi-plugin-location

This plugin allows users to create location inputs and store latitude and longitude values as geometry types in a PostGIS database. It also provides functionality to filter items based on their location.
MIT License
24 stars 13 forks source link

Reverse geocoding #45

Closed omikulcik closed 3 months ago

omikulcik commented 1 year ago

Feature request - Reverse geocoding

The plugin needs to incorporate a functionality where users can input an address, and it will automatically convert it into corresponding coordinates. This can be achieved through the utilization of the Google Maps API, which requires an API key. Developers will be given the choice to input this key into the configuration settings. Importantly, the plugin should gracefully handle situations where the API key is not provided, avoiding errors or any appearance of malfunction. In such cases, this specific feature should be smoothly disabled to prevent any dependency on Google features.

claudiobgit commented 1 year ago

Don't know if it was evaluated and discarded for some reason, but some other options that lean on OpenStreetMap could be:

omikulcik commented 1 year ago

@claudiobgit Thank you for the information provided. We will examine those and consider implementing them.

jonathan-chin commented 8 months ago

hi! are there any updates on this?

I'm using this plugin on a huge non profit / social impact project and would love to have this feature. I'd be happy to pitch in a submit a PR if needed.

omikulcik commented 8 months ago

Hi @jonathan-chin, I am a bit stuck now working on the shape field so if you already have some idea how to implement this, it would be awesome if you could submit a PR! :)

jonathan-chin commented 8 months ago

@omikulcik I was thinking about it yesterday: how would we store the address data?

from an engineering perspective, we probably want to segment it out (city, state, zip, etc).

but from a universal perspective, we probably don't want to make it US centered (sorry, that's where I and my project is based!) and want some international standard. I believe nominatim uses these segments

but also speaking from experience, non technical users hate segmenting out data like that.

what do you think?

omikulcik commented 8 months ago

@jonathan-chin I do not think we need to store the address at all. I though of it just as a way to enable searching in the map and converting the searched location to coordinates.

However, it might be nice to have an option to save the address if needed. If this is needed for your use case others will probably need it too. I personally also prefer the US centered variant you have mentioned but following a standard is probably more appropriate.

jonathan-chin commented 8 months ago

@omikulcik I think it's going to be a fairly common use case. I've also been looking at this, which is how postgis's standardize_address structures data.

perhaps we wouldn't expose all the fields, just the common ones like house_num, name, city, state, country, and postcode? or allow the fields and labels to be set in a plugin-wide configuration?

omikulcik commented 8 months ago

@jonathan-chin Sure, having those is sufficient for most use cases I think. Setting it in the configuration would be cool but it is something that can be added later I suppose.