Mapbox-GL GEOjsonSource与数据源 [英] Mapbox-GL GEOjsonSource vs Datasource

查看:1053
本文介绍了Mapbox-GL GEOjsonSource与数据源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

被mapbox-gl-js上的API混淆了.

confused by the API on mapbox-gl-js.

您可以使用 GEOjsonsource 添加geojson文件或数据源有什么区别?看来您只能将样式与数据源相关联, GeoJsonsource吗?

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 ?

推荐答案

问题中的两个链接(" DataSource )描述同一个域对象GeoJSONSource.

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

第一个链接是指向Mapbox GL样式的规范,说明了如何以样式声明GeoJSON源.样式是一个JSON文件,用于描述地图的外观.

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.

第二个链接是指向Mapbox GL JS API文档的,其中说明了如何在Mapbox GL JS中使用GeoJSONSource类.样式中的声明用于创建GeoJSONSource的实例.您也可以直接创建GeoJSONSource的实例.

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.

这篇关于Mapbox-GL GEOjsonSource与数据源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