Hot answers tagged

7 votes
Accepted

Remove outlying territories/islands from Europe map

I'd bring it into QGIS and use Vector > Geometry > Multipart to Singlepart. In Natural Earth, France is a multipolygon so it is one feature with lots of individual polygons (France, French Guiana, ...
user avatar
  • 19.8k
6 votes
Accepted

Multiple GeoJSON Layers

If I understand what you are asking, you have a basemap of the US, and geojson layers for zip codes and county shapes, and you want to toggle (turn on or off) the geojson layers? Leaflet layer ...
user avatar
  • 6,698
6 votes
Accepted

Is there a standard projection for Sub-Saharan Africa?

Because you are "near" the equator, the cylindrical projections (like Mercator) work well (not too many distortions). If you want to be perfectly fair in terms of areas, you could use cylindrical ...
user avatar
  • 48.5k
6 votes

Remove outlying territories/islands from Europe map

If you want to keep it all command line, you could use ogr2ogr's clipsrc option to clip your shapefile to a bounding box before sending it through the d3-geo tools. I ran: ogr2ogr -f "ESRI ...
user avatar
6 votes
Accepted

Converting EPSG to D3.js

I'll try, but I've never used D3. I do know projections and the state plane system very well. Let's look at a full definition of EPSG::26729. PROJCS["NAD27 / Alabama East", GEOGCS["NAD27", ...
user avatar
  • 18.2k
5 votes
Accepted

D3.js cannot render my geoJSON file

