Questions tagged [topojson]

TopoJSON is an extension of GeoJSON that encodes topology. TopoJSON eliminates redundancy, offering much more compact representations of geometry than with GeoJSON; typical TopoJSON files are 80% smaller than their GeoJSON equivalents. In addition, TopoJSON facilitates applications that use topology, such as topology-preserving shape simplification, automatic map coloring, and cartograms.

TopoJSON is an extension of GeoJSON that encodes topology.

Rather than representing geometries discretely, geometries in TopoJSON files are stitched together from shared line segments called arcs. TopoJSON eliminates redundancy, offering much more compact representations of geometry than with GeoJSON; typical TopoJSON files are 80% smaller than their GeoJSON equivalents. In addition, TopoJSON facilitates applications that use topology, such as topology-preserving shape simplification, automatic map coloring, and cartograms.

Topojson toolkits has seen major changes at v.2, as of April 2017 :

  • Topojson Specification
  • Topojson v1 - CLI
  • Topojson v2,v3 -- An extension of GeoJSON that encodes topology! Calls :
    • topojson-client (3.0.0) : Manipulate TopoJSON, such as to merge shapes, and convert it back to GeoJSON
    • topojson-server (3.0.0) : Convert GeoJSON to TopoJSON.
    • topojson-simplify (3.0.0) : Filter and simplify geometries while preserving topology for smaller files and faster rendering!
611 questions
146
votes
11 answers

Center a map in d3 given a geoJSON object

Currently in d3 if you have a geoJSON object that you are going to draw you have to scale it and translate it in order to get it to the size that one wants and translate it in order to center it. This is a very tedious task of trial and error, and I…
climboid
  • 6,932
  • 14
  • 44
  • 71
104
votes
3 answers

Difference between GeoJSON and TopoJSON

What is the difference between GeoJSON and TopoJSON and when would I use one over the other? The description of TopoJSON on GitHub implies the TopoJSON files are 80% smaller. So why not just use TopoJSON all the time?
Luke
  • 1,471
  • 3
  • 12
  • 11
58
votes
5 answers

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

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…
Hugolpz
  • 17,296
  • 26
  • 100
  • 187
30
votes
3 answers

Is it possible to determine if a GeoJSON point is inside a GeoJSON polygon using JavasScript?

Is it possible to determine whether a GeoJSON point at a given lat,lon lies within a given GeoJSON polygon using only JavaScript (either through d3, topojson, or any other way)? For example, I can draw a map showing countries in the UK based on the…
user5325596
  • 2,310
  • 4
  • 25
  • 42
27
votes
2 answers

Topojson: quantization VS simplification

What is the difference between quantization and simplification? Is quantization another way of doing simplification? Is it better to use quantization in certain situations? Or should i be using a combination of both?
dance
  • 337
  • 4
  • 8
26
votes
3 answers

Smoothing arcs/plot points in D3.js/GeoJSON/TopoJSON/Shapefile (somewhere along the way)

I've been looking around a while for an answer to this, and I haven't been able to figure it out. I'm ultimately creating a TopoJSON file from grid based data (GRIB files). I can pretty easily interpolate the data down to a finer resolution grid so…
stewart715
  • 5,557
  • 11
  • 47
  • 80
20
votes
2 answers

How to add properties to topojson file?

Given a data.tsv file such : id code name 1 AL Alabama 2 AK Alaska 4 AZ Arizona 5 AR Arkansas 6 CA California ... ... ... Given a topojson.json file such : (the structure is correct, the numeral values are random) {…
Hugolpz
  • 17,296
  • 26
  • 100
  • 187
19
votes
1 answer

Is it possible to read geoJSON or topoJSON file in R to draw a choropleth map?

topoJSON and geoJSON files are know very common for drawing maps on the internet. Is it possible to import them in R to draw choropleth maps?
PAC
  • 5,178
  • 8
  • 38
  • 62
15
votes
4 answers

How to run TopoJSON?

I need to convert a geojson file to topojson and possibly simplify the topojson file. I've managed to install Node.js and the topojson package. But I have no idea how to run topojson. The wiki lists a bunch of command line options, but where do I…
user1781186
13
votes
3 answers

Error installing contextify- node-gyp rebuild failed

Edit I upgraded node and ran "npm install -g contextify" It looks like it installed fine (no errors), but typing in "which contextify" returns nothing. Message while installing contextify: npm http GET https://registry.npmjs.org/contextify npm http…
ukejoe
  • 737
  • 2
  • 9
  • 20
12
votes
2 answers

How can I make a map using GeoJSON data in Altair?

I'm very new to mapping, and to Altair/Vega. There's an example in the Altair documentation for how to make a map starting with an outline of US states, which is created basically with: states = alt.topo_feature(data.us_10m.url,…
Jonathan
  • 10,571
  • 13
  • 67
  • 103
12
votes
2 answers

Scaling d3 v4 map to fit SVG (or at all)

I am trying to make this map of the us scale smaller. Either to my SVG, or even manually. This is my code in its simplest from: function initializeMapDifferent(){ var svg = d3.select("#map").append("svg") .attr("width", 1000) …
Jason Blevins
  • 125
  • 1
  • 6
12
votes
2 answers

Display GeoJSON with leaflet that spans the 180th meridian

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…
Rob
  • 7,377
  • 7
  • 36
  • 38
12
votes
1 answer

Problems converting from shape to topojson

I'm trying to convert a shapefile of mexican municipalities into a topojson and displaying it using d3.js using this tutorial http://bost.ocks.org/mike/map/#converting-data. I've managed to convert it but I can't manage to display it. Any help will…
eclark
  • 819
  • 7
  • 16
11
votes
3 answers

Making a SVG path like a smooth line instead of being ragged

Well in my project I create river lines from pathes. And due to my kind of big stroke-width it is very ragged: I already searched around. But the only thing I found was stroke-linejoin: round;. As you can see here: it is way better but I'm still…
kwoxer
  • 3,734
  • 4
  • 40
  • 70
1
2 3
40 41