user1249791
user1249791

Reputation: 1271

unable to plot polygons in d3.js "format" over leaflet.js

I am doing a very simple implementation of plotting polygons in Leaflet.js using d3.js

I am following this: http://bost.ocks.org/mike/leaflet/

Polygons are plotted correctly, but when zooming in/out most of them are not visualized (even if in DOM I can see these hidden polygons)

You can check http://bl.ocks.org/pere/7370413

Any ideas?

Upvotes: 0

Views: 281

Answers (1)

user1614080
user1614080

Reputation: 2874

The bounds were being calculated outside of the reset function so it was using the original zoom (I think this might be a small error in Mikes Bl.ock, although experience has taught me this is rarely the case). Because the bounds were calculated outside of reset it was using the original zooms bounds and hence you saw the polygons drift. Also, this stops the polygons being "cut-off" (which occurs in Mike's Bl.ock).

Anyway I bumped your Bl.ock to here. There are some other minor changes as well.

Hope this helps.

Upvotes: 1

Related Questions