geojson

Google forEach map.data feature - return feature LatLng

淺唱寂寞╮ 提交于 2020-01-02 22:16:32
问题 I am trying to iterate through GeoJSON map.data using a forEach. I want to return the position (LatLng) of each feature so I can add it to my markers array based on a feature property. Here's my attempt: allMarkers = []; jQuery.getJSON('json.php', function(data){ points = map.data.addGeoJson(data); }); var eid = 30; map.data.forEach(function(feature){ if(feature.getProperty('eid') === eid){ LatLng = feature.getGeometry().LatLng; //not sure how to get LatLng id = feature.getProerty('id'); var

Google forEach map.data feature - return feature LatLng

让人想犯罪 __ 提交于 2020-01-02 22:16:13
问题 I am trying to iterate through GeoJSON map.data using a forEach. I want to return the position (LatLng) of each feature so I can add it to my markers array based on a feature property. Here's my attempt: allMarkers = []; jQuery.getJSON('json.php', function(data){ points = map.data.addGeoJson(data); }); var eid = 30; map.data.forEach(function(feature){ if(feature.getProperty('eid') === eid){ LatLng = feature.getGeometry().LatLng; //not sure how to get LatLng id = feature.getProerty('id'); var

Clustering markers on mapbox / leaflet

这一生的挚爱 提交于 2020-01-01 03:05:06
问题 I'm trying to set up a clustered map on mapbox, like http://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-realworld.388.html But their example uses a plain .js file as data http://www.mapbox.com/mapbox.js/assets/realworld.388.js And the only thing I can get from mapbox is .geojson http://api.tiles.mapbox.com/v3/thebteam.map-w9jzcznw/markers.geojson Is there a way I can convert the geojson to js (on a regular basis)? Or export a javascript array from mapbox? EDIT: ended up

How to trigger events on Leaflet map polygons?

与世无争的帅哥 提交于 2019-12-31 09:29:43
问题 I'm trying to figure out how to manually trigger events for Leaflet polygons (loaded via GeoJSON). In a nutshell, I have a Leaflet map with numerous polygons. I also have a regular hyperlink outside of the map that when clicked, should trigger a mouseover event (or any event really) on a particular polygon. How do I assign ID's to all of my polygons so that I can bind hyperlink(s) to a specific polygon's event? Or is that even the most logical way of doing this? Ultimately, I'm trying to

Combine part of geojson object into another in Python

纵饮孤独 提交于 2019-12-31 04:30:15
问题 EDIT: I am trying to manipulate JSON files in Python. In my data some polygons have multiple related information: coordinates ( LineString ) and area percent and area ( Text and Area in Point ), I want to combine them to a single JSON object. As an example, the data from files are as follows: data = { "type": "FeatureCollection", "name": "entities", "features": [{ "type": "Feature", "properties": { "Layer": "0", "SubClasses": "AcDbEntity:AcDbBlockReference", "EntityHandle": "2F1" }, "geometry

How to know if topojson is installed and working normally?

北城余情 提交于 2019-12-30 14:49:42
问题 How to know if topojson is well installed and working normally? An example tiny file to convert will be appreciate. with both the source and expected result 回答1: If you haven't stumbled across this yet I found it to be a great walkthrough of the entire process: http://bost.ocks.org/mike/map/ The above link also includes the command to run to check if topojson is installed: $which topojson If topojson is installed correctly this will print out the directory where it's installed, which might

GeoJSON Point name & description not displayed when using Google Map API V3

孤街浪徒 提交于 2019-12-30 05:05:26
问题 I am starting to use the Google Map Javascript API V3 and wish to display markers on a map, using GeoJSON. My GeoJSON is as follows: { "type": "FeatureCollection", "features": [ { "type": "Feature", "geometry": { "type": "Point", "coordinates": [153.236112, -27.779627] }, "properties": { "name": "[153.236112, -27.779627]", "description": "Timestamp: 16:37:16.293" } }, { "type": "Feature", "geometry": { "type": "Point", "coordinates": [153.230447, -27.777501] }, "properties": { "name": "[153

GeoJSON Point name & description not displayed when using Google Map API V3

笑着哭i 提交于 2019-12-30 05:05:25
问题 I am starting to use the Google Map Javascript API V3 and wish to display markers on a map, using GeoJSON. My GeoJSON is as follows: { "type": "FeatureCollection", "features": [ { "type": "Feature", "geometry": { "type": "Point", "coordinates": [153.236112, -27.779627] }, "properties": { "name": "[153.236112, -27.779627]", "description": "Timestamp: 16:37:16.293" } }, { "type": "Feature", "geometry": { "type": "Point", "coordinates": [153.230447, -27.777501] }, "properties": { "name": "[153

How to add data to array in Mongoose Schema

让人想犯罪 __ 提交于 2019-12-29 09:59:23
问题 Assuming the following schema, I am trying to save some GeoJSON data with Mongoose var simpleSchema = new Schema({ properties:{ name:String, surname:String }, location : { type : String, coordinates : [ Number , Number ] } }); This is how I try to save the document var a = new simple({properties:{name:"a", surname:"b"}, location:{type:"Point", coordinates:[1, 0]}}).save(function(err){...}); However, what I am getting in the database is ObjectId("542da9ab0882b41855ac3be0"), "properties" : {

geopandas +flask+json+js总结

爷,独闯天下 提交于 2019-12-28 09:13:23
1、查询库数据,从数据库postgres中,使用ST_AsGeoJSON提取地理化信息字段,并进行转换为geojson格式: sql = ‘select ST_AsGeoJSON(geom),* from “CellParament铜陵3GisBand”’ sql = text(sql) df = pd.read_sql(sql, con=engineSourcesGis) 2、构造json格式数据,在flask中得到的从postgres中的数据,需要通过按照geojson这是要求,做字典化转换,以使得flask能识别,循环语句中的"st_asgeojson"字段需要通过json.loads转成json传入字典。直接通过geopandas读取postgres数据库,用to_json方法不成功: properties = [‘小区名称’, ‘Ci’] geojson = {‘type’:‘FeatureCollection’, ‘features’:[]} for _, row in df.iterrows(): feature = {‘type’:‘Feature’, ‘properties’:{}, ‘geometry’:json.loads(row[“st_asgeojson”])} for prop in properties: feature[‘properties’]