Tagged Questions

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

learn more… | top users | synonyms

7
votes
1answer
994 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
754 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
726 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
345 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
3k 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
368 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
410 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
489 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
928 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
442 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
2k 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
440 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
733 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. ...
13
votes
3answers
5k views

Clipping raster with vector layer using GDAL

I have installed GDAL using the Osgeo installer. How can I clip a raster layer with a vector layer programmatically? Is there any GDAL API available which can help me with this? I am using Python.
8
votes
2answers
150 views

File naming for Enterprise GIS database?

I'm designing the guidelines for an Enterprise GIS database. Part of this database will include customized geoprocessing tools using a variety of software. I'm interested in knowing whether anyone ...
0
votes
1answer
958 views

How to use variable field name in arcpy.SearchCursor?

I have code that says fld = fieldName rows = arcpy.SearchCursor(fc) for row in rows: x = row.fld How do I use a variable for my field name in python ArcGIS 10 on windows? Thanks.
1
vote
1answer
593 views

How to change the the style of a vector layer programmatically?

I want to change the style of the polygon contained in the vector layer. Is there any API available? (I can click the properties of the shapefile, then select the style and change the symbol ...
6
votes
2answers
3k views

Converting from DMS to DD using Python in Field Calculator?

I need to convert lat/long that is expressed as degrees, minutes, and seconds in the data into decimal degrees. For example, in the data, they are listed as N335042.06 in the Latitude column, and ...
9
votes
1answer
903 views

Arcobjects in Python: assign interface to objects with feature (shape) geometry

I am trying to use ArcObject in Python. I do have problem with assigning an interface (i.e. IZ.InterpolateZsBetween) to my object with geometry data, code is: from Comtypes.client import ...
12
votes
5answers
6k views

Obtaining extent of each polygon in shapefile?

In arcgis 10 and python I want to get the extent (xmax, ymax, xmin, ymin) info of each of the polygons in a shape file. I can get the extent of the whole shape file using ...
13
votes
4answers
1k views

Python module to delete SHP features (without Desktop GIS installed)

I have a piece of software (not Arc) that runs nightly on a non-production machine which updates shapefile features from an external database. Periodically I would like to delete all of the features ...
9
votes
2answers
745 views

GeoTIFFs made in GDAL don't have min/max range when loaded in Arc/QGIS

I'm creating some floating point rasters in GDAL with the GeoTIFF driver. When I load the resulting images into QGIS or Arc the default symbology puts the min at -3.40282e38 and max to 3.40282e38, so ...
4
votes
1answer
376 views

automating forest cover calculations with Python

I have a layer of forest cover comprising ~ 30,000 individual forest patches, and I need to calculate the amount of forest cover within a 5 km buffer of each patch. The buffers all overlap each other, ...
5
votes
1answer
1k views

Arcmap: save all layers in Table of Contents to layer files

Using python, how can one save all layers in the Arcmap (v10) table of contents pane to layer files on disk?
3
votes
1answer
162 views

Anyone have a link for IN-DEPTH ArcGIS Toolbox documentation

I am looking for in-depth links for docs on parameter datatypes for adding custom scripts to a custom toolbox. For example, a parameter data type "Extract Values". What does this do? What config ...
9
votes
2answers
5k views

How to list feature classes in multiple geodatabases in a folder?

I have a folder with numerous geodatabases in it. Within the geodatabases are feature classes. I would like to get a list of the feature classes in these geodatabases using a Python script. I've only ...
2
votes
2answers
2k views

How to automate point-in-polygon queries in ArcView?

Layer1 = point shapefile (multiple points, geocoded) Layer2 = polygon (1 attribute; (1,2,3...)) I want a non-gis person to be able input a single address and be told the attribute of the polygon ...
5
votes
1answer
379 views

How to restrict or block certain paths in NetworkX graphs?

I am trying to calculate shortest path between 2 points using Dijkstra and A Star algorithms (in a directed NetworkX graph). At the moment it works fine and I can see the calculated path but I would ...
4
votes
1answer
2k views

How to convert state name abbreviations to full names?

I have a data table with columns that includes city names (ex: San Jose) and state name abbreviations (ex: CA). Is there a way to define the state names as their full names (i.e., CA = California) and ...
4
votes
1answer
386 views

How to write code for downloading a file in ArcGIS 10?

I have an offline database which has lat & long coordinates. The functionality I need to provide is to have a (latitude, longitude) point which will have country and city in it. Once the user has ...
6
votes
2answers
4k views

How to calculate a field in ArcGIS using Python?

I'm trying to calculate a field based on the values of others in the same layer in a calculation. I can't work out why its not working. I've even cut everything down to just be based on one field and ...
2
votes
1answer
409 views

IZ.InterpolateZsBetween, how to use it for multiple parts in polyline

I want to interpolate Z values for the vertexes in the polyline. Shape file contains few polylines. Polylines do have certain vertexes with correct Z value, others do not have Z value (set to ie. 0). ...