Skip Navigation

[Resolved] How to show lines and shapes on maps?

This support ticket is created 3 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 2 voices.

Last updated by Nigel 2 years, 11 months ago.

Assisted by: Nigel.

Author
Posts
#2271073

Hi,

From https://toolset.com/related-lesson/maps/, it's clear to me how to show one or more locations on maps. But what about the scenario of a cruise company wanting to show a cruise route across sea? Or what if I needed to show the border of a part of a town? I need to show lines and shapes on a map similar to the map here: hidden link (here it's done by a KML file with coordinates which is related to the content).

How can I do this?

#2271103

Nigel
Supporter

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

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

You need to use custom code to update the map with lines and shapes, as described in the Google Maps API: hidden link

As to how you adapt that to work with Toolset Maps, you can see a sample of code to draw a circle on a Toolset Map here: hidden link

There isn't a facility to use a KML file in the way you describe.

#2271135

Thank you Nigel. Would it make sense to submit a feature request? Only placing markers is too limited, and custom coding is a no-go in this project. Nevertheless I'd like to take a look at your link but it does not open for me.

As an alternative, should I be able to use a plugin like https://wordpress.org/plugins/ultimate-maps-by-supsystic/ in a template for a custom post type, and use values from custom fields to make it show the desired map? Would this concept work, even apart from this specific plugin?

#2271295

Nigel
Supporter

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

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

Sorry that you couldn't see that link, I've fixed that now.

I don't think it is worth submitting a feature request, to be honest, as such a feature would not be trivial, and I think there are many other features that would be prioritised ahead of this.

As for using another map plugin, it may work, I don't know. I'm not familiar with how that plugin gets the values to power markers.

If it can accept shortcodes, then great, it may well work.

You can output an address field like so:

[types field='my-address' format='FIELD_LATITUDE, FIELD_LONGITUDE'][/types]

See https://toolset.com/documentation/customizing-sites-using-php/functions/#address for more details about the options.

I'd be curious to know how you get on.

#2271323

Thanks again. I will check the various maps plugins. I'm in the preparation and design stage so it may take some time before I'll actually try this.

#2272057

Nigel
Supporter

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

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

OK, let me just mark this as awaiting your feedback so that it is not sitting in my queue.

#2330649

A quick update: I consider to use Toolset maps for the simple maps with markers only, and something like outdooractive.com for more complex maps with routes. I could load those through a HTML snippet. It's not ideal but for now the best option I guess. I'd use both tools for what they're designed for, rather than trying the impossible 🙂

#2330797

Nigel
Supporter

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

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

Seems like a sensible compromise. Good luck with the project.