Python is an open source interpreted programming language used in many GIS programs.

learn more… | top users | synonyms

1
vote
1answer
550 views

Spatial Analyst Cell Statistics tool in Python gives inaccurate results

My question is similar to the Cell Statistics gives Wrong Answer question. In Python, I'm using the MINIMUM parameter to execute the cell statistics tool on several reclassified rasters ('0's and ...
4
votes
2answers
2k views

ArcGIS Geoprocessing Services - Don't work if 'Run python script in process' not checked

I have a standard geoprocessing toolbox that I am exposing as a geoprocessing service. The tools in this toolbox are plain 'ol python scripts. All of this is being done in ArcGIS 9.3.1. As a ...
8
votes
2answers
2k views

Convert an ESRI File GDB Table to Access 2007 ACCDB table programmatically

Does anyone know of a method to convert an ESRI File Geodatabase Table into Access 2007 Table programmatically. I have been trying using the PYODBC library and a series of insert statements but am ...
2
votes
1answer
388 views

Perform Multiply (Times) Function on Several Reclassified Rasters Using Python

I have several reclassified rasters (0 = snow cover, 1 = no snow) and I would like to use the multiply function on all rasters that have the same spatial extent. In ArcGIS 10 this function can be ...
2
votes
1answer
322 views

Search Raster Files from Folder that Have Same Spatial Coordinates Using Python

I have approximately 700 raster files in a single folder and I need to find files that have the same spatial extent and copy to a different folder. The raster files measure daily snow cover and ...
2
votes
2answers
128 views

Finding Two locations with a conditional search on DEM

I want to find two locations H difference in elevation between two locations on a DEM. Ex: point A and B are my output after search on DEM. conditions are (1)buffer R distance around point A and (2) ...
6
votes
3answers
5k views

Programmatically start and stop map services with Python

Is it possible to programmatically stop and start ArcGIS Server map services using Python?
3
votes
2answers
2k views

Batch Processing 400 MODIS HDF4 Files Using Several Tools In ArcGIS 10

This is my first post, I hope I don't screw it up. We have about 400 MODIS HDF4 files we are looking to batch process in the ArcGIS 10 or Python environment. The tools we are looking to use are ...
6
votes
3answers
1k views

Why is an extra field necessary when creating point shapefile from csv files in Python?

I have a Python script that creates a point shapefile from a csv file within a Python script. This script gives me a ValueError for the longitude field (LON) if there isn't an extra nonsensical field ...
6
votes
4answers
5k views

Field Calculation - Python - If/Then over multiple data columns

I have some VB code saved that looks at two columns of data, and populates a third with the low value. Pre-logic Script Code: Dim output as double if [MIN_LEFT] < [MIN_RIGHT] Then output = ...
11
votes
1answer
656 views

automating roof orientation detection from satellite imagery

A while ago I did a neighbourhood roof orientation survey for solar panel deployment, by visually checking each roof and marking individually whether they were south or almost south-facing. As this ...
4
votes
1answer
1k views

Multiple Conditional Reclassification - ArcGIS

This is a question out of curiosity rather than a problem as I am not the most experienced with raster datasets and I wonder if there is a better solution to my current approach. I am trying create a ...
11
votes
4answers
1k views

Efficiently finding the 1st order neighbors of 200k polygons

For every one of the 208,781 Census block groups, I'd like to retrieve the FIPS IDs of all of its 1st order neighbors. I have all the TIGER boundaries downloaded and merged into a single 1GB ...
3
votes
1answer
1k views

Parameters for python script: how to provide a user interface that lists a tool's available value options?

I have several scripts that I have working from inside PythonWin. I am now experimenting with running these from inside ArcMap 10.0 so I can have a user define the parameters of the script. An ...
6
votes
2answers
2k views

Segment road network line shapefile into new equal length segments line shapefile

I would like to subdivide a road network for an entire state into segments of equal length. So, Highway X would be divided into 0.5 mile segments, with a record for each segment, and Highway Y would ...
13
votes
2answers
2k views

How to smooth/interpolate a raster in python using GDAL?

This is my first post so please feel free to critique where necessary. Background: I am developing in Python and using GDAL from OSGEO to manipulate and interact with rasters and shapefiles. ...
1
vote
1answer
294 views

