Skip Navigation

[Closed] How to use a URL parameter with address field, and bypass Google Maps API

This support ticket is created 3 years, 12 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 3 replies, has 2 voices.

Last updated by Christian Cox 3 years, 11 months ago.

Assisted by: Christian Cox.

Author
Posts
#1597593

I'm building this site free for all to allow people to search nearest businesses for delivery in Italy, so i put here an question to be faster.

It's about map search.

I would custom address field:

- To receive data from the url
- To convert also long address to coordinates (to do not interpellate google maps api all the times)

#1598025
url-param.png
url-param-blocks.png

I would custom address field: - To receive data from the url
You would like to filter a View by distance from some address in a URL to an address in a custom address field created in Types. Is that correct? This is currently possible. When you add a new "Distance" Query Filter, you can choose the address custom field, and configure the map center using a URL parameter. See url-param.png and url-param-blocks.png.

- To convert also long address to coordinates (to do not interpellate google maps api all the times)
This is also currently possible, if I understand your request correctly. You would like to cache geocoded maps addresses to store coordinates instead of hitting the Google Maps API every time a marker is shown for this address. Toolset Maps implements caching on geocoded addresses, so once an address has been geocoded once it will remain in cache until you delete it manually. However, it is required to geocode the address at least once using Google Maps API. Otherwise, distance filtering and ordering are not possible, and map markers may not appear in the correct location for this address.

#1601245
Schermata 2020-04-26 alle 09.53.48.png
Schermata 2020-04-26 alle 09.53.20.png
Schermata 2020-04-26 alle 09.53.11.png

Ok Christian,
i think i can do it via:

$gmap_API_KEY = "xxxxx";
$g_maps_json_url = "hidden link".$custom_fields."&key=".$gmap_API_KEY;

$decoded_json = json_decode($json);

I mean if toolset has a feature to make it possibile.

I have these issues:
I would
1. The user to insert his shipping location
2. One inserted the location it should appear on the search form.

3. I know it is possible with views search but i can't realize how to customize the view. I only need the search form to show just the address and not the range filter. In other words i'd like to just show the address

I used an external plugin to do this but i'd like to use toolset because i know it caches and saves coordinates.

i post some images showing how i integrated the external address autocomplete field.

The plugins just shows the address, while toolset shows also the range

#1602889

I mean if toolset has a feature to make it possibile.
Toolset uses the Google Maps API to geocode each address when it is plotted on a map using a marker. This process is automated and only occurs once. After that, the information is stored in the maps cache for later use.

I would
1. The user to insert his shipping location;

Where will the User insert his shipping location? Is this in a custom Form, or in their WordPress Profile, or in another page of the site somewhere?

2. One inserted the location it should appear on the search form.
You can set the location using a URL parameter in your link to the page. Usually the URL parameter is mapcenter. I can show you in the View settings if you have a question about this.

3. I know it is possible with views search but i can't realize how to customize the view. I only need the search form to show just the address and not the range filter. In other words i'd like to just show the address
You must use custom CSS to hide the range settings, there is no configuration that will turn these off automatically.

The topic ‘[Closed] How to use a URL parameter with address field, and bypass Google Maps API’ is closed to new replies.