Topojson: How to design valid polygons, lines, poi

2019-05-24 03:44发布

问题:

Up to now I always used GIS files from the web, which provide me administrative polygons, rivers, landmasses, etc. I then convert them to Topojson format to feed D3js.

Today I have to design my own layer (wine_areas) within Quantum GIS (QGIS). Similarly, this .shp file will later on be converted into Topojson format.

When designing my shapes, lines, dots within a GIS software (.shp file): What are the critical aspects I should worry about, and how to do so the .shp and the final Topojson files is valid, with the expected typologies ? Mostly, with neighbor polygons sharing their common arcs, etc.


I especially wonder how to design my topojson "arcs" in GIS softwares :

  • should I put my shapes nearby such [][]
  • should I design a shape and cut it with a line [|]
  • which level of precision is needed ? (and how to know it)

and other tips.

回答1:

In QGIS:

  1. Go to Settings > Snapping Options, check both boxes at the bottom, and check the box to the left of the layer(s) you're working on. Set a tolerance greater than 0. I like to set a tolerance in pixels, and make it big enough that it will be obvious when a vertex has snapped. 10px works well for me.

  2. Use the Topology Checker plugin (enable with Plugins > Manage and Install Plugins...) to see if you have any gaps or overlaps where you don't intend. Once installed, access with Vector > Topology Checker. Hit Configure on the panel that pops up and select your layer in the first box. In the second box, select must not have overlaps and click Add Rule, then repeat for must not have invalid geometries. Depending on your design, you may also want must not have gaps

When designing your data, you can draw shapes next to each other, rather than drawing and then splitting. Anywhere that you want features to share an arc in the TopoJSON, be sure that the vertices forming that arc snap together. Shapefiles do not save topology, but two vertices snapped together will have the same coordinates and the topology will be inferred by the TopoJSON utility.

As for how much precision is required, TopoJSON quantizes points, and you can adjust this value. Knowing how much requires some math, explained here. You don't need to worry about snapping if you get points close enough that they are quantized to the same point.

Having written all that, I just now realized how old this question is...