POST
|
Don't panic... it's all still there! In ArcGIS Desktop 10 ArcMap you'll find what you need on these main menu items: [INDENT]Customize --> Extensions -- check box to enable Spatial Analyst Customize --> Toolbars -- select Spatial Analyst Geoprocessing --> Environments -- adjust the appropriate settings for your raster/grid analysis [/INDENT] Stuart
... View more
12-22-2010
08:35 AM
|
0
|
0
|
292
|
POST
|
Holm, The arcgisscripting Python module is hard coded for v2.5; but can be configured to use a 2.6 or 2.7 release (no 3.0). Also, because of the move beyond a simple module (arcgisscripting) to a full site library (ArcPy)--the same is not true with ArcGIS 10. Many compiled dependencies, both Python and Numpy, get broken. For ArcGIS 9.3 there is some coverage in the current ArcGIS Forums and some meat in the old forums, but best resources for the topic are over on the GIS Stackexchange. Read both of these threads to start: [INDENT]http://gis.stackexchange.com/questions/2226/can-i-use-python-2-6-with-arcgis-9-3 http://gis.stackexchange.com/questions/609/will-arcgis-10-support-python-2-7-or-python-3-1[/INDENT] Good luck. Stuart
... View more
12-19-2010
03:49 AM
|
0
|
0
|
312
|
POST
|
Alice, OK. Better role up your sleeves... 🙂 So, we haven't discussed it but what is the source of your .PNG rasters? In any case, you'll have two choices on buffering them in a geospatial context within your GIS: [INDENT]1) spatially georeference the raster prior to extracting the polygon/polyline buffers as feature classs by including a .WLD, .PGW, or .pngw ESRI Grid "World file" for each raster. Once geospatialy registered you could specify a 5 meter buffer--it could be 1 pixel, 2 pixels, or even 10 pixels depending on the resolution of the raster. Each raster image will require its own unique world file. And you'll probably want to pick a "projection" with planar units in meters--like UTM. A big down side is that your Python script will need to be modified considerably to robustly include the world files, georegister the image and apply a projection/spatial reference to be used during the raster to polygon extraction. 2) the second choice is to project the buffer feature classes, defining a projection, after they have been extracted from the raster. You'll need to establish a set of X,Y control points in a meter planar unit projection--again probably UTM, to overlay on each polygon as control for the projection. Project the points and apply the same to the buffer polygon. Do you have GPS points from your pipeline and utility data? Perhaps do the rastertopolygon buffer at .5 pixel. and then once projected, perform another buffer to be 5 meters. [/INDENT] The first is the more traditional approach, and is MUCH simpler to implement--but you'll have to rework your Python script. Another suggestion would be to drop the direct RasterToPolygon based buffer geoprocessing and instead perform a RasterToPolyline feature extraction. And then buffer the polyline feature--your pipelines and other underground utilities. You'd still want to georeference and register the rasters into a planer unit projection--like UTM for accuracy of the buffer. And would need to establish "World file" details for each image, again what is the source of the PNGs--do they provide spatial reference of some sort? An alternative to geoprocessing from the PNG would be to convert each image to GeoTIFF with embeded spatial registration, the RasterToPolygon or even RasterToPolyline with subsequent buffering could consume it. Perhaps the latest FWTools GDAL build gdal_translate tool could be incorporated into an "os" call in the script, or done ahead of time. Maybe too much? Stuart
... View more
12-15-2010
06:28 AM
|
0
|
0
|
788
|
POST
|
Alice, Good news 🙂 So now make it pretty -- 1) as noted before these snippets come from saving the script out of the original model builder run and should be removed... [INDENT]# Load required toolboxes... ##gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Conversion Tools.tbx") ##gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Analysis Tools.tbx")[/INDENT] 2) using the overwrite is a good idea, [INDENT]gp.OverWriteOutput = 1 # overwrite existing files (1 = True, 0 = False)[/INDENT] but I'm not certain of its behavior regards the preceding gp.CreateFileGDB ("D:/J040083", "ShapeFiles.gdb") will it clobber it or throw an error? 3) to be more "Pythonic" the os.path.join syntax could be changed [INDENT]INPUT_RASTER = os.path.join(root, filename_zero + ".png")[/INDENT] 4) You're not working with Shapefiles, rather Polygon Feature Classes in a File Geodatabase. Since you kept the model builder naming outputs it might be better to instead rename the FGDB, i.e. BufferedFeatures.gdb or something more descriptive. 5) your buffer is FULL, do you need LEFT (outside) or RIGHT (inside) the extracted polygon features (unfortunately only available if you are on an ArcInfo level Desktop license). It is also in pixels, 5 which with FULL is doubled to a width of 10 pixels. And to work in geospatial values you may need to treat the rasters as projected during the buffering--or could project the feature class at your next analysis step. 6) the script is not especially robust as you've found. Probably need to handle more cases, e.g. files with extensions other than .PNG, or different raster types, as well as filename oddities--plus signs and periods being a problem for consistent results with Python os.path.splitext(). 7) finally, you'd indicated you wanted Shapefiles as the outcome. You don't have them yet but can easily convert with a loop through the FGDB using the FeatureClassToShapefile_conversion geoprocessing command. Otherwise congratulations! You can get on with your analysis and get to it all the faster on the next problem set. Stuart
... View more
12-14-2010
05:05 AM
|
0
|
0
|
788
|
POST
|
Alice, I read the errors and looked at the listing of the IMAGES folder, and can see there are no duplicate file names and no file types other than .PNG. Although, you may have some issue with splitting of the "LG_landelijk+hoogspanningsnet_Tennet+TSO+B.V._0000579962_10G179920.png" named image file. The only question that still comes to mind... are you working with an open ArcCatalog session while debugging, and are you backing out of the ShapFiles.gdb folder and deleting or renaming the geodatabase. I.e., starting fresh before attempting an additional run through the python script? If not, you should or you'll get errors similar to these. So, do that. and also insert these print statements [INDENT] print(INPUT_RASTER) print(Output_polygon_features) print(Raster_Buffer_shp) [/INDENT] where they are declared in the script. They'll allow you to follow progress in the console as the script executes. Stuart
... View more
12-13-2010
08:21 AM
|
0
|
0
|
788
|
POST
|
Alice, OK, will look to continue with it Monday. And once you get it all worked out please consider posting the clean script up in code brackets for benefit of the next poor soul.. Stuart
... View more
12-10-2010
09:19 AM
|
0
|
0
|
1239
|
POST
|
Alice, Progress 🙂 So, had you emptied and deleted the ShapeFiles.gdb FGDB--resetting prior to the run? Or, was the duplicate feature class name occurring during the same script run? If so, what exactly do you have in your IMAGES folder? Just the PNGs? Any chance the os.path.splitext(filename) is not making the filename unique, possibly extra periods in the image name? Maybe capture a screen shot of the directory and post it. Again, you may need to adjust the parsing logic to only attempt the RasterToPolygon on the .PNG by testing the file extension before passing through the filename_zero. And set a print(Output_polygon_features) statement to keep track on the console while running; or as bwreilly suggested on the GIS Stackexchange thread, run inside the debug module pdb.run() to step through. You should be able to see when the duplicate is occurring. And I'll split a hair here to say that if you are still using the File Geodatabase as the output container for your geoprocessing you are not creating Shapefiles rather they are Feature Classes. But get the script fully working before worrying about that distinction. Stuart
... View more
12-10-2010
04:11 AM
|
0
|
0
|
1239
|
POST
|
Greg, AppFramework9 3.1.0.42 is bundled with the HEC packaged distribution releases. You can't mix-n-match with the developmental versions. I would strongly recommend that you not try to maintain the Water Resource Applications separately. Rather, you will have best outcome if each reload cycle you 1) remove all prior WR components; and 2) install a current developmental build of either HEC GeoRAS or HEC GeoHMS from the ESRI ftp site--not the HEC packaged installer. Using the current developmental builds, HEC GeoRAS will install the correct AppFramework9 and GeoRAS. While HEC GeoHMS will install AppFramework9, ArcHydro9 and GeoHMS. These builds are in sync and will inter operate. I don't recommend it, but you can pick up just the latest AppFramework9 alone from the ESRI maintained ftp site at: [INDENT]/ApFramework/Setup9.3_9.3.1/3.1.0.93[/INDENT] Also closely read the site notes -- currently Readme11152010.doc -- on the root to the site. Use these credentials provided by ESRI in setting up your ftp connection. Use an FTP client like FileZilla: http://forums.arcgis.com/threads/827...5289#post35289 ftp.esri.com login: RiverHydraulics password: river.1114 Alternatively, you can work with the HEC distributed packages, but they will not be current and will not be inter operable with current ArcHydro release. Also ArcHydro10 is not compatible with HEC GeoHMS9 if you were looking at that. Again, read the site notes at the ftp site to see how they all are interconnected. Post back with some detail on what you are attempting and if you have specific issues. Stuart
... View more
12-09-2010
05:58 AM
|
0
|
0
|
828
|
POST
|
Alice, OK, so this was totally MY fault. What did I suggest changing in handling the file name when selecting the PNG images out of the IMAGES folder? See it... on line 39? OK, and think what happens if there are any files that are not Raster images, like a .PGW world file, or meta data? You'd be trying to pass them in as rasters, but they may not be. So to fix it... could simply revert to your original .PNG image selection logic. Change line #39 INPUT_RASTER = os.path.join(root + "/" + filename) to read INPUT_RASTER = os.path.join(root + "/" + filename_zero + ".png")
or even hardcode the path as with the earlier Output_Polygon_features assignment
INPUT_RASTER = "D:/J04-0083/IMAGEFILES/" + filename_zero + ".png"
And see if that was the problem. Also, as was suggested by celenius over on the GIS Stackexchange thread, you could insert a print (<YourVariableName>) statement just after the selection to help debug the script. Comment it out when the logic is correct. And thinking about it, maybe this is not robust enough. As it is, you'll need to be sure that only the .PNG image files start with LG--and you won't be able to have the matchiing LG<imagefileName>.PWG colocated in the folder that may be needed for the geoprocessing. Maybe since you have the file extension available in filename_split[1] from the os.path.splitext, you could make use of that in another "if ==" to ONLY buffer specific image file types, e.g. PNG, png, JPG, jpeg etc. in the IMAGES folder when running through it. Stuart
... View more
12-09-2010
04:47 AM
|
0
|
0
|
1239
|
POST
|
Alice, Guess no one is going to answer you. So here is my offering. 1) if you are on ArcGIS 9.3 (you're not on 9.2 are you?) you should create the Geoprocessor object with the 9.3 enhancements. [INDENT]gp = arcgisscripting.create(9.3)[/INDENT] At ArcGIS 10 you can keep the (9.3) arcgisscripting syntax or shift to the more complete ArcPy Site Library. 2) You don't need to add the ArcToolbox code--those functions are included when you create the Geoprocessor in your Python script. And would cause problems if you were to add the script into a custom toolbox. 3) Working with the ShapeFiles.gdb File Geodatabase, you either need to have created it outside the script or create it when opening the script with: [INDENT]gp.CreateFileGDB ("D:\\J04-0083", "ShapeFiles.gdb")[/INDENT] 4) As scripted the result of the gp.RasterToPolygon is being output as ESRI Feature Classes within the File Geodatabase. But, you're putting your results into a file geodatabase "D:\\J04-0083\\ShapeFiles.gdb" and trying to name them .shp--that doesn't make them shape files. Rather, using the extension actually causes the gp script to throw an error. In your script, just drop the .shp and they'll be properly created as Polygon Feature Class in the geodatabase. 5) You went the other way with the Buffer_analysis. Output from that was dropping to the file system as Shape files in the D:\\J04-0083 folder. It would have been more consistent to keep both the geoprocessing polygon outputs together in the same format. Again, I would drop the .shp extension, and direct the output into the file geodatabase--i.e., change the output path to D:\\J04-0083\\ShapeFiles.gdb. [INDENT]Raster_Buffer_shp = "D:/J04-0083/ShapeFiles.gdb/" + "SB_" + filename_zero[/INDENT] 6) Finally, the problem with scripting this way is that you will end up with output from each script run in the working directory. I think the reason you were getting the 99999 errors is probably because you had pieces left over from prior run that had name conflicts. You have to clear things out at each script restart, i.e. empty the working directory, and empty/delete the File Geodatabase. Do that and you'll reach the more useful ExecuteErrors. 7) when you are done creating your buffers, work with them in the File Geodatabase. Or, you can export them to Shapefile if you need that format for some other application. Here is your code cleaned up...I find forward slashes more readable than double backslashes, Python keeps it all straight. Also, if your PNG rasters have some projection details you may need world files for them to end up with usable results. I threw together some simple PNGs to test with, so your buffer value of "5 Meters" is set to "5" default pixels. # ---------------------------------------------------------------------------
# RASTER2POLYGON.py
# Created on: Wed Dec 01 2010 12:20:48 PM
# (generated by ArcGIS/ModelBuilder)
# Usage: RASTER2POLYGON <INPUT_RASTER> <Output_polygon_features> <Raster_Buffer_shp>
# ---------------------------------------------------------------------------
# Import system modules
import sys, string, os, arcgisscripting
# Create the Geoprocessor object
gp = arcgisscripting.create(9.3)
# Load required toolboxes...
#gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Conversion Tools.tbx")
#gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Analysis Tools.tbx")
# Script arguments...
gp.workspace = "D:/J04-0083"
gp.CreateFileGDB ("D:/J04-0083", "ShapeFiles.gdb")
folder = "D:/J04-0083/IMAGEFILES"
for root, dirs, filenames in os.walk(folder): # returms root, dirs, and files
for filename in filenames:
filename_split = os.path.splitext(filename) # filename and extensionname (extension in [1])
filename_zero = filename_split[0]
try:
first_2_letters = filename_zero[0] + filename_zero[1]
except:
first_2_letters = "XX"
if first_2_letters == "LG":
Output_polygon_features = "D:/J04-0083/ShapeFiles.gdb/" + "SH_" + filename_zero
# Process: Raster to Polygon...
INPUT_RASTER = os.path.join(root + "/" + filename)
gp.RasterToPolygon_conversion(INPUT_RASTER, Output_polygon_features)
Distance__value_or_field_ = "5"
Raster_Buffer_shp = "D:/J04-0083/ShapeFiles.gdb/" + "SB_" + filename_zero
# Process: Buffer...
gp.Buffer_analysis(Output_polygon_features, Raster_Buffer_shp, Distance__value_or_field_, "FULL", "ROUND", "NONE")
Post back if you are still stuck. Stuart
... View more
12-08-2010
03:34 PM
|
0
|
0
|
1239
|
POST
|
Getting closer! Call for Beta participants from the Geodatabase team... Thanks for your interest in the File Geodatabase API. The beta program for the File Geodatabase API is currently planned to begin by mid-January. We are compiling a list of sites who are interested in the Beta program, if you are interested, please send me an email (lshipman@esri.com) with your contact information. We�??ll be posting more information to the Geodatabase blog as we lead up to the Beta. http://blogs.esri.com/Dev/blogs/geodatabase/default.aspx Stuart
... View more
12-04-2010
06:12 PM
|
0
|
6
|
2902
|
POST
|
Tina, If the HEC-GeoRAS is not showing up in the View --> Toolbars menu, check see if it is listed in the Tools --> Customize --> Toolbars tab. If it is, check it there--and then should show in the View --> Toolbars. But if it is also not listed in Customize, then something went amiss with the HEC-GeoRAS install. My suggestion would be to uninstall and remove all traces of the Water Resource Utilities, and start again. I've found that with everything cleaned, picking up the ArcHydro9 and AppFramework9 bundled with the HEC-GeoHMS download (either v.5.0.0.69 or v.4.2.93.51) seems to go smoother. I prefer v5.0.0.69 HEC GeoHMS as I think the documentation is better. Once all three of those are installed, then do the HEC GeoRAS (v.4.3.1.21) install. The ftp site is labled .20 but internaly it is v.21--also use an FTP client rather than your web browser and check the CRC hashes. Note: HEC-GeoHMS v5.0.0.69 bundles ArcHydro v.1.4.0.255; v4.2.93.51 bundles ArcHydro v.1.4.0.253 which will not work with v.5.0.0.69 of GeoHMS. Not obvious, but need to pay attention to the build/folder dates on the ftp site compared against the ReadmeMMDDYYYY.doc notes. Unfortunately the notes are sometimes a little behind. Stuart
... View more
11-30-2010
07:43 AM
|
0
|
0
|
828
|
POST
|
Folks, The ArcHydro9 help is delivered as compiled HTML and can be accessed from the toolbar or can be directly opened from this location following a default installation: [INDENT]C:\Program Files\ESRI\Water Utils\bin\ARCHYDRO.chm[/INDENT] Additionally, from the ESRI maintained ftp site the /ArcHydro/Doc/ArcHydro1_4 directory holds the following PDF all published July 2010: Arc Hydro Tools 1.4 - Overview.pdf (17 pg.) Arc Hydro Tools 1.4 - Tutorial.pdf (142 pg.) ArcHydro GP Tools 1.4 - Tutorial.pdf (177 pg.) All fairly well written and covering pretty completely all facets of the ArcHydro tools. Please access the site, download them, and have a close read. I think you'll find that between these resources, this is really one of the better documented ESRI extensions! Expect that as the version 2.0 for ArcGIS 10 is further developed its rudimentary documentation will be brought up to the same high standard. Stuart
... View more
11-29-2010
02:56 PM
|
0
|
0
|
581
|
POST
|
"besmart" Niklas's suggestion, to use a World file would work, but could have issues in determining a correct rotation and scaling to apply and would have to be replicated for each image being processed. I think your task can be done programmatically directly in Python with the Warp (Data Management) raster tool. Which actually is the same logic used for the interactive Georeference Tool in ArcMap. Documentation and examples are here by release: [INDENT]Warp_management in arcpy Python site package in ArcGIS 10 or Warp_management in arcgisscripting Python module in ArcGIS 9.3[/INDENT] Keep in mind that your images actually have two sets of coordinates, the 0,0 relative (x,y) of the raster and a corresponding (x',y') projected value--use the pairing as the from -- to as control for the warp (as in the Georeference Tool). If you work in the same projection as corner points of the images, the POLYORDER1 "AFFINE" transform should work well using the corners as controls. Appropriate if your images are scans of existing maps sheets. But for images other than scanned maps (or if "reprojecting") you may need the more complex "fitting" of a higher order transformation to better register the input raster. You probably don't want to resample so just accept the default NEAREST option. Pick a raster output format and first try a couple from the Python IDLE command line. Then script a loop through a file list of images and associated control points/corners. You'll end up with two sets of rasters--the originals and the output of the Warp. Alternatively you can output directly as ESRI grid into a File Geodatabase Raster dataset ready to use in ArcGIS. Stuart
... View more
11-27-2010
09:00 AM
|
0
|
0
|
2952
|
Title | Kudos | Posted |
---|---|---|
1 | 08-01-2014 07:06 AM | |
2 | 10-04-2022 05:38 AM | |
1 | 03-10-2022 04:50 AM | |
1 | 11-21-2021 10:18 AM | |
1 | 11-12-2021 10:06 AM |
Online Status |
Offline
|
Date Last Visited |
08-28-2023
04:23 AM
|