geojson

Making a graph inside a leaflet popup using geoJson data

霸气de小男生 提交于 2019-11-28 01:07:52
问题 I'm working on a map that uses leaflet and is populated by data from a file in a GeoJson format. My overarching goal is to put graphs into the leaflet popups for each marker on the map. Getting the markers for each feature and getting the popups to open was fairly easy. However, I am finding it difficult to use D3 to add to the popup. For the sake of simplicity my goal at the moment is to use D3 to create a svg within each leaflet popup div and draw a square. I have found some examples where

Python:Shapefile矢量转化为GeoJSON格式

心已入冬 提交于 2019-11-28 00:46:41
在最近的项目中,完成了许多python处理矢量数据的算法程序,比如缓冲区分析、叠置分析、统计分析等,主要用到的是GDAL/OGR库,很多功能都参照了此链接中的示例: http://pcjericks.github.io/py-gdalogr-cookbook/# 由于完成的功能在上面链接中都能找到实现的代码,所以原来不打算写博客的,但是今天写的这个SHP转GeoJSON的算法把我坑得不轻,着实郁闷了好久才解决,因此就写一下权当纪念吧。有时候写程序真的是一件充满玄学的事情,原理上怎么看怎么对,但是运行起来却偏偏不是那回事,就算调试也给你不报错直接闪退,特别是处理空间数据时属性的编码问题,更是搞得人头皮发麻。这种情况下,能不能调的出来全靠运气,搞不好一个小问题卡一个星期都是正常,这可能也是程序员普遍发量稀少的原因吧。更加玄学的是,解决问题的方式又常常充满戏剧性,折腾了一个早上加半个下午没找到原因,起来喝杯水却突然灵感乍现,三四行代码调整一下顺序,一顿骚操作,点击运行,突然就能运行成功了,再看一下结果,卧槽! 还真是对的!山穷水尽疑无路,柳暗花明又一村,这种感觉真是刺激。 好了,将Shapefile转化为GeoJSON的完整代码如下: 1 # -*- coding: utf-8 -*- 2 from osgeo import ogr 3 import gdal 4 import sys

How to interact with leaflet marker layer from outside the map?

眉间皱痕 提交于 2019-11-27 17:21:12
I have a leaflet map showing points for public art pieces, rendered from GeoJSON . Next to the map, I created a list of the pieces from the same GeoJSON data and want to be able to click on an item from the list outside of the map and have the related marker's popup come up on the map. How can I link the list of items to their respective markers through a click event? My map.js file looks like this: var map; var pointsLayer; $(document).ready(function () { map = new L.Map('mapContainer'); var url = 'http://{s}.tiles.mapbox.com/v3/mapbox.mapbox-streets/{z}/{x}/{y}.png'; var copyright = 'Map

Attempting to a configurable attribute of a configurable property Issue-in turfJS?

醉酒当歌 提交于 2019-11-27 16:29:14
I have an issue with @turf/turf the last version, in my react native app "react-native": "0.58.0", "@turf/turf": "^5.1.6" I just followed the same example in the README.md but it's not working with me anymore. The issue is when I import turf like this import * as turf from '@turf/turf'; and write the function here is handleNearby = () => { const { region, providers } = this.state; let currentPoint = [region.longitude, region.latitude] let points = _.map(providers, p => { console.log('@p', p); const to = [p.coordinates.longitude, p.coordinates.latitude]; const distance = turf.distance

Is it possible to read geoJSON or topoJSON file in R to draw a choropleth map?

倖福魔咒の 提交于 2019-11-27 14:21:09
topoJSON and geoJSON files are know very common for drawing maps on the internet. Is it possible to import them in R to draw choropleth maps? Spacedman Get the rgdal package installed. Then if: library(rgdal) > "GeoJSON" %in% ogrDrivers()$name [1] TRUE then you can do something like: > map = readOGR("foo.json", "OGRGeoJSON") > plot(map) But you need GeoJSON support in your ogrDrivers list. 来源: https://stackoverflow.com/questions/24183007/is-it-possible-to-read-geojson-or-topojson-file-in-r-to-draw-a-choropleth-map

zoom to geojson polygons bounds in Google Maps API v3

一世执手 提交于 2019-11-27 13:43:13
问题 I'm loading geojson from a Postgis-database and want to display it on my map. After drawing a polygon, I want the map to zoom to the extents of the added polygon. My data loads fine and displays correct on the map, but I cannot figure out how to get the bounds and change the zoom to the newly added polygon. I tried to use parts of the code from Google's Data Layer: Drag and Drop GeoJSON example, but the displayed map zooms in somewhere in the Pacific Ocean close to the Baker Islands, while

【Cesium Sandcastle 研究4】- GeoJSON 与 TopoJSON

两盒软妹~` 提交于 2019-11-27 13:00:19
访问地址: http://localhost:8080/Apps/Sandcastle/index.html?src=GeoJSON%20and%20TopoJSON.html&label=Tutorials 知识点 // Seed the random number generator for repeatable results. Cesium.Math.setRandomNumberSeed(0); // 产生随机颜色值 color = Cesium.Color.fromRandom({alpha : 1.0}); // 一个DataSource处理 GeoJSON和TopoJSON数据的。 var promise = Cesium.GeoJsonDataSource.load('../../SampleData/ne_10m_us_states.topojson'); // 等到数据源加载成功后 promise.then(function(dataSource) { } // 矩形框的颜色 和 边框 //Set the polygon material to our random color. entity.polygon.material = color; //Remove the outlines. entity.polygon.outline = false;

Creating a GeoJson in php from MySql to use with MapBox javascript API

删除回忆录丶 提交于 2019-11-27 12:34:06
问题 What I'm trying to do is very simple; get marker's data from a Mysql table with my PHP code, convert that that to a geoJson ( used by MapBox ), send that geoJson to javascript and then populate those marker into my map. I've been reading very carefully the following two links, that apparently contains all the info I need to resolve this, but I'm not sure what I'm missing. Here you can see an example on how to populate markers from a geoJson in MapBox; Here you can see how to create a geoJson

jqGrid from USGS geojson data

风流意气都作罢 提交于 2019-11-27 08:14:27
问题 I'm trying to read and post in a jqGrid a set of earthquakes GeoJSON data extracted from USGS repository. The request is accepted, but displays "Uncaught SyntaxError: Unexpected token" when probably meets the header metadata. $(function () { 'use strict'; $.extend($.jgrid.search, {multipleSearch: true, multipleGroup: true, overlay: 0}); $('#grid').jqGrid({ url: 'http://earthquake.usgs.gov/earthquakes/feed/geojson/2.5/week?callback=?', datatype: 'json', colModel: [ {name: 'mag', label:

Venue/Indoor Map using D3.js and Geojson

喜你入骨 提交于 2019-11-27 03:41:46
问题 I have created geojson file which contains all the features of 1st floor of a shopping mall. I got that venue map projected using d3.js with different colors but only some parts not the complete map. Below is the script code and link to the geojson file. Also please note that i have not converted this geojson into topojson and used Qgis to draw the maps and c#.net to convert the geometry data to geojson objects. Can anyone please check my json and my d3.js code? Do I need to use any other