Can python pull in feature information such as extents or coordinate system?

1474
2
Jump to solution
01-07-2013 06:39 AM
by Anonymous User
Not applicable
Original User: SStrand

I have been putting together a python script to automate metadata creation. For the most part it is just simple find/replace in a word document. I was curious though, is there anything in arcpy which allows us to target a layer and extract information from it, like its extents or coordinate system? I'm not talking about setting it, but finding out what it currently is and having those values written out to text.

Thanks!
0 Kudos
1 Solution

Accepted Solutions
by Anonymous User
Not applicable
Original User: jamesfreddyc

scroll to the bottom of each page for code examples.

http://resources.arcgis.com/en/help/main/10.1/index.html#/Extent/018z00000072000000/
http://resources.arcgis.com/en/help/main/10.1/index.html#//018z0000000v000000

Here is how I get the Extent of a layer with arcgisscripting(9.3) where I need to set the extent of the Geoprocessor:

[INDENT]#set fc to a stored layer extlyrDESC = gp.describe(fc)  xmin = extlyrDESC.Extent.XMin ymin = extlyrDESC.Extent.YMin xmax = extlyrDESC.Extent.XMax ymax = extlyrDESC.Extent.YMax   ### sets the actual extent of the Geoprocessor object strExt = str("%f " % xmin + "%f " % ymin + "%f " % xmax + "%f" % ymax) gp.Extent = strExt[/INDENT]

View solution in original post

0 Kudos
2 Replies
by Anonymous User
Not applicable
Original User: jamesfreddyc

scroll to the bottom of each page for code examples.

http://resources.arcgis.com/en/help/main/10.1/index.html#/Extent/018z00000072000000/
http://resources.arcgis.com/en/help/main/10.1/index.html#//018z0000000v000000

Here is how I get the Extent of a layer with arcgisscripting(9.3) where I need to set the extent of the Geoprocessor:

[INDENT]#set fc to a stored layer extlyrDESC = gp.describe(fc)  xmin = extlyrDESC.Extent.XMin ymin = extlyrDESC.Extent.YMin xmax = extlyrDESC.Extent.XMax ymax = extlyrDESC.Extent.YMax   ### sets the actual extent of the Geoprocessor object strExt = str("%f " % xmin + "%f " % ymin + "%f " % xmax + "%f" % ymax) gp.Extent = strExt[/INDENT]
0 Kudos
by Anonymous User
Not applicable
Original User: SStrand

Thank you very much James. It is in the code and working great! Exactly what I needed.
0 Kudos