6

I currently have a coordinate based map of the US and it's states for topojson (https://github.com/mbostock/topojson).

The coordinates are a JSON array (as topojson works), data looks like this:

[-123.233256,42.006186], [-122.378853,42.011663]...

Now what I'd like to do is combine states into regions, outside of doing this by hand (and that idea makes me feel sick), are there any tools which I can use to accomplish this?

I have QGIS but have no clue where to even start (let alone how to combine states in QGIS).

  • 1
    So it sounds like you are trying to "merge features", but with a source topojson file, correct? – RyanDalton Sep 12 '13 at 19:42
  • Correct! I can do this in inkscape with the SVG, but obviously that is post-projection. :( I'm assuming I may have to get the original maps for QGIS and do it there? I can't seem to go from topojson > QGIS. – StrangeWill Sep 12 '13 at 20:12
9

You can use topojson.merge to do this, as shown in bl.ocks.org/5416405:

merging states

There are a few limitations to this approach (such as its dependence on an exact topology and lack of detection of holes), but it might for you as-is or with a few adjustments.

There is also the simpler approach of drawing the set of polygons for each region twice, once with a stroke and once with a fill, as shown in bl.ocks.org/5416440:

merging states ii

See also a very similar question on Stack Overflow.

  • Awesome, got this implemented in very little amount of time. Thanks and works fine without adjustments. Guess I need to dig at topojson's docs more, it's quite powerful. – StrangeWill Sep 13 '13 at 18:41
6

The problem is that, for the moment, QGIS does not recognize the TopoJSON format (too recent). The solution is to transform the TopoJSON file into GeoJSON format:

and you can import the GeoJSON file in QGIS

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.