Problems with python postgis polygon

I have a problem with the examples in the book "Python Geospatial Development". I can't write to the PostgreSQL database polygons from TM_WORLD_BORDERS (Chapter 7, page 202 in book). Code: src_file = ...
2
votes
1answer
292 views

OWSLib vs shp2img output of MapServer Layer

I'm working on a map layout engine using Python and ReportLab and have come across a problem and was wondering if anyone can give me some insight. Scenerio: I'm trying to generate an image using ...
4
votes
2answers
2k views

For Loop - Map Algebra (ArcGIS) using Python

ORIGINAL QUESTION Im relatively new to python and these fourms but Im am having trouble utilizing for-loops for spatial analyses within ArcGIS. It does not appear to recognize the variable, ...
7
votes
1answer
995 views

Inserting newlines in Rectangle Text elements via ArcPy causes overlap?

I ran across an issue the other day when I tried to use ArcPython's mapping module to edit rectangle text elements with newlines (\n) in an ArcMap document. Here's what the output looked like: ...
22
votes
4answers
756 views

Recommend topics to be included in a Computer Science for Geospatial Technologies course

I will be instructing a course at the local university titled Computer Science for Geospatial Technologies. This is an introductory course meant to introduce computer science concepts to geospatial ...
4
votes
2answers
184 views

Spawning a process from ArcGIS ToolValidator

I attempted to spawn a separate process from the ArcGIS ToolValidator script. Unfortunately, it launches another instance of ArcCatalog. What is going on behind the scenes that causes ArcCatalog to ...
1
vote
2answers
307 views

GetCount_management From ArcGIS ToolValidator

We want to check if features are empty in the ToolValidator. When you call GetCount_managment() and background processing is on, there is a popup from our validation step. Is there a different ...
6
votes
1answer
728 views

ArcGIS 9.3 Geoprocessor - AttributeError: Object: Environment <workspace> not found

So, this could be the most puzzling python geoprocessor error I have ever dealt with... This problem is occurring in ArcGIS Server 9.3, Python 2.5.2 I am exposing a typical python script as a ...
6
votes
4answers
2k views

Efficient arcpy method of points in polygon

Coming from a background of Mapinfo and Manifold, I frequently find myself frustrated with the ArcGIS SQL toolset. In both these former programs it is trivial to write a query asking, for instance, ...
2
votes
1answer
346 views

ArcPy replaceDataSource to an SDE raster catalog error

New to Python! I'm trying to re-path a multitude of rasters currently the workspace is a folder, the intended workspace is a raster catalog in an SDE database - using the replaceDataSource method I'm ...
3
votes
1answer
660 views

ArcGIS Select Analysis using Unique Values from Field

I am trying to create separate shapefile using Select analysis with ArcPy by doing an SQL query to create them based on a unique value from the field. I want to create a list of the unique values in ...
5
votes
1answer
4k views

Arcpy cursors, WHERE clauses, and date/time fields

I'm having trouble making a selection of rows that meet certain date criteria using my arcpy.UpdateCursor(). I need to update records in a field in a geodatabase table with an ascending value based on ...
7
votes
1answer
1k views

Edit End Points in Polyline (Python/ArcMap10)

