topojson

Shapefile to Topojson conversion

核能气质少年 提交于 2019-12-18 07:02:08
问题 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. 回答1: Download the GIS source GADM is the perfect

Shapefile to Topojson conversion

ぃ、小莉子 提交于 2019-12-18 07:01:21
问题 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. 回答1: Download the GIS source GADM is the perfect

D3.geo : Spherical arcs rather than straight lines for parallels?

倾然丶 夕夏残阳落幕 提交于 2019-12-18 04:19:11
问题 I just made a D3js globe localisator, which looks like this : If you look carefully, the red square looks ugly since it doesn't follow the Earth's curve. I have the area bounding box in decimal degrees : var bb = {W:-5.0, N:50.0, E:10.0, S:40.0 } And I draw the lines as follow: svg.append("path") .datum({type: "LineString", coordinates: [[-5, 40], [-5, 50], [10, 50], [10, 40], [-5, 40]] }) .attr("d", path); For larger areas, it's even the opposite curve from expectations (for a bounding box):

How to divide a map into zipcodes using d3, javascript, and a json file?

谁说胖子不能爱 提交于 2019-12-17 19:25:18
问题 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 I found online from here ( https://data.cityofnewyork.us/Business/Zip-Code-Boundaries/i8iw-xf4u/data ). I converted the shp file to a geojson and then a topojson file. I'd appreciate it if someone could look at my code below, and let me know how I can go about doing this. Code: <!DOCTYPE html>

D3js: Automatic labels placement to avoid overlaps? (force repulsion)

你说的曾经没有我的故事 提交于 2019-12-17 05:37:30
问题 How to apply force repulsion on map's labels so they find their right places automatically ? Bostock' "Let's Make a Map" Mike Bostock's Let's Make a Map (screenshot below). By default, labels are put at the point's coordinates and polygons/multipolygons's path.centroid(d) + a simple left or right align, so they frequently enter in conflict. Handmade label placements One improvement I met requires to add an human made IF fixes, and to add as many as needed, such : .attr("dy", function(d){ if(d

D3.js Map with Albers Projection: How to rotate it?

雨燕双飞 提交于 2019-12-17 05:14:39
问题 I'm building a map of the Philippines with d3.js and for a strange reason the map looks like rotated on the left, so that the country doesn't look how it really is. I've tried to modify the projection.rotate field but doesn't seems like is the correction line. var width = 1060, height = 860; var svg = d3.select("body").append("svg") .attr("width", width) .attr("height", height) .style("overflow", "auto"); d3.json("ph.json", function(error, ph) { if (error) return console.error(error); var

Imprecision between overlapping maps

蓝咒 提交于 2019-12-14 04:18:34
问题 I created this map ( PLUNKER ). It rapresents Europe by nuts0 (country) and if you right-click on a country, this county is zoomed and its regions (nuts2) are showed. A piece of code: var projectionCurrent = d3.geoMercator() .scale(1) .translate([width / 2, height / 2]); var projectionBase = d3.geoMercator() .scale(1) .translate([width / 2, height / 2]); var path = d3.geoPath().projection(projectionCurrent); var map = d3.select('#container-map'); var mapSvg = map.append('svg') .attr('id',

How can I nest GeoJSON / TopoJSON geometries OR nest the generated paths with D3?

不羁岁月 提交于 2019-12-13 07:58:26
问题 Problem: I'm attempting to create an interactive map of the US in which state, county and national boundaries are displayed. Counties are shaded based on data, and hovering over a state should highlight all counties in the state, and the state should be clickable. I want to achieve this by having a SVG with the county shapes inside of state shapes, inside of a US shape. I can generate a county map based on a CENSUS county shape file, and I can shade the states based on data in an external CSV

How to convert from D3 svg to topojson/geojson?

故事扮演 提交于 2019-12-12 14:53:29
问题 D3 allows to convert geojson/topojson arrays of points' coordinates [ [x,y],[x,y],[x,y],...] // aka, a geojson arc. And, via a projection, into svg paths <path d="M x,y x,y x,y ..."></path> // aka, an svg-xml path Note: the values actually change. Points [x,y] in topojson, get new valued via projection([x,y]) for svg's path. So, if we store in the svg: the projection name the points absolute coordonates relative to the svg origine 0,0 (already stored in the path). Use projection.invert() We

How to troubleshoot topojson error: distance is not defined

百般思念 提交于 2019-12-12 03:56:42
问题 I'm attempting to create a TopoJSON file of school districts in the United States. I have a set of three shapefiles that I am attempting to combine into a single topojson file, using the following batch script: call topojson ^ -o SDs11_Topo.json ^ -p NAME ^ --simplify-proportion .1 ^ --id-property GEOID ^ -- ^ ESDs11.shp ^ SSDs11.shp ^ USDs11.shp After some time running (as in, not immediately) - I am presented with the following output, and error message: coordinate system: spherical