UPDATE: Your problem seems to be with your data. Here is a snippet of your file: }, "geometry": { "type": "Polygon", "coordinates": [ [ [ ...
user avatar
  • 17.2k
5 votes

Determining intersection between GeoJSON feature and given coordinates?

You can try Turf library and its intersect method: http://turfjs.org/docs/#intersect Taken from turf examples: var poly1 = { "type": "Feature", "properties": { "fill": "#0f0" }, "...
user avatar
5 votes

Methods to Convert .SVG File to GeoJSON

I just wrote a library that converts an SVG image to a (slightly-incorrect) GeoJSON. svg2geojson It requires that you hand-edit your SVG to add two XML tags that associate an SVG location with a lat/...
user avatar
  • 325
5 votes
Accepted

GeoJSON maps created with D3 appear flipped/inverted

I was able to work through the problem and understand what was happening, so I thought I would detail it for anyone who runs into this in the future. Folks who know better than me are welcome to amend ...
user avatar
  • 191
5 votes
Accepted

Esri Cedar.js (based on D3.js)

Cedar is (currently) based on Vega which in turn is based on d3. Obviously those layers of abstraction over d3 (Vega and Cedar) should make certain things easier. In short, just about anything you ...
user avatar
5 votes

Removing space between objects of a shapefile

Yes, you can physically move the polygons of the outer territories in geographic data, but this would degrade data unnecessarily. The much better solution hinted at by @ThingumaBob is to simply use ...
user avatar
  • 1,709
4 votes

How to load big geo-data file into web application

It's obvious here that you can't expect to get 200 MB from a server to a client in a reasonable amount of time. Your only options are to drastically simplify it (probably will resulting unusable ...
user avatar
4 votes
Accepted

Drawing line overlays and centering map

As a starting point, you don't need to use geodjango for this! You could simply return unique_line_id, line_start_point_lat, line_start_point_lon, line_end_point_lat, line_end_point_lon as a json ...
user avatar
  • 15.9k
4 votes

Good projections for Middle East and North Africa in D3?

So Albers Equal Area isn't just for use in the US. While it's mostly used here, you can change the center and parallels to reflect anywhere in the world. In this case, the Middle East. You can do ...
user avatar
  • 651
4 votes
Accepted

Converting area of a polygon from steradians to square kilometers using D3.js?

According to this maths is fun page, or the wikipedia steridian article, you will discover that there are 12.56637 steradians in a sphere. So, if you take the area of the earth to be, 510,072,000 sq ...
user avatar
  • 13.2k
4 votes
Accepted

Methods to Convert .SVG File to GeoJSON

There is a command-line tool by Phrogz mentioned below that I have not checked out: https://gis.stackexchange.com/a/245085/35596 To anyone that comes here, the answer is: "it is quite difficult (at ...
user avatar
4 votes
Accepted

D3 javascript and GeoJSON: lines in Stockholm map very strange

Your test.geojson gives you this result, because it is projected as EPSG:3031 as stated in the comments, and you are telling d3 that that is a Mercator projection. If you reproject to EPSG:4326, as ...
user avatar
  • 3,204
4 votes
Accepted

D3: center a map feature using correct latitude and longitude, without rotation?

Rotation is necessary because d3.geo.albers defaults to centering on the middle of the US (center and rotate are used in that block but they match the defaults). I haven't seen a clear explanation ...
user avatar
3 votes
Accepted

D3 missing zoom Choropleth + Raster

You need to update your paths in the zoomed function. The original example does this on line 68. The simplest thing to do is to use the counties variable store a reference to the selection of paths: ...
user avatar
3 votes
Accepted

Troubleshooting with Tiger for d3 -- is this the wrong projection? Why's it look like this?

Reproject from Web Mercator, for example to WGS84 ogr2ogr -f GeoJson 050_00wgs84.gjson 050_00.shp -s_srs EPSG:3857 -t_srs EPSG:4326 topojson --id-property=GEO_ID -o 050_00wgs84.json -- 050_00wgs84....
user avatar
  • 3,204
3 votes
Accepted

Adding Properties to GeoJSON File

I would download and install QGIS, and then open the geojson file by clicking Add vector layer button: After that you should be able to see you geojson file in QGIS: And right click the layer's name ...
user avatar
  • 1,023
3 votes

How do you open shapefiles with ogr2ogr

I ran into this exact problem because I hadn't extracted the zip file into the working directory. I was rushing to get the files converted and when I checked to make sure they were there, the "preview"...
user avatar
3 votes
Accepted

Issue with using TopoJSON server API to return TopoJSON object with properties

The documentation is not that clear, I had the same issue and needed to dig around in the topojson test scripts to work it out. https://github.com/mbostock/topojson/blob/master/test/feature-test.js ...
user avatar
  • 728
3 votes

D3 Map + TopoJSON (mapshaper) showing empty

Finally it's work, is just centering a projection on right value to: var projection = d3.geo.equirectangular() .scale(1050) .rotate([-120, 0]) .translate([width / 2, height / ...
user avatar
  • 69
2 votes

How to load big geo-data file into web application

It really does depend on what you want the use to do with the web application. I asked a similar question here - Create interactive map with no server 1) If you want to just visually show the data ...
user avatar
  • 3,150
2 votes

How to move and open shapefiles with ogr2ogr?

Background Dom's comment solved my issue so I wanted to provide it as an actual answer (in case someone else is following the d3 tutorial). Make sure tools are installed correctly To do this, type ...
user avatar
  • 121
2 votes

Populating D3 Graph with Cartodb

After you have done the request you already have the data so you don't need to use d3.json, just feed the data to a selection and work with that. On d3 you can bind data to a selection (usually data ...
user avatar
2 votes

Adding Properties to GeoJSON File

Another option would be to use geojson.io Just upload your geojson file and add a column, and do your edits. Once you are satisfied with your edits, you can just download the resulting geojson file ...
user avatar
  • 17.2k
2 votes

demers cartogram

This is what a Cartogram does: normal map cartogram You can try ScapeToad to make a cartogram https://scapetoad.choros.ch/ What you are trying to do is create a grid pattern with areal cartograms -...
user avatar
  • 128
2 votes
Accepted

d3 + Leaflet apply class value from geojson data

"handle" is in the properties of the feature, so it just needs to be d.properties.handle Try: feature.attr("class", function (d) { return "code " + d.properties.handle; });
user avatar
  • 6,698

Only top scored, non community-wiki answers of a minimum length are eligible