geojson

How to convert JSON to GeoJSON

那年仲夏 提交于 2019-12-24 04:09:06
问题 I am very new in my learnings of javascript and my rudimentary knowledge has hit a wall. I have setup a Leaflet map which I am wishing to plot divIcon based markers from cords on it from JSON. Through my countless research of trying to get it to work. I learned why my JSON file wasn't working even though I confirmed in the console it was being read. I learned Leaflet prefers it to be in GeoJSON. So I spent several more hours researching how to convert this. Most of my findings were outdated

GeoJSON feature coordinates not displaying on OpenLayers map

泪湿孤枕 提交于 2019-12-24 01:59:19
问题 I'm trying to display a GeoJSON polygon on a map. I've used the example provided by OpenLayers with the following data, but only the second polygon is displayed: var geojsonObject = { "type": "FeatureCollection", "crs": { "type": "name", }, "features": [ { "type": "Feature", "geometry": { "type": "Polygon", "coordinates": [[[103.92240800000013,21.69931],[100.93664,21.66959500000013],[108.031899,18.67076]]] } }, { "type": "Feature", "geometry": { "type": "Polygon", "coordinates": [[[-5e6, -1e6

How to define a circle using GeoJson?

狂风中的少年 提交于 2019-12-24 01:25:27
问题 I want to use geometry in Mongodb. But circle is not supported in geojson according to the geojson.org 回答1: I had exactly the same problem, the solution is to create a polygon that roughly approximates a circle (imagine a polygon with 32+ edges). I wrote a module that does this. You can use it like this: const circleToPolygon = require('circle-to-polygon'); const coordinates = [-27.4575887, -58.99029]; //[lon, lat] const radius = 100; // in meters const numberOfEdges = 32; //optional that

How to reference the data of an existing GeoJSON leaflet object?

ⅰ亾dé卋堺 提交于 2019-12-24 01:15:21
问题 We have a Leaflet Map which we are trying to build using GeoJSON. Our data comes in from a live stream, so we start out by initializing the GeoJSON with empty data: var myLayer = L.geoJson([], { style: function(feature) { var color = getDataband(LATENCY_BANDS, feature.properties.latency).color; return { fillColor: color }; }, pointToLayer: function(feature, latlng) { return L.circleMarker(latlng, geojsonMarkerOptions); }, filter: function(feature, layer) { var latency = feature.properties

How to get GeoJSON into OpenLayers?

邮差的信 提交于 2019-12-24 00:59:20
问题 I already tried to put the following function and new Vector Layer into my code. I uploaded the GeoJSON File into my BPlaced account to link the file in my code, is that right? The Geojson has the same Coordinate System as the website. Also the code seems to work but I don't see any of the Geojson. Or is there another way to embed GeoJSON into OpenLayers? Here is my code: var vectorLayerJSON = new ol.layer.Vector({ source: new ol.source.Vector({ format: new ol.format.GeoJSON(), url: 'http:/

Google Map Data Layer, click on polygon and change opacity (Chrome Bug)

只谈情不闲聊 提交于 2019-12-23 23:22:15
问题 I have a google map where I load geometry data* to the data layer using addGeoJson. Everything works fine until i tried to bind an event on polygons in order to change opactiy settings. *I retreive city borders from OSM to draw polygons, I think my json object is well formatted, I took Google as reference : https://storage.googleapis.com/mapsdevsite/json/google.json As soon as I click on a polygon (any of them), it seems to duplicates my polygons anywhere around however the opacity change

MongoDB $geoIntersects does not work with polygons that contain negative vertices

喜夏-厌秋 提交于 2019-12-23 23:19:30
问题 I have stored polygons in the database that cross over the x and y axes and I want to search for polygons that contain a given point. To do so, I am using the $geoIntersects operator to specify a point, however, MongoDB does not return any polygons when they cross over an axis. Are there any small changes I can make to my query or schema that will allow for this? The query: { polygon: { $geoIntersects: { $geometry: { type: 'Point', coordinates: [long, lat] } } } } The object in the database:

Leaflet separated div element interaction

隐身守侯 提交于 2019-12-23 23:18:51
问题 I am struggling for a bit now with this interaction and finding the right solution on that matter is a quite difficult task (for now). So, I have created map with some basic points using GeoJSON format (created with PHP & MySQL.). And I'm wondering, is it possible to show rednered points in seperated div element, outside map? Example: My question is this? Is it possible when I click on list from right side to automatically open that same clicked element on map? (as shown on picture above)?

Find if given lat-long lies in any of the polygon in MongoDB

别说谁变了你拦得住时间么 提交于 2019-12-23 21:19:48
问题 I want to know if I get a lat-long of a user and want to check if he lies in any of the polygon that is stored in my db (MongoDB). How can this be achieved using mongoDB. For instance my db will have 10 polygons stored as GeoJson objects. I get a lat-long and want to check if this lat-long lies in any of the 10 polygons in my DB. Can this be achieved in MongoDB? 回答1: I dont think your particular case can be achieved in MongoDB. MongoDB does have polygon calculations with the $polygon operator

How to add markers to different layers in leaflet using onEachFeature and geojson

和自甴很熟 提交于 2019-12-23 12:18:27
问题 My current code merely binds markers according to the data from this json file {"type": "FeatureCollection", "features": [{ "geometry": {"type": "Point", "coordinates": [53.8460456,-38.9135742]}, "type": "Feature", "properties":{"name": "red"}]} and my code looks something like this: var blueLayer = new L.LayerGroup(); var redLayer = new L.LayerGroup(); var map = L.map('mapid', { center: [53.8460456,-38.9135742], zoom: 12, layers: [blueLayer, redLayer] }); L.tileLayer('https://api.mapbox.com