Support » Plugin: Leaflet Map » How to draw a polygon with a shortcode

  • Resolved tommcgee

    (@tommcgee)


    The docs say that leaflet-polygon is done in a virtually identical way to leaflet-line, but when I try:

    [leaflet-polygon latlngs=”24.49544204715154,39.54516336321831;23.612612559142114,52.48705789446831;24.315358601162448,54.7062961757183;25.19330573538391,55.2556125819683″]

    or even
    [leaflet-polygon addresses=”Montreal;Halifax;Quebec”]

    All it does is echo the literal shortcodes back to the browser screen. What’s the proper syntax?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author bozdoz

    (@bozdoz)

    Do you know what version you’re running?

    Are you using [leaflet-map] before [leaflet-polygon]?

    Can you see the polygon example in the admin under Leaflet Map > Shortcode Helper?

    I was able to create a polygon without issue.

    See pic: https://imgur.com/a/9jXCayq

    I’m running 2.15.0.

    You can see the maps I’m working on at this test page:
    http://blogs.shu.edu/tomstest/2018/10/test-geo-map/

    This first is a map with markers and a leaflet-line based on addresses. So far, so good.

    The second is the problematic one. The code I’m inserting is this:
    [leaflet-map zoom=5 zoomcontrol lat=24.49544204715154 lng=39.54516336321831]
    [leaflet-polygon latlngs=”24.49544204715154,39.54516336321831;23.612612559142114,52.48705789446831;24.315358601162448,54.7062961757183;25.19330573538391,55.2556125819683″]
    [leaflet-polygon fillColor=”green” stroke=”blue” addresses=”Montreal;Halifax;Quebec”]

    You can see that the code is just output to the screen instead of rendering.

    The third map is also a collection of markers, some with popups, and lines.

    The fourth is rendered from a .json file which you can see at
    https://blogs.shu.edu/tomstest/files/2019/09/map-5.json

    The polygons render here.

    The shortcode helper has polygons, but they’re derived from an external json file. What is the code that the imgur link you’ve provided uses?

    Plugin Author bozdoz

    (@bozdoz)

    Ah, I’m sorry. Apparently I did not actually publish the polygon shortcode. I will do so asap. Thanks for bringing this to my attention!

    Thanks! I’ll watch for it, and let you know how it goes.

    It works — thank you!

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.