2

I have two polygon sets, one representing cities, the other representing school districts. I am trying to create a relationship between cities and districts, but I have a problem where the cities and districts share a boundary....the boundary line is not consistent and some points technically cross over the boundary, and as a result my ruby script is creating incorrect relationships when a city and school are adjacent.

Is there a way to smooth the datasets so that adjacent polygons share borders that are identical in terms of the lat/lng points along the border?

I have each dataset in a .csv file with lat/lng pairs and a descriptor attribute.

1 Answer 1

2
  1. QGIS can't edit a CSV, so your first step is to export your data to an editable format, such as geopackage or shapefile. Right click on the name of the layer in the Layer Panel > Export > Save Features As...

  2. Next, use the snap geometries to layer tool. This tool can be found in the Processing Toolbox.

    • For the reference layer, use whichever layer you think is more correct.
    • Use the other layer for the input layer.
    • For the tolerance setting, choose a value that is as large as the largest difference between the shared boundaries.
    • Choose the behavior setting that seems most appropriate to you. If you're not satisfied with the outcome, run the tool again with a different behavior setting.
  3. Once you're satisfied with the output, remember to save the temporary layer to a permanent format.

5
  • If your end result should be polygons with shared edges and no overlaps, you can use the Topology Checker plugin to make sure that your finished layers follow those rules.
    – csk
    Commented Jun 17, 2019 at 16:52
  • Thanks for the comment, much appreciated. Maybe this should be a separate question, but I've loaded my csv file into qgis, but having trouble turning it into a shapefile of polygons. Once I get this figured out I'll try your suggestion above.
    – tomb
    Commented Jun 17, 2019 at 21:18
  • I'm thinking I will reload the cities polygon file, then do a negative buffer as large as the largest difference between the shared boundaries. Then run the associations and the shared border should become a non-issue, right?
    – tomb
    Commented Jun 18, 2019 at 13:41
  • It really depends on the shape of your polygons and what you're trying to do with them. Are you trying to associate (through a spatial join) each polygon with each of its neighbors? In that case buffering the polygons would work. But that's really a different question from the one you actually asked.
    – csk
    Commented Jun 18, 2019 at 16:03
  • I'm making associations where the polygons intersect. The two individual datasets have polygons that do not intersect (cities and school districts). I'm making associations on the overlay of the two files where they intersect, but I'm doing it through a ruby script based on a CSV point file representation of the two datasets.
    – tomb
    Commented Jun 18, 2019 at 20:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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