Hi, would it be possible to use Toolset Map with a static image?
The idea would be to create an interactive map of an entertainment area, storing the various locations info on WP posts and assigning them with markers on the map.
Any idea or suggestion is appreciated. Thanks.
Hi,
Thank you for contacting us and I'd be happy to assist.
You can use the location from the Toolset Types Address field and show it on the map using Google's static maps API. But, that map would load as an image and won't be interactive.
Here are some helpful resources on the topic:
https://toolset.com/2022/10/how-toolset-and-the-maps-static-api-can-help-you-cut-costs/
https://toolset.com/forums/topic/without-openstreet-maps-how-can-we-make-google-maps-cheaper/
I hope this helps and please let me know if you need further assistance.
regards,
Waqar
Hi,
Thank you for contacting us and I'd be happy to assist.
You can use the location from the Toolset Types Address field and show it on the map using Google's static maps API. But, that map would load as an image and won't be interactive.
Here are some helpful resources on the topic:
https://toolset.com/2022/10/how-toolset-and-the-maps-static-api-can-help-you-cut-costs/
https://toolset.com/forums/topic/without-openstreet-maps-how-can-we-make-google-maps-cheaper/
I hope this helps and please let me know if you need further assistance.
regards,
Waqar
Hi, thanks for the tip. I'm aware of the topic you mentioned, and although I was already familiar with it, I understand that it still sends a request to Google, resulting in additional costs.
Once the addresses of the different markers have been defined, would it be possible to utilize a static image instead? By using a "default" coordinate, the markers could be positioned based on the relative positioning of the Toolset custom field address. Does this idea make sense to you?
Thanks for writing back.
When a new address is saved in any address type custom field, its lat/lon coordinates are automatically saved in a Toolset custom map cache table. This way Google's Geocoding API calls are significantly reduced, as they're not called each time from the API and are loaded from that local table.
Despite that, whenever you'll load an interactive Google Map on a page, that map generation/rendering will still be charged.
> Once the addresses of the different markers have been defined, would it be possible to utilize a static image instead?
- To achieve something like this, you'll need a fair amount of complex code customization. You'll need a custom function that would:
a). Run each time a post with the address field is saved or updated.
b). Make a call to Google's static maps API and store the generated map image with the marker in the media library.
c). Also store that saved image's URL in an image type custom field.
This way, whenever you'll show the map with a specific location's map marker, you'll simply be loading the stored image from the media library and not making a call to Google's Maps API.
I hope this makes sense and for more personalized assistance around custom code, you can also consider hiring a professional from our list of recommended contractors:
https://toolset.com/contractors/