Render 2500 geoJSON polygons onto a leaflet map

前端 未结 4 1790
盖世英雄少女心
盖世英雄少女心 2021-02-01 00:01

I\'ve been searching but cannot seem to find a solution.

I have a GeoJSON file which is 170mb in size. It contains about 2500 polygons. Somehow I need to render it to a

4条回答
  •  北恋
    北恋 (楼主)
    2021-02-01 00:11

    I cannot argue with psousa's recommendation. For a straightforward presentation, TileMill is a great idea.

    However, if you want to overlay your polygons onto another map, I reckon the only way is by using Mike Bostock's TopoJSON and D3.

    The main TopoJSON page: https://github.com/mbostock/topojson/wiki

    An example at the scale you are talking about: http://bl.ocks.org/mbostock/4206573

    You'll have to shop around Mike's excellent examples on github to see how to combine leaflet with a D3 overlay.

    I'm currently doing this successfully with hundreds of complex polygons. Haven't had the need to break into the thousands ... yet.

提交回复
热议问题