You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
onSave event triggers plugin: fingerprints the address, checks cache to see if we already have lat/lng coordinates
If we don't have the info in cache, we perform a query to Google Maps API.
Save the lat/lng coordinates.
If you manually add lat/lng coordinates, you could change the plugin to skip the lookup if the lat/lng TVs are not empty. However, that means that if you change the address of a page, the lat/lng won't change unless you manually delete the lat/lng each time you update the address -- this won't work if you have the TVs hidden, for example.
An un-elegant solution is to have a checkbox that can override the API lookup and allow for manual definitions. A similar low-brow solution is to use a different template for records that you wish to manually set (because only resources with certain templates trigger the map API lookups).
A more elegant solution would be this:
Add an address, save your page.
If the address lookup came from Google Maps API, you cache the lat/lng and you write the lat/lng to the TVs.
If the address lookup came from cache, then you don't re-write the TV values UNLESS they are empty.
This would require a "hasCacheKey" type of function in the Gmarker class. The advantage here would be that a new lookup (and thus new coordinates) would be triggered/injected each time the address was changed, and you would be free to edit the lat/lng coordinates manually after that. If you needed to reset the lat/lng coordinates to the "official" coordinates, then you would need to delete the values in the lat/lng TVs (which is only possible if the TVs are visible and not hidden).
Let's add the ability to manually set latitude and longitude! It'll be swell.
The text was updated successfully, but these errors were encountered: