|
POST
|
Ernst Kemmerer wrote: I cant get it to work. That's not very informative. What does "cant get it to work" mean exactly? Do you get an unexpected result, do you get an error message, does python crash, does your PC crash, does your PC spontaneously combust and let all the magic smoke out? Just kidding, what was the error message/unexpected result? PS: you are setting projCount to the number of features in the last fc that you reproject. If you want to print the number of fcs that you reprojected, you need to do something like: projCount = 0
for fc in fcList:
etc...
if fcspatialRef != spatialRef:
arcpy.Project_management(fc, outFolder + "\\" + fc,template)
projCount += 1 #or projCount = projCount + 1
... View more
04-15-2015
02:45 PM
|
0
|
0
|
1120
|
|
POST
|
Correct. A feature class does not have a "getExtent()" method like a layer does. You need the arcpy.Describe method and the extent property - i.e. arcpy.Describe(shapefile).extent
... View more
04-12-2015
11:24 PM
|
0
|
0
|
1362
|
|
POST
|
The 'overlaps' method must return False if the dataframe extent is completely within/completely contains the layer extent. Try the 'disjoint' method instead. See the documentation - http://resources.arcgis.com/en/help/main/10.2/index.html#//018z00000072000000 Something like: for mxdname in arcpy.ListFiles('*.mxd'):
print mxdname
mxd = arcpy.mapping.MapDocument(os.path.join(env.workspace, mxdname))
df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]
for lyr in arcpy.mapping.ListLayers(mxd, "" ,df):
if df.extent.disjoint(lyr.getExtent()):
arcpy.mapping.RemoveLayer(df, lyr)
print lyr
mxd.save()
del mxd
... View more
04-12-2015
04:24 PM
|
1
|
2
|
3792
|
|
POST
|
Extent objects support a 'overlaps' method Try something like: if not df.extent.overlaps(lyr.getExtent()) : etc... Sorry about the lack of formatting and links, the GeoNet mobile site is terrible.
... View more
04-12-2015
03:14 AM
|
0
|
9
|
2431
|
|
POST
|
Ben, gdal_translate.exe is a commandline program, you run it from a command prompt. I was assuming you had a working gdal install to generate those files in the first place. How did you create/get them? You could also try the ArcGIS Copy Raster tool to see if that strips the tags.
... View more
04-09-2015
01:19 PM
|
1
|
1
|
1058
|
|
POST
|
Thanks Dan. I was wondering why I got moderated. Oh well, at least I now know who moderates the moderators
... View more
04-08-2015
08:55 PM
|
0
|
1
|
1058
|
|
POST
|
Assuming they are tiffs and you have a working GDAL install, you can use the PROFILE creation option to specify GEOTIFF instead of the default GDALGeoTIFF: gdal_translate -co PROFILE=GeoTIFF in.tif out.tif
... View more
04-08-2015
07:07 PM
|
0
|
6
|
1058
|
|
POST
|
Not quite sure what you are trying to do, but maybe a try: except: block will do what you want? try:
servicequery(CreatedDate, now_minus_10)
except DataError as err:
print 'Data error', err.message
except (NoDatainLast5, NoDatainLast10) as err:
print 'NoData', err.message
except Exception as err:
print 'Something else went wrong', err.message
finally:
print 'Clean up etc...'
... View more
04-03-2015
09:31 PM
|
0
|
0
|
14978
|
|
POST
|
So within a week of me slagging PyScripter off, the developer released a new version http://sourceforge.net/projects/pyscripter
... View more
03-25-2015
07:01 PM
|
1
|
0
|
2631
|
|
POST
|
Instead of exporting from a model, you'll get better python output by running the tool from the ArcToolbox window, then clicking the Geoprocessing menu and opening the Results window, right click the process you just ran and select "Copy As Python Snippet". (Image from this GIS StackExchange answer)
... View more
03-25-2015
12:24 PM
|
1
|
0
|
1018
|
|
POST
|
The help page of each tool specifies what license is required. For example, the Add Rasters To Mosaic Dataset tool requires a standard or advanced license.
... View more
03-20-2015
01:23 PM
|
0
|
0
|
351
|
|
POST
|
I don't have Wing or 10.3 Pro at work to test, but you should just set the interpreter you want in the project properties. Wing has some excellent documentation and tutorials - https://wingware.com/support For q. 3, yes you will have to deal with licensing, Wing Pro is only a 30 day trial - https://wingware.com/store/purchase
... View more
03-19-2015
03:57 PM
|
0
|
2
|
2631
|
|
POST
|
The free version of Wing (101) is _very_ limited and doesn't support code completion. I use Wing Pro at home in a Linux environment and I highly recommend it, but I don't know how well it will support ArcGIS code completion (though going by other libraries, it will pick it up automatically and you won't need to do anything). I use PyCharm 4x Community Edition at work for ArcGIS development. It automatically handles arcpy code completion fine (for 10.2 Desktop, but I think it will handle 10.3 Pro python fine, it's very smart). I like PyCharm but I don't looove PyCharm as it's a bit too full featured and has quite a learning curve, but once you get up and running with it customised how you want, then it's great. Wing Pro has a 30 free trial, PyCharm Community Edition is free. Try them both!
... View more
03-18-2015
05:16 PM
|
0
|
0
|
2631
|
|
POST
|
PyScripter works fine with 64bit python. However, ArcGIS Pro uses Python 3.4 which PyScripter does not support. There is a contributed build for 3.4 in the issue on Google Code, but I don't know whether that is 64/32 bit. However... I _do not_ recommend PyScripter as it is no longer being developed and has pretty much been abandoned by the author - no commits or releases since 2012, issues not being fixed, or even acknowledged.
... View more
03-18-2015
04:15 PM
|
1
|
1
|
2631
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 07-24-2022 03:08 PM | |
| 1 | 07-30-2025 03:00 PM | |
| 1 | 06-10-2025 08:06 PM | |
| 5 | 05-20-2025 07:56 PM | |
| 1 | 05-04-2025 10:34 PM |