2016-12-15 1 views
0

Ich bin zusammen mit Mike Bostocks neuesten Tutorial auf topojson at the command line folgen. Alles scheint angemessen zu funktionieren, und wenn ich Shapes zusammenfüge, funktionieren die Dinge, aber da es kleine Fehler zwischen Kanten in Original Shape-Dateien gibt, bekomme ich keine richtige Verschmelzung. Konkret versuche ich Länder zu verschmelzen, um Kontinente zu schaffen. Ich verstehe und ich bin mir sicher, dass ich wahrscheinlich eine bestimmte Kontinent-Shape-Datei finden kann, aber ich probiere einen Prozess aus, um die Erstellung von maßgeschneiderten Regionen zu ermöglichen, die erstellt werden können.Fehler in topomerge entweder programmgesteuert oder manuell bearbeiten

Der Fehler kann ich sehe unten zeigen werden:

enter image description here

Angola ist nicht mit den umliegenden Ländern zusammengeführt werden, und ich bin nicht sicher, warum.

Hat jemand Erfahrung darin, Funktionen wie diese zu manipulieren, um eine korrekte Zusammenführung zu erhalten?

Hier Bash-Skript, das ich für dieses Beispiel erstellt (rohe Formdaten können here heruntergeladen werden):

shp2json ne_110m_admin_0_countries/ne_110m_admin_0_countries.shp -o world-countries.geojson 

geostitch world-countries.geojson | geoproject 'd3.geoKavrayskiy7()' > world-countries-projected.geojson 

ndjson-split 'd.features' < world-countries-projected.geojson > world-countries.ndjson 

ndjson-map 'd.title = d.properties.adm0_a3, d.id = d.properties.adm0_a3, d.continent = d.properties.continent, d' < world-countries.ndjson > world-countries-id.ndjson 

geo2svg -n -w 960 -h 960 < world-countries-id.ndjson > world-countries2.svg 

geo2topo -n countries=world-countries-id.ndjson > world-countries.topojson 

toposimplify -p 2 -f < world-countries.topojson > world-countries-simple.topojson 

topoquantize 1e5 < world-countries-simple.topojson > world-countries-quantized.topojson 

topomerge -k 'd.continent' continents=countries < world-countries-quantized.topojson > world-continents.topojson 

# topomerge --mesh -f 'a !== b' continent=continent < world-continents-merge.topojson > world-continents.topojson 

topo2geo continents=world-continents.geojson < world-continents.topojson 

geo2svg -w 960 -h 960 < world-continents.geojson > world-continents.svg 

Antwort

1

durch Versuch und Irrtum, fand ich die Countries without boundary lakes schuf bessere Grenzen verschmelzen, wie unten zu sehen:

enter image description here

Mein vollständiger Skript ist hier:

shp2json ne_50m_admin_0_countries_lakes/ne_50m_admin_0_countries_lakes.shp -o world-countries.geojson 

geostitch world-countries.geojson | geoproject 'd3.geoKavrayskiy7()' > world-countries-projected.geojson 

ndjson-split 'd.features' < world-countries-projected.geojson > world-countries.ndjson 

ndjson-map 'd.title = d.properties.adm0_a3, d.id = d.properties.adm0_a3, d.continent = d.properties.continent, d' < world-countries.ndjson > world-countries-id.ndjson 

geo2svg -n -w 960 -h 960 < world-countries-id.ndjson > world-countries2.svg 

geo2topo -n countries=world-countries-id.ndjson > world-countries.topojson 

toposimplify -p 2 -f < world-countries.topojson > world-countries-simple.topojson 

topoquantize 1e5 < world-countries-simple.topojson > world-countries-quantized.topojson 

topomerge -k 'd.continent' continents=countries < world-countries-quantized.topojson > world-continents.topojson 

topo2geo continents=world-continents.geojson < world-continents.topojson 

ndjson-split 'd.features' < world-continents.geojson > world-continents.ndjson 

ndjson-map 'd.title = d.id, d' < world-continents.ndjson > world-continents-title.ndjson 

geo2svg -n -w 960 -h 960 < world-continents-title.ndjson > world-continents.svg 
Verwandte Themen