I am trying to make a polyline endpoint snapping tool in python. using a Search Cursor I read in the values to an array of line objects (which contain the feature id of the line, and two "EndPoint" ...
6
votes
1answer
398 views

Counting Files with a Spatial Reference using Python

I need to display a list of feature classes with an unknown spatial reference, and the number of feature classes with a spatial reference. I think I have the first part right, but having troubles with ...
5
votes
2answers
481 views

What parts of the ArcGIS 9.3 Geoprocessor Programming Model diagram are not relevant for ArcGIS 10?

The geoprocessor programming model was an excellent tool for python scripting using ArcGIS 9.3. There is still no equivalent diagram for ArcGIS 10 - although there is a request on the ArcGIS ideas ...
11
votes
1answer
369 views

File Validation using ArcPy

I have a script which scans a directory and outputs basic raster data information such as the file name, format, number of bands, and etc. I need a way to make it so if the directory does not contain ...
4
votes
2answers
413 views

Finding Band Count in Rasters using ArcPy

I'm having troubles finding the band count for my raster files using ArcPy. I need to first list all the raster files in a directory, and then display the band count for each file. I am able to list ...
4
votes
1answer
2k views

Model Builder - unique name segment creation

Is it possible for us to give each output of a process a unique name segment (inline name). So for example I have a process that dissolves, then eliminates and buffers a single input file. I need to ...
3
votes
2answers
381 views

Reading multiple grid data with Python and ModelBuilder

How can I read grid data (3 or 5 sources of grids) like slope, soil, cover, etc.? My goal is to build a simulator based on multiple grid data for harvesting decisions.
4
votes
2answers
221 views

Append Point Shapefile Location by GPS'd text file

In my industry it is common to create preliminary design maps for point locations that have a unique identifier. Upon the actual construction on the design, points change location based on ...
4
votes
1answer
491 views

ArcGIS Geocode Single Address Python

How can I geocode a single address in python using arcgis 9.3? I found http://webhelp.esri.com/arcgiSDEsktop/9.3/index.cfm?TopicName=Geocode_Addresses_%28Geocoding%29 - but this does a whole table, ...
11
votes
4answers
3k views

Is there a Python Lib for requesting WMS/WFS and saving as image/PDF?

i am wondering whether there's Python open-source GIS lib which has APIs to support call WMS/WFS from another GIS server (e.g., GeoServer) and then save the response data(WMS Basemap and WFS layer) as ...
5
votes
1answer
932 views

How to check whether a fc is registered as versioned or not using python

How can I check whether or not a feature class is versioned using python? I'm trying to register feature classes using a python script. Before I do this I need to check whether a feature class is ...
1
vote
1answer
3k views

Using the arcpy.UpdateCursor to delete rows doesn't delete based on counter

I am trying to delete rows from a shapefile using arcpy.UpdateCursor. The first thing I did was get a unique list of values from the key field "PolyGUID", then I iterate that list doing a ...
2
votes
1answer
241 views

Query for Selecting only Selected Fc's from a GDB

I need to version n number of fc's which start with sde."ENT-QA". I need to select only those feature classes and run versioning for it. Can anyone help me in writing the query for selecting only fc's ...
8
votes
3answers
9k views

Define Workspace for SDE Connection in Python

How do we define SDE Connection for workspace in Python Scripting?
5
votes
1answer
444 views

Why does a TIF file lose projection information when a pixel value is changed?

I am trying to change the pixel value of a tif file (containing projection information) but after the pixel value is changed it is losing projection information. I am using the Python imaging ...
7
votes
2answers
3k views

How can I turn a shapefile into a mask and calculate the mean?

I have been using python to process huge arrays stored as netcdf files. I would like to calculate the mean of an area defined by a shapefile. I have just installed GDAL but if there are other tools I ...
8
votes
2answers
442 views

How to add different sized rasters in GDAL so the result is only in the intersected region

I'm writing a Python method that adds two rasters and generates a single raster output. For reasons beyond my control, the extents of the input rasters are different, but they do overlap. Is it ...
7
votes
3answers
1k views

How to determine on which side of a line a polygon feature falls?

I have parcel data intersecting line data. In the parcel data there are some parcels that don't intersect the line. How could I programmatically figure out if the non-intersecting parcel is on the ...
7
votes
1answer
734 views

Updating Fusion Table layers from csv files using python

I'm trying to use Python to take csv files and use them to update (or replace) tables in Fusion Tables. I found the "Python client library for Fusion Tables" on googles' site and downloaded them as ...
4
votes
2answers
5k views

How to sort a feature class and then calculate a sequential ID field?

I am in ArcMap and I want to sort the records based on a field and then do a Calculate Field with an auto-incrementing value with the sort in-place. Any ideas? It looks like I could get an update ...
5
votes
2answers
3k views

How to convert PostGIS table to Shapefile in Python?

I want to convert a PostGIS table into a shapefile (without using pgsql2shp). In order to create a geometry in the shapefile I have to give the Xmin,Ymin and Xmax,Ymax, and the geometry which I have ...
4
votes
1answer
2k views

Batch conversion of netCDF to Raster in ArcGIS using Python

I'm having trouble using the Dimension Values (Optional) argument in arcpy.MakeNetCDFRasterLayer_md. Whatever I seem to do the output raster is always the first layer which is the default value. ...