0

I have two shapefiles I am attempting to join spatially. One is a county polygon file and the other is a hydrology polygon layer spread throughout various districts within it.

I'd like to output a shapefile and attribute table that breaks the hydrology file by district so pieces of the hydrology file are separated and can be associated with respective borders that they fall within.

What are the steps to achieve this?

I am running ArcGIS desktop 10.4. Right now I'm trying to clip the hydrology layer from the district layer. Spatial join just doesn't break the hydrology file.it gives most of the hydrology parcels to one district and although I can see which districts it covers in a list the polygon itself is unchanged. So I couldn't show which part of the lake is contained within a particular district. I'm trying to select a district, clip the hydrology file based on that one district then output a shapefile. I'll do this for all. Trying to do it with python.

closed as off-topic by PolyGeo Dec 5 '16 at 22:33

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions seeking help to debug/write/improve code must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Providing a clear problem statement and evidence of a code attempt will help others to help you. See: How to create a Minimal, Complete, and Verifiable example." – PolyGeo
If this question can be reworded to fit the rules in the help center, please edit the question.

  • What GIS software are you using? What have you tried? – PolyGeo Dec 5 '16 at 21:40
  • I am running arcgis desktop 10.4. Right now I'm trying to clip the hydrology layer from the district layer. Spatial join just doesn't break the hydrology file.it gives most of the hydrology parcels to one district and although I can see which districts it covers in a list the polygon itself is unchanged. So I couldn't show which part of the lake is contained within a particular district. I'm trying to select a district, clip the hydrology file based on that one district then output a shape file. I'll do this for all. Trying to do it with python. – StargazingFish Dec 5 '16 at 22:30
  • I would try a Union, then Split Vector Layer. – klewis Dec 6 '16 at 0:19
  • I've tried the union but that hasn't been successful. The union breaks are messy and you can't properly distinguish which polygons are the district and which are the hydrology polygons. – StargazingFish Dec 6 '16 at 1:05
1

There are several ways- Here are the general options. Not clear if you are writing a script or using the desktop tool.

1) Spatial join -A means to add or "Join" attribute table of one feature to the target feature based on spatial location- In this case, joining the hydrology file to the county file. This creates a new output file.

or-

2) use the "union" option to overlay the hydrology file with the county file. This creates a new layer.

After choosing one of the above, you are able to "Select Layer by Attribute". The attribute would be the district. The hydrology features within the "selected" district will be highlighted in the attribute table. You can output the selection to an output file.

  • Like I said in the prior comment the union doesn't neatly break the two layers. Some work but many are unrecognizable and can't be distinguished as district or hydrology – StargazingFish Dec 6 '16 at 20:42
1

In QGIS, you may use the "Clip" tool from Processing (Vector > Geoprocessing Tools > Clip).

I don't understand if your hydrology layer is a Linestring or a Polygon layer, however this should work in both cases. If you start from something like this:

enter image description here

you only need to click on the "Iterate over this layer" button in the options for the clip layer (see image below):

enter image description here

The tool will iterate over each feature of the clip layer, clipping the features from the input layer which are within it. This will be the result:

enter image description here

Every output layer will mantain the attributes from the input layer (in this case, the hydrology layer): if you need the attributes from the clip layer, you may simply join them with a further step.

Please note that the number of output layers will be equal to the number of features from the clip layer, so you may obtain some empty output layers for that cases where there is not any feature within the clip layer.

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