geojson

Shapefile to Topojson conversion

我的梦境 提交于 2019-11-29 11:54:48
I am trying to convert the Ghana admin1 shapefile that can be found here . My end goal is to obtain a TopoJSON as described in this question . I have used this command on a Linux machine: ogr2ogr -f GeoJSON GHA_adm1.json GHA_adm1.shp And it returns this: Unable to open datasource `GHA_adm1.shp' with the following drivers. ... here goes a long list of drivers... I am I doing something wrong? Should I install other "drivers"? But how? Thanks. Hugolpz Download the GIS source GADM is the perfect source for administrative GIS files. GADM.org > Download page : select your country and format

Is it possible to determine if a GeoJSON point is inside a GeoJSON polygon using JavasScript?

家住魔仙堡 提交于 2019-11-29 11:26:30
问题 Is it possible to determine whether a GeoJSON point at a given lat,lon lies within a given GeoJSON polygon using only JavaScript (either through d3, topojson, or any other way)? For example, I can draw a map showing countries in the UK based on the tutorial here. I then have a some points which have coordinates but no indication as to which country they lie within. I would like to display a total point count for each country. Can I work out which country contains each point in the browser, or

Python Script to Convert CSV to GeoJSON

余生长醉 提交于 2019-11-29 11:09:07
I am needing a Python script to convert CSV data to GeoJSON output. The output should match the format, below: { "type": "FeatureCollection", "features": [ { "type": "Feature", "geometry": { "type": "Point", "coordinates": [ -85.362709,40.466442 ] }, "properties": { "weather":"Overcast", "temp":"30.2 F" } } ] } I am using this script to run the process, but it does not produce the desired output: import csv, json li = [] with open('CurrentObs.csv', newline='') as csvfile: reader = csv.reader(csvfile, delimiter=',') for latitude, longitude, weather, temp in reader: li.append({ "latitude":

update properties of geojson to use it with leaflet

旧城冷巷雨未停 提交于 2019-11-29 08:51:37
I have a requirement of using leaflet.js to add a map to my site. The site has an administration view where an admin can add markers and add description and image to each marker. I used the leaflet.draw plugin, and on the create event I try to update the GeoJSON object I got using event.layer.toGeoJSON() to add some properties like image and text but with no luck. Can any one help me on this? var osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', osmAttrib = '© <a href="http://openstreetmap.org/copyright">OpenStreetMap</a> contributors', osm = L.tileLayer(osmUrl, { maxZoom: 18,

echarts实现某个市3D地图展示

江枫思渺然 提交于 2019-11-29 08:15:56
应业务需求,以3D形式展示某个城市的地图,并根据该城市下属区域车辆的多少,动态变幻区域颜色 大概效果如下(颜色随便给的,超丑 简单记录下吧) 以舟山市为例: 1.生成舟山市的geojson文件 查询链接: http://echarts.baidu.com/echarts2/doc/example/geoJson/china-main-city/522200.json 想要对应城市的geojson地图数据文件,直接用对应城市的区划代码的前六位替换掉链接后面的区划代码即可(可参考 https://blog.csdn.net/GRAY_KEY/article/details/80197527 的博客) 2.引入对应的echarts.js和 echarts-gl.js(下载地址: https://www.echartsjs.com/zh/download.html ) 代码如下:具体配置内容参考 https://www.echartsjs.com/zh/option-gl.html#globe // 初始化图表 var myChart = echarts.init(document.getElementById('main')); // JSON文件(地图数据)路径 var uploadedDataURL = "json/zhoushan.json"; var option = {}; /

如何完美兼容地图渲染和GIS数据处理?你只需要一款Aspose.GIS!

扶醉桌前 提交于 2019-11-29 08:09:26
当我们谈论一些GIS API时,首先想到的是渲染高级地图文件。近期,慧都推出了一款能够读取,编写和转换最流行的GIS文件格式,例如ESRI Shapefile和GeoJSON,而无需任何其他软件的API控件——Aspose.GIS( 点击下载 )。 那么,你知道Aspose.GIS同样拥有强大的地图渲染功能吗?下面我们用示例来介绍如何使用这项功能。 Aspose.GIS提供了此功能以将Shapefile,FileGDB,GeoJSON,KML或其他受支持的文件格式渲染为SVG。为了简化和快速生成结果而无需设置大量属性,可以使用很少的代码行来渲染地图。 using (var map = new Map(800, 400)) { map.Add(VectorLayer.Open(dataDir + "land.shp", Drivers.Shapefile)); map.Render(dataDir + "land_out.svg", Renderers.Svg); } 只需设置最终的图像分辨率,然后根据输入文件类型选择驱动程序,即可了解它的简单性。该地图已准备好呈现为SVG。这是程序的输出: 同样,可以自定义渲染和功能样式,以获得所需的外观。这是高级示例代码,演示了此新版本中的更多功能。 using (var map = new Map(800, 476)) { var

Folium Choropleth + GeoJSON raises AttributeError: 'NoneType'

左心房为你撑大大i 提交于 2019-11-29 07:35:05
I'm trying to do a choropleth using folium which offers a great link between GeoJSON, Pandas and leaflet. GeoJSON format is like below : { "type":"FeatureCollection", "features":[ { "type":"Feature", "geometry": { "type":"Polygon", "coordinates":[[[-1.6704591323124895,49.62681486270549], ..... { "insee":"50173", "nom":"Équeurdreville-Hainneville", "wikipedia":"fr:Équeurdreville-Hainneville", "surf_m2":12940306}}, Pandas DataFrame : postal_count.head(5) Out[98]: Code_commune_INSEE CP_count 0 75120 723 1 75115 698 2 75112 671 3 75118 627 4 75111 622 "Code_communes_INSEE" corresponds to the

Making a graph inside a leaflet popup using geoJson data

▼魔方 西西 提交于 2019-11-29 07:09:37
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 people have used D3 to create graphs inside leaflet popups, but none of them were also using geoJson

interact with geojson layers independently in google maps api v3

会有一股神秘感。 提交于 2019-11-28 21:16:30
问题 I would like to load two geojson layers to my map and be able to style them independently with different rules. I can display both my geojson files with the below code, but since they are both part of the same map.data object I have only been able to apply universal styling to both. Is there any way around this? Ultimately(longer term goal) I would also like to be able to toggle the different layers on and off with a checkbox as well (I am focusing on independent styling first so as not to

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

吃可爱长大的小学妹 提交于 2019-11-28 20:53:24
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 from a MySql table; My sql table look like this, here is the creation code plus some dummy data; --