Hot answers tagged

13

There are benefits and drawbacks to each way of doing it. To make a long story short, I would recommend creating "bins." A couple of notes to help you choose, and about designing choropleths in general: A direct mapping of data value to color (an 'unclassed' map) could be considered the most accurate way to display the data, however classified maps (maps ...


11

Ask yourself two questions: Are you going to reuse the geography on multiple datasets? If you’ll use the same geography with multiple datasets, then it makes sense to keep the geography and data separate, and join them in the client. Many of my examples have separate CSV (or TSV) files for this reason. This way, the TopoJSON for U.S. states and counties or ...


8

EPSG:3047 is UTM Zone 35, which has its central meridian at 27°E. To get this projection using d3, you need to use d3.geo.transverseMercator().rotate([-27,0,0]) (or d3.geo.transverseMercator().rotate([-27,-65,0]) if you also want to use the projection to center on your area of interest). Here's the overlay of the QGIS and d3 output:


7

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, Reunion etc). Doing this breaks each of these polygons into its own feature - so your shapefile jumps in size from ~250 (roughly one feature per 'country') to ...


6

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 equal area or sinusoidal projection. But this would not markedly differ from Mercator.


6

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 control is designed for this Documentation http://leafletjs.com/reference.html#control-layers Example http://leafletjs.com/examples/layers-control/ Leaflet L....


6

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 Shapefile" -clipsrc -25 34 35 73 europe-clipped.shp ne_50m_admin_0_countries.shp The values for -clipsrc were sussed out using projectionwizard.org. Then used your ...


5

You address one of many aspects of symbolization: how to portray quantitative values via variable color representation -- using a discrete or continuous scale of color saturation or intensity. Good question. The answer is, as often, it depends... Traditional thematic cartography recognizes that maps, as simplified models of reality, are products of a great ...


5

UPDATE: Your problem seems to be with your data. Here is a snippet of your file: }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 585951.8, 181704.9 ], [ 576293.9, 181299.8 ], If I'm not mistaken, those ...


5

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/long, and it provides a command-line tool to convert the file. It will even, if you like, take all the top-level groups (which is what Illustrator exports its ...


5

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", DATUM["North_American_Datum_1927", SPHEROID["Clarke 1866",6378206.4,294.9786982138982, AUTHORITY["EPSG","7008"]], ...


5

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 this answer by commenting. First, it looks like I didn't actually do anything wrong (although I won't claim to have done things optimally). It appears that ...


5

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 can do in Vega, you can do in Cedar, however it is optimized for using the Cedar's "out of the box" chart types with feature service stats queries. So if you want ...


5

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 multiple map frames when designing your export. Create a map frame for each outlying territory, then move those around on your sheet layout for printing/viewing ...


4

The default projection in D3 is the U.S.-centric d3.geo.albersUsa projection. This is a composite projection design to display the 48 contiguous United States, Hawaii, Alaska and Puerto Rico. If you want to make a map of Canada, you’ll have to specify the appropriate projection rather than relying on the default.


4

Hatching is usually one of my last resorts. Other than that, I once worked on a project where we had the following problem to solve in under an hour: We needed to display overlapping polygons with several bit (Y/N) attributes. We wanted to avoid obscuring other coincident data in the map, i.e. Points, labels We needed the end user of the printed exhibit ...


4

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 information) or tiling it (either vector or raster tiling should work). What you do depends on what you know and what you want to achieve. Here's what I suggest, ...


4

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 object and display these using Leaflet. You will need to structure the data to match the format required - here's an answer that explains how to load a polyline. ...


4

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 km, then, given your area of 8.101249039703731e-8, and plugging in these numbers, you get: 8.101249039703731e-8 / 12.56637 * 510,072,000 = 3.288 km². or in ...


4

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 that in d3 by changing the center when you're defining the projection. It would look something like this: var projection = d3.geoAlbers() .rotate([*Rotation ...


4

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 least for an experienced programmer but inexperienced cartographer)." It requires a more-than-superficial understanding of how the Spacial Reference Systems (...


4

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 also suggested, a squished map is exactly what you expect. Your location is rather up north. Remember that Mercator projects well only around the equator and the ...


4

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 of this in the d3 docs but here's what I've pieced together using d3.geo for various things: use rotate to spin the globe to your area of interest. Most of the ...


3

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 in the left hand layer list, and click "Properties"; then go to the "Joins" tab, and click the green plus icon on the left bottom corner to open "Add vector ...


3

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 You do it by passing a function as an option, like this: var geojson = {"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"Point","...


3

The topojson command has no parameter -t_srs, it is ogr2ogr what you want to use: ogr2ogr -f GeoJSON trainsGeoJSON.json TRAINS_RTE_TRAIN.shp -s_srs EPSG:26986 -t_srs EPSG:4326 Then convert to topojson format (as described here): topojson -o trainsTopojson.json trainsGeoJSON.json


3

Good question. One of the examples you provided seems to do the trick, though it is hard to follow. You'll note that the example has two external data files, us.json and unemployment.tsv. You can think of unemployment.tsv as like your danger.csv; us.json are the geographic features with which you want to associate parameters from danger.csv. The latter, ...


3

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" }, "geometry": { "type": "Polygon", "coordinates": [[ [-122.801742, 45.48565], [-122.801742, 45.60491], [-122.584762, 45.60491], [-122....


3

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" that I got when I double-clicked on the zipped file tricked me into thinking they were available for conversion. Even if this wasn't the solution to your ...


3

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.gjson Then: var width = 800, height = 800; var svg = d3.select("body").append("svg") .attr("width", width) .attr("height", height); d3.json("050_00wgs84....


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