Mapbox-GL GEOjsonSource vs Datasource

醉酒当歌 提交于 2019-12-25 17:25:36

问题


confused by the API on mapbox-gl-js.

You can add a geojson file by using GEOjsonsource or DataSource, what is the difference ? It seems like you can only associate a style with a Datasource, not a GeoJsonsource ?


回答1:


Both of the links in your question ("GEOjsonsource" and "DataSource") describe to the same domain object, GeoJSONSource.

The first link is to the Mapbox GL Style Specification, which explains how to declare a GeoJSON source in a style. A style is a JSON file that describes how your map should look.

The second link is to the Mapbox GL JS API Documentation, which explains how to use the GeoJSONSource class in Mapbox GL JS. Your declaration in the style is used to create an instance of GeoJSONSource. You can also create an instance of GeoJSONSource directly.

You may find this example to be helpful.



来源:https://stackoverflow.com/questions/36713286/mapbox-gl-geojsonsource-vs-datasource

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!