387 questions
147
votes
11
answers
74k
views
Center a map in d3 given a geoJSON object
Currently in d3 if you have a geoJSON object that you are going to draw you have to scale it and translate it in order to get it to the size that one wants and translate it in order to center it. This ...
13
votes
2
answers
6k
views
Scaling d3 v4 map to fit SVG (or at all)
I am trying to make this map of the us scale smaller. Either to my SVG, or even manually.
This is my code in its simplest from:
function initializeMapDifferent(){
var svg = d3.select("#map")....
5
votes
1
answer
861
views
Pre-projected geometry v getting the browser to do it (aka efficiency v flexibility)
To improve the performance of my online maps, especially on smartphones, I'm following Mike Bostock's advice to prepare the geodata as much as possible before uploading it to the server (as per his ...
10
votes
2
answers
19k
views
Python Script to Convert CSV to GeoJSON
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",
"...
0
votes
0
answers
1k
views
Attempting to a configurable attribute of a configurable property Issue-in turfJS?
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 ...
27
votes
5
answers
128k
views
How can I parse GeoJSON with Python
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/...
12
votes
2
answers
6k
views
How can I make a map using GeoJSON data in Altair?
I'm very new to mapping, and to Altair/Vega. There's an example in the Altair documentation for how to make a map starting with an outline of US states, which is created basically with:
states = alt....
4
votes
1
answer
2k
views
Curved geojson polygon edges on map projections
I am trying to draw rectangles on different map projections using d3.js and geojson. The mapped coordinates seem right, however the edges appear curved in a strange way. I understand that this may ...
2
votes
1
answer
8k
views
update properties of geojson to use it with leaflet
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....
1
vote
3
answers
3k
views
Mapbox Driving Direction with Custom Marker
I have the following code to use mapbox as my driving direction, but unfortunately it doesn't allow me to change the markers, and it keeps using its default marker even though I try to change it with ...
11
votes
5
answers
17k
views
Jackson deserialize GeoJson Point in Spring Boot
I have a @Entity model that has a property of type com.vividsolutions.jts.geom.Point. When I try to render this model in a @RestController I get a recursion exception.
(StackOverflowError); nested ...
7
votes
3
answers
13k
views
GeoJSON data not displaying in Python folium map
I am trying to display the following geojson file in a folium map in Python but it just shows an empty map with none of the data.
Here are the steps I have tried:
I tried using the python code below ...
6
votes
1
answer
9k
views
Making a graph inside a leaflet popup using geoJson data
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 ...
5
votes
1
answer
4k
views
How to divide a map into zipcodes using d3, javascript, and a json file?
I'm trying to create a nyc map with zipcode areas I can color in based on census data (like color an area red if majority white or blue if majority nonwhite). I am simply using one of the shape files ...
3
votes
2
answers
6k
views
Shapefile to Topojson conversion
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 ...
2
votes
2
answers
14k
views
D3 filtering data points
I'm implementing the classic mercator example (https://github.com/mbostock/d3/blob/master/examples/mercator/mercator.html), which I've changed to zoom into Afghanistan and to use only one custom ...
2
votes
1
answer
2k
views
D3.geo : responsive frame given a geojson object?
I use Mike Bostock's code to Center a map in d3 given a geoJSON object.
The important part of the code is this:
var width = 960,
height = 500;
var svg = d3.select("body").append("svg")
....
1
vote
2
answers
4k
views
Restrict the viewable part of a tile to a polygon area in Leaflet?
In Leaflet, how does one restrict the viewable part of a tile to the area contained within a polygon (or geojson), i.e., the intersection between a polygon and the tile beneath.
Example use: display ...
0
votes
0
answers
250
views
ng-repeat causing "Error: 10 $digest() iterations reached. Aborting! when passing scope to leaflet directive
Edited: After some advices i came back to old version of how i wanted handle angular and leaflet, link to fiddler but still is not working,
Explanation: It was working with angular-leaflet-directive, ...
109
votes
3
answers
49k
views
Difference between GeoJSON and TopoJSON
What is the difference between GeoJSON and TopoJSON and when would I use one over the other?
The description of TopoJSON on GitHub implies the TopoJSON files are 80% smaller. So why not just use ...
35
votes
3
answers
30k
views
Is it possible to determine if a GeoJSON point is inside a GeoJSON polygon using JavasScript?
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 ...
30
votes
4
answers
39k
views
Loading JSON into a GeoDataFrame
I'm having difficulty loading the following JSON containing GIS data (https://data.cityofnewyork.us/resource/5rqd-h5ci.json) into a GeoDataFrame.
The following code fails when I try to set the ...
28
votes
4
answers
63k
views
How to define JSON Schema for Map<String, Integer>?
I have a json :
{
"itemTypes": {
"food": 22,
"electrical": 2
},
"itemCounts": {
"NA": 211
}
}
Here the ...
24
votes
3
answers
16k
views
Leaflet: Update GeoJson filter?
I would like to populate a GeoJson layer with data and then dynamically filter what features to show.
I have gotten the filter function to work but I do not know how to change the filter and then ...
22
votes
1
answer
7k
views
interact with geojson layers independently in google maps api v3
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 ...