Skip Navigation

[Closed] Toolset Google map field

This support ticket is created 4 years, 1 month 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.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 7 replies, has 5 voices.

Last updated by Steve Palm 4 years, 1 month ago.

Assisted by: Nigel.

Author
Posts
#1835199

Hi,

I'm using Address custom field to generate Google Address pin for my members, and that works just fine. The client wants me now to show on certain places only for example State and City from that address. Is this possible?

For example, full auto generated google address is: 2876 Middleton Place, Hendersonville, NC 28791, USA
And I need to show on some places Hendersonville, North Carolina

Please advise

Thanks
Sasa

#1835403

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

When Toolset polls the Google Maps API the returned JSON object includes the location coordinates and the full formatted text address, which are the parts Toolset Maps uses, and it discards the rest of the information returned by Google.

But that information includes the individual results for country, state, postal code etc.

In your case, it seems like you would want to add additional custom fields to your posts to store the parts of the address you want to isolate (e.g. state and city) so they can be output directly, as needed.

I've described how to do that previously for the zip code, and the client went on to share their updated solution for all the address parts, and you can see that here: https://toolset.com/forums/topic/separating-content-from-the-address-field/#post-522506

That's from some time ago, and the results of the API may have changed since then, but its the kind of thing you'll need to implement.

#1835589

Thanks Nigel

#1836189

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Can you follow the solution shared by Nigel and see if that help you to resolve your issue.

#1836901

Unfortunately Minesh, I don't have enough coding skills to implement this. Any help will be appreciated.

Thanks,
Sasa

#1839059

Looking at this from the other way around... I had implemented a solution that captured the Google API data and put the values into fields for city, state and country, however in the end we have some users who want their listing to not be an exact street address, so it might be just a city or state, or they may use the map itself to drag the pointer to a generic location. In that case, the Google API did not return a city/state.

So the question is, can we allow on the editing side only a field for address (not a google address field, and optional), city, state, country, and then upon form submission update the google address field so the listing can be mapped in other listing pages on the site? Are there any examples of such a use?

#1839767

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Sorry, Minesh is sick, let me step back in here.

You could have fields for parts of the address and then assemble that into a text string, e.g. "1 Main Street, Brooklyn NY" and use update_post_meta to save that as a value for your Types address field.

Then when you try to display a map with a marker for that post, Toolset won't find a cached location for that address and so it will make a Google API request to look it up, and will save the coordinates corresponding to that location so that it can then be used in filters.

#1842425

I feel like we are going in circles, sorry. The original problem is that using a single address field does not allow creation of filters by other locality units, so you are saying that we should create the address information using those, manually creating/updating a single-field version of the address, and then the system will geocode that at some later point? But that geocoding has nothing to do with being able to use administrative area level filters like city/state, or else we wouldn't have these questions/problems in the first place.

I really don't like having the single address/map on the view for creating an address because they can drag the pointer wherever and instead of an address it ends up just storing corrdinates in the address field. For our use case, we have some that won't list a specific address, just a city, so it seems we have to go with the discrete fields and manually make it all work.

While not every user is asking for this, I have seen quite a few, especial to filter on administrative units based on the address, it seems it would be something Toolset could implement/support.

By the way, this is perhaps more important for community meet-up listing sites where the location isn't fixed, it moves around from meeting to meeting. We want to list the city/state, but can't ever put in a fixed address for it and people have to contact the team to find out where it is meeting that month.

The topic ‘[Closed] Toolset Google map field’ is closed to new replies.