question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Popup on GeoJSON polygon is not centered on the polygon center but on its border

See original GitHub issue

The layers are created with L.geoJson. On each feature, a popup is binded : layer.bindPopup(popup_string). When layer.openPopup() is called, the popup is open but centered on the border of the polygon (in the middle of the line).

screen shot 2015-01-22 at 17 00 40

I didn’t understand how the position of the popup is computed for this case. If you explain it to me I can try to create a patch.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mournercommented, Jan 23, 2015

@marcu it’s the way popup works on polygon in the stable version, but it has been improved in master version — now proper polygon center is calculated.

Read more comments on GitHub >

github_iconTop Results From Across the Web

tooltip's aren't "centered" despite direction: center being set
If I can get this working I'll hide the marker by doing {opacity: 0} but if I do that now it'll look off...
Read more >
Leaflet: popup showing information on the polygon [closed]
I have a Leaflet map. To the map I load two JavaScript files (A.js & B.js) which both consist of only polygons. Now...
Read more >
Chapter 8 Symbology and Interactivity | Introduction to Web ...
In the first CSS rule, we set properties for the legend as a whole, referring to .legend . We are setting padding, background...
Read more >
Documentation - a JavaScript library for interactive maps
initialize the map on the "map" div with a given center and zoom var map ... Returns a GeoJSON representation of the polygon...
Read more >
Chapter 8 Symbology and Interactivity | Introduction to Web ...
This sets the default Leaflet style for all polygons—blue border and ... just use the text-align property (Section 2.8.3.4) to make the popup...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found