[Map] Setting Point not by coordinates but by text query
For UX Map it would be helpful if the points for map center and marker would not only be available by Long-Lat-Combinations but by text query. Google maps e.g. has this in their url request: https://www.google.com/maps/embed/v1/place?key={{ GoogleMapsApiKey }}&q={{ GoogleMapsLocation }}&zoom=15 Where GoogleMapsLocation could be "Times Square, Manhattan, New York" for example. Then Google would center the Map around that point instead of giving coordinates.
Hi, I understand it can be useful, but that would mean introducing geocoding to UX Map, and I don’t think we really want that. UX Map is designed to display a map on your website.
That said, I kind of agree that having something like Point::fromAddress('Times Square, Manhattan, New York') (or equivalent) would be appealing. However:
- Imagine you’re using Leaflet to render your map. Should we geocode through Leaflet/OpenStreetMap (if such a service exists) or through the Google Maps API?
-
Pointonly takes two (required) parameters,$latitudeand$longitude, meaning thatPoint::fromAddress()would need to rely on some workarounds to properly initialize the object. It might also require a static object (to call a geocoding service). - We also want to store geocoding results in cache; calling the geocoding service each time the map renders is a no-go.
In conclusion, I believe such logic should stay external to UX Map. You can easily implement this feature by using a geocoding client (with cache) by yourself and creating your Point instance with new Point(...$geocodedAddress['_latlng']).
I'm closing, feel free to re-open if needed!