Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After the geojson data is converted to geometry, how do I add click events to the geometry set? #15

Open
17631553844 opened this issue Mar 30, 2020 · 3 comments

Comments

@17631553844
Copy link

After the geojson data is converted to geometry, how do I add click events to the geometry set? When do I want to display some information about the geometry in the geojson data when the click changes。thank you very much indeed

@17631553844
Copy link
Author

Display some information, which are some properties in geojson data properties

@17631553844
Copy link
Author

` var buxinga={};
//使用jquery的getJson获取同目录的01.json
//真正做项目,该数据将从数据库中获取

$.getJSON('01.json',function(data){
    //将获取到的geojosn数据 转换为几何图形后,赋值给collection
    var collection = maptalks.GeoJSON.toGeometry(data);
    //创建一个新的图层,名为vector , 可使用getLayer获取该图层,或使用removeLayer删除该图层
    //将collection 添加到地图实例中
     buxinga = new maptalks.VectorLayer('vector', collection)
        .addTo(map);
});`

@17631553844
Copy link
Author

我已经通过判断单击范围完成了此项工作

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant