topojson

“stroke-dasharray:x,y;” mess up svg path? (Chrome)

佐手、 提交于 2019-12-11 07:14:15
问题 Works I generate svg paths via d3js. Either data() + mesh() or datum() + mesh() work. svg.append("g").attr("id","border") .attr("style", "fill: none; stroke:#646464;") .selectAll("path") .data([topojson.mesh(json, L0, function(a, b) { return a !== b; })]) .enter().append("path") .attr("d", path); or : //inland borders lines svg.append("g").attr("id","coast") .attr("style", "fill: none; stroke:#646464;") .append("path") .datum(topojson.mesh(json, json.objects.admin_0, function(a,b){return a==

Random lines when loading a TopoJSON file in D3

喜你入骨 提交于 2019-12-11 04:38:22
问题 I'm trying to display the Italian cartographic shapefiles, for example this one, using D3.js I can load the Zip file on MapShaper, look at the map, simplify it and export to TopoJSON. I can load back the TopoJSON in MapShaper and it still looks ok. But when I try to display it using D3.js, I get a bunch of spaghetti: Beauty, isn't it? The code is taken straight from the examples. The projection center, rotation, and parallels are supposed to be the canonical ones for Italy, but it doesn't

d3js v5 + Topojson v3 Optimization about joining csv & json

試著忘記壹切 提交于 2019-12-10 21:55:47
问题 In order to make maps, I need to import some values from csv to json directly in the code . For loading json and csv files, I use an asynchronous operation with Promise object and I use two loops and a common key to add new properties on json file. for (var i=0; i< fr[1].length;i++){ var csvId = fr[1][i].codgeo; var csvValue1 = parseFloat(fr[1][i].value1); var csvValue0 = parseFloat(fr[1][i].value0); for (var j=0; j<topojson.feature(fr[0],fr[0].objects.dep_GEN_WGS84_UTF8).features.length;j++)

Display GeoJSON with leaflet that spans the 180th meridian

对着背影说爱祢 提交于 2019-12-09 05:22:01
问题 I am trying to display a geoJSON object (outline of Russia, in this case) that spans the 180th meridian. Currently this displays with part of the country on the left side of the map and part on the right: Looking at leaflet, it seems there is a fix for this but that doesn't seem to work: https://github.com/Leaflet/Leaflet/issues/82. I have also tried adding a coordsToLatLng function but can't seem to get that to work either. Tile layers have a continuousWorld option which I do not think works

d3 world map — calculate geo bounds on zoom

本小妞迷上赌 提交于 2019-12-08 15:31:31
I am trying to adapt Mike Bostock's constrained zoom example to fit my needs. ( http://bl.ocks.org/mbostock/4987520 ). Is there any way to calculate the geo bounds (in long/lat) of the projection when the map is zoomed. The d3.geo.bounds() method expects a 'feature' -- I really don't want to zoom on any particular feature. All I want is the geo bounds for the visible area of the projection. Thanks in advance, Kishore My other answer was a misreading of the question, but I'll leave it there in case someone else misreads the question in the same way. To find the bounding box of the visual area

convert shp to topoJSON failing

試著忘記壹切 提交于 2019-12-08 14:26:22
问题 GIS to Topojson: I'm using DIVA-gis.org for my data source. I've downloaded the data for Armenias administrative areas. This dowload produces a .shp file. I've tried to pass it directly to topoJSON and I get a json file as follows Object { type: "Topology", objects: Object, arcs: Array[1], transform: Object } Topojson to SVG: I'm pointing d3 to objects.armenia which contains my geometries property. The problem is that that geometries property contains an array of arcs which is 0. Now within

Bounding csv data to topojson path - cloropleth

喜夏-厌秋 提交于 2019-12-08 07:16:35
问题 I am trying to bound some data to a topojson map. So far I've been able to draw the map of the US, with each path labeled by id: state name. What I'd like to do now is to bind data I have on an external csv to the map, to show each state of a hue based on the value in the csv (aka cloropleth). I've been looking for guides but I don't have the knowledge yet to understand the one on Mike Bostock's site, so I tried to bind the color with a function like so: .attr("fill", "rgb(0, 0, " + Math

topoJSON on D3: map doesn't show (but it works on www.mapshaper.org)

我是研究僧i 提交于 2019-12-08 05:38:06
问题 I'm trying to replicate http://bl.ocks.org/mbostock/4060606 using a UK Counties map. I followed the following steps - pretty much what is suggested on http://bost.ocks.org/mike/map: 1) I downloaded the shapefile from Ordnance Survey and extracted some data using qGIS 2) when ready, I translated the shapefile into GeoJSON using ogr2ogr 3) I converted the GeoJSON into topoJSON making sure the IDs were preserved I pretty much copied the original example for the choropleth from mbostock. However,

Adding external properties to TopoJSON file

僤鯓⒐⒋嵵緔 提交于 2019-12-08 03:02:33
问题 I have TopoJSON file and want to add some external fields in it by id (and preserve old) without any other changes (like simplification or quantization) . So I used command like in the example in TopoJSON wiki. The command was like: topojson -o world-110m_ext.json -e world-country-names.tsv --id-property +id -p nameENG=name world-110m.json . But I got file smaller than the source and without any id properties. I tried to preserve id's like so: topojson -o world-110m_ext.json -p -e world

Properly scale a vector to fit a raster layer

折月煮酒 提交于 2019-12-08 02:12:12
问题 So I've created a clipped and reprojected raster image from a Natural Earth 2 data set. It is simple enough to set that as a base layer and project a vector layer on top of it. The problem I'm having is properly scaling the images so they align perfectly. Please refer to this block for the example: http://bl.ocks.org/mkessy/8545864 Here is what I've done so far: Use gdalwarp to reproject the raster to Albers Equal Area and clip to the bounding box of North Dakota, output the image to my