Python Code to retrieve data.

501
6
01-31-2013 07:11 AM
HectorChapa
Occasional Contributor II
Hopefully someone could help me. Watch the video below it explains my problem and you can actually see what i am talking about.
I write the problem. I have two attribute tables and they have a field in common. I am trying to do automation either by python or field calculator to get information from one table to another one. I could do it manually but that would take me time which i dont have a lot of time.
I also have lync so i can seen you an invite for you can see my screen you dont need to have the software just an internet connection.
My email is hchapa@lrgvdc911.org and my number is  956-682-3481 ext. 143.

My name is hector.

See the video the link i provide below it will explain and you can actually see the problem thanks.
By the way watch the video in the highest definiton and watch it in full screen 720 is hd for you can see it perfectly.


Thanks,

https://www.youtube.com/watch?v=ydBS0zYsIYs
Tags (2)
0 Kudos
6 Replies
AndrewChapkowski
Esri Regular Contributor
You can do this many different ways, but the easiest is probably to just do a spatial join.

Check out: http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00080000000q000000

You can also use a search and update cursor to add the information into the field.
Workflow:
1. Create a search cursor on the point data
2. Grab the Geometry of the Point and use that geometry to select by location on the polygon
3. Using and update cursor, update the polygon with the ID value.




Andrew
0 Kudos
HectorChapa
Occasional Contributor II
Could you guiede me how to do a cursor and update.

I can send you a link for you can see my desktop and guide me

Let me know if you can help me out in writing the script for me is a little complicated.


Thanks,

Hector Chapa
0 Kudos
AndrewChapkowski
Esri Regular Contributor
Python scripting can be tough at first, just like and language, but these links should help you:

   For Search Cursors, please see: http://resources.arcgis.com/en/help/main/10.1/index.html#/SearchCursor/018w00000011000000/
   For Update Cursors, please see: http://resources.arcgis.com/en/help/main/10.1/index.html#/UpdateCursor/018w00000014000000/
   If the datasets live in the same workspace, you might need to start an edit session: http://resources.arcgis.com/en/help/main/10.1/index.html#/Editor/018w00000005000000/
For general python:
  Look at the quick links section of this page: http://resources.arcgis.com/en/communities/python/
0 Kudos
HectorChapa
Occasional Contributor II
What happends if the dataset dont live in the same workspace.
If i understand correctly, and do correct me if I am wrong.
A workspace is where the data is store.
For example if bot shapefiles live at c:/911/desktop.
Does my mxd has to be in the same workspace.
Also, just tell let you know my workspace for the two shapefiles are in different locations.

Can it still work.

Let me know.
0 Kudos
HectorChapa
Occasional Contributor II
WHy cant i use arcpy.da.SearchCursor

it gives me a runtime error  module object has no attribute 'da'
0 Kudos
AndrewChapkowski
Esri Regular Contributor
Are you using 10.1 or 10.0?

If it's 10.0, then you can find all the cursor information here: http://help.arcgis.com/en/arcgisdesktop/10.0/help/

Just search for the information I showed before.

The concepts are the same, except the 10.0 cursor objects are slower.

You want to use these two functions at 10.0:
arcpy.SerachCursor() 
arcpy.UpdateCursor()
0 Kudos