geojson

GeoJson World Database

99封情书 提交于 2019-12-02 13:51:57
I am working on a project where it is necessary to display maps of countries and cities using d3.js. Actually, D3 supports GeoJson format. Usually, I guess, GeoJson format is converted from some other format. I found some places with this GeoJson data: http://mbostock.github.com/protovis/ex/countries.js But, this is only a list of countries, I am looking for some service or program that gives me the ability to set an ID, get this format, and convert it to GeoJson, or get it in GeoJson better. Thanks!! Does this need to be a service? Here's how I've approached this in the past, using free/Open

how to get lat long from google map when our own geojson layer is there?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-02 13:17:26
google.maps.event.addListener(map, 'click', function( event ){ alert( "Latitude: "+event.latLng.lat()+" "+", longitude:"+event.latLng.lng() ); }); this code gives us lat long when we click on google map. but it does not work when there is our own geojson layer that is if we have our own geojson layer of polygon over google map then clicking inside that polygon the above code would not work Either add your click event listener to the Data layer or set the Data layer to not accept mouse events ( clickable:false ). Set event listener on Data layer: google.maps.event.addListener(map, 'click',

Process huge GEOJson file with jq

家住魔仙堡 提交于 2019-12-02 11:28:29
Given a GEOJson file as follows:- { "type": "FeatureCollection", "features": [ { "type": "Feature", "properties": { "FEATCODE": 15014 }, "geometry": { "type": "Polygon", "coordinates": [ ..... I want to end up with the following:- { "type": "FeatureCollection", "features": [ { "tippecanoe : {"minzoom" : 13}, "type": "Feature", "properties": { "FEATCODE": 15014 }, "geometry": { "type": "Polygon", "coordinates": [ ..... ie. I have added the tippecanoe object to each feature in the array features I can make this work with:- jq '.features[].tippecanoe.minzoom = 13' <GEOJSON FILE> > <OUTPUT FILE>

Plotting custom json maps with D3.js

人走茶凉 提交于 2019-12-02 08:12:27
问题 I am creating a map with D3.js. I began by downloading the country (Canada) shapefile here: https://www.arcgis.com/home/item.html?id=dcbcdf86939548af81efbd2d732336db ..and converted it into a geojson here (link to file below): http://mapshaper.org/ So far all I see is a coloured block, without any errors on the console. My question is, how can I tell if my json file or my code is incorrect? Here is my code and on bottom is a link to json file. <!DOCTYPE html> <html> <head> <meta charset="utf

Google map waypoints from geoJSON

感情迁移 提交于 2019-12-02 07:31:33
I want to load an itinerary from a geoJSON file. For the moment, it works, but only with two points. But I need to add 4 or 5 waypoints. My code only read the two first points and set them as Origin and destination. Here's my code google.maps.event.addListener(map.data, 'addfeature', function (e) { if (e.feature.getGeometry().getType() === 'Point') { map.setCenter(e.feature.getGeometry().get()); if (!origin) origin = e.feature.getGeometry().get(); //if origin does not exist else if (!destination) { destination = e.feature.getGeometry().get(); calculate(); } } }); Any idea ? Do I have to create

Get center of geojson Continent/Country/State with leaflet

故事扮演 提交于 2019-12-02 07:27:26
问题 Is there a way of finding a center for countries/continents which consist of more than one polygon object(ex. USA, Canada, which have an islands besides main land part)? I was trying to use leaflet's Layer.getCenter() or even Layer.getBounds().getCenter() , but those methods certainly don't work for this type of countries and return a "no-go" results. Example can be seen by the following link (leaflet playground). Just scroll and click on US or Canada and see where circleMarker will appear.

Leaflet: Error in geoJson overlay at Russia Finland border

橙三吉。 提交于 2019-12-02 05:59:20
问题 I'm using the 1:50m Cultural Vectors shape file from naturalearthdata.com. I use ogr2ogr to create a geoJson file with the following command: ogr2ogr -f GeoJSON geo_world_50m.json ne_50m_admin_0_countries.shp I then create a topoJson file with this command: topojson --id-property iso_n3 -p name=admin -p name -p iso_a3=iso_a3 -p iso_a3 -o topo_world_50m.json geo_world_50m.json Once I have my topoJson file, I load it in to Leaflet: $.getJSON('topo_world_50m.json', function (data) { var country

Choropleth map is not showing color variation in the output

让人想犯罪 __ 提交于 2019-12-02 03:14:55
I am not getting any color variation in my output map even after the choropleth is linked with the geo_data and the data frame is linked with data parameter in the choropleth method. I have provided the "key_on" parameter rightly and the "columns" parameter rightly. I have removed all the NULL values from the Dataframe. import pandas as pd from pandas import read_csv import folium import os import webbrowser crimes = read_csv('Dataframe.csv',error_bad_lines=False) vis = os.path.join('Community_Areas.geojson') m = folium.Map(location = [41.878113, -87.629799], zoom_start = 10, tiles =

Leaflet: Error in geoJson overlay at Russia Finland border

允我心安 提交于 2019-12-02 02:23:49
I'm using the 1:50m Cultural Vectors shape file from naturalearthdata.com . I use ogr2ogr to create a geoJson file with the following command: ogr2ogr -f GeoJSON geo_world_50m.json ne_50m_admin_0_countries.shp I then create a topoJson file with this command: topojson --id-property iso_n3 -p name=admin -p name -p iso_a3=iso_a3 -p iso_a3 -o topo_world_50m.json geo_world_50m.json Once I have my topoJson file, I load it in to Leaflet: $.getJSON('topo_world_50m.json', function (data) { var country_geojson = topojson.feature(data, data.objects.geo_world_50m); country_layer.addData(country_geojson);

How can I parse GeoJSON with Python

走远了吗. 提交于 2019-12-01 20:48:28
I have have geojson data from a query which I now want to parse and print on screen. My current code is: import urllib import geojson while True: url = 'https://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&starttime=2012-01-01&endtime=2017-03-01&minmagnitude=4.0&maxmagnitude=9.0&minlongitude=5.95&maxlongitude=10.50&minlatitude=45.81&maxlatitude=47.81' uh = urllib.urlopen(url) data = uh.read() print data break It seems that data is a simple string. However, I thought it could be parsed like a json parameter. How do I have to handle geojson data in order to print a single point , e.g.