将2500个GeoJSON多边形渲染到传单图上 [英] Render 2500 geoJSON polygons onto a leaflet map
问题描述
我一直在搜索,但似乎找不到解决方案。
我有一个大小为170mb的GeoJSON文件。它包含大约2500个多边形。不知怎的,我需要把它呈现给传单图。显然,在这个大小我没有机会。
最简单的方法是渲染这些数据?我能够创建一个完整的透明png,可以简单地渲染在世界地图上。巨大的大小是由于复杂性和多边形数量。在这一点上,我不需要它是互动的。
谢谢,
Brian
最简单的方法是根据这些数据创建自己的地图图块。有几种方法可以实现这一点,但我的建议是使用 TileMill 。它是免费的,非常容易使用。所以,基本上你会:
-
使用TileMill并指定GeoJSON文件作为数据源
-
在TileMill
- 中配置如何显示地图(如多边形的颜色),使用特殊的类似CSS的语言
生成图块
-
在引用您的文件的宣传单地图中加载新的TileLayer
Use TileMill and specify your GeoJSON file as the data-source
Configure how the map should be displayed (like the color of the polygons) with a special CSS-like language inside TileMill
Generate the tiles
Load a new TileLayer in your Leaflet map that references your files
我之前实际上写了一个教程,使用.shp而不是GeoJson,但应该足够相似:
http:// build -failed.blogspot.pt/2012/03/custom-map-tiles-part-2-tilemill.html
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 leaflet map. Evidently at that size I have no chance.
What will the easiest way to render this data? Am I able to create a complete transparent png which can simply be rendered over the world map. The huge size is due to the complexity and the number of polygons. At this point I don't need it to be interactive.
Thanks, Brian
The easiest way is to create your own map tiles based on that data. There are a couple of ways of achieving this but my suggestion is that you use TileMill. It's free and very easy to use. So, basically you would:
I've actually written a tutorial some time ago that uses a .shp instead of a GeoJson, but should be similar enough:
http://build-failed.blogspot.pt/2012/03/custom-map-tiles-part-2-tilemill.html
这篇关于将2500个GeoJSON多边形渲染到传单图上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!