在叠加层上显示GeoJSON数据 [英] Showing GeoJSON data on overlay

查看:133
本文介绍了在叠加层上显示GeoJSON数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在叠加层上显示/隐藏一些GeoJSON数据. 我将数据作为对象,但没有在某些服务器上.

I'm trying to show/hide some GeoJSON data on an overlay layer. I've the data as an object, but not at some server.

如果我使用覆盖类型'geoJSON',则会收到错误消息:

If I use the overlay type 'geoJSON', I'm getting a Eror:

A base layer must have an url

如何使用重叠显示/隐藏显示/隐藏数据?

How do I show/hide my data using the overlay show/hide?

混合层-overlays-geojson-example 对我不起作用,因为它使用了远程(xyz-json)数据.

The mixed-layers-overlays-geojson-example is not working for me because it uses remote (xyz-json) data.

其他信息:我已经将一些对象中的数据存储在要根据用户交互进行修改/更新的数据中.

Additional information: I've the data in some object that I'm intending to modify/update based on user interaction.

PS:这可能是非常简单的问题

PS: it's probably very simple problem

编辑:我制作了情况下的罪魁祸首.它显示了动态添加和删除路径对象以及一些针对geoJSON对象的空函数.

Edit: I made a plunker of the situation. It shows the dynamic adding and removing of a path object and some empty functions for the geoJSON objects.

推荐答案

我(我的同事)发现了一个难看的答案:直接访问传单层.

I (my collegue) found some ugly answer: accessing the leaflet layers directly.

我从描述中分叉了插件,并添加了一些功能.参见我的函数transformGeoObjToPathgeoToLeafletLayer.在我们的应用程序中,我们将类型为'featureGroup'的图层用于其他内容,例如选择,但这不在'解决方案'示例中

I forked the plunker from the description and added some functions. See my functions transformGeoObjToPath and geoToLeafletLayer. In our application we use layers of type 'featureGroup' for additional stuff like selecting, but this is not in the 'solution' example

但是解决方案不是美丽的",因为它可以直接访问传单.

But the solution is not 'beautiful', because it accesses the leaflet directly.

这篇关于在叠加层上显示GeoJSON数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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