0

Using ArcPy, is there any way to update the selected records of a feature class' field based on a Selection by Location of another shapefile?

In other words, update a field in a feature class' point based on which polygon it falls into. Of course, this would draw field information from the shapefile that is being used for selection.

  • 2
    There are many ways to accomplish this. What attributes do you need to transfer from the polygons to the points? – Aaron Jun 28 '15 at 20:27
  • 1
    At least 3 ways spring to mind, the question that needs to be addressed is 'within', 'containing' or 'close to' and what about duplicates? When considering an overlay operation how do you equate source to destination? What happens when a destination polygon is encountered by multiple source polygons? After you've decided that you can look at how source fields map to destination fields. I would think a cursor/layer/cursor would be the best for this without knowing much about your data but this might be just as easily solved by spatial join. – Michael Stimson Jun 28 '15 at 22:11
  • I'm looking to Spatially join points that fall within polygons. The polygons will have city and zip code information and I need to transfer that information over to the points. – TacoB0t Jun 29 '15 at 1:01
  • Please edit your question to address any requests for clarifications sought via comments. I offer some advice on how to structure questions to attract answers at meta.gis.stackexchange.com/a/3353 – PolyGeo Jun 29 '15 at 2:01
1

I answered a question here that is probably similar to what you want (the second part of the answer). Using Spatial Join works also, but it creates another layer which might not be desirable. If you have specific layers/shapefiles, post them in your question and I'll try to create usable code for your particular issue.

-1

Use Spatial Join tool. You can find more about field mapping functionality along with your join in here.

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

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.