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

learn more… | top users | synonyms

4
votes
1answer
444 views

How to deal with direction (CW, CCW) of circles, in particular with shapely?

I am translating an input that describes zones by mixing segments and arcs. Arcs are given by a center, 2 points (beginning/end of arc) and a direction (CW or CCW). In a first prototypes using GDAL, I ...
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 ...
4
votes
2answers
2k views

Programmatically alter AliasName for fields defined in layer file (not underlying source)

Is there a way to alter the AliasName on a layer file only, and not the underlying shapefile or feature class? I have a few hundred layers that define joins between hundreds of tables with census data ...
7
votes
4answers
3k views

How to remove numeric characters from alphanumeric value in field calculation?

I have a field containing alphanumeric values in the following format: A-AA00 Sometimes they are also A-AAA0 I need a Python script I can put in the field calculator in ArcMap 10 that will at ...
4
votes
1answer
3k views

Find and Replace expression needed in Field Calculator ArcGIS 10

Looking for the Field Calculator code (Python preferred) to replace the last numeral values in a field using another field's values for entire attribute table. Please see screen shot here:
5
votes
1answer
1k views

How to use QGIS Time Manager sample data?

I've downloaded the Time Manager plugin for QGIS for Windows, version 1.7.1. I'm not sure whether I should really be asking a question on here, but since there doesn't seem to be an issue tracker on ...
1
vote
1answer
572 views

How to refresh QgsMapcanvas?

I am using Qgis 1.7 and I want to refresh the mapcanvas so I am using refresh() function of QgsMapcanvas class and Nothing is happening to the Map Canvas. I am using Python for customizing
9
votes
2answers
3k views

Measuring distance in spherical Mercator vs zoned UTM

I've got points in WGS84 lat/long and I'd like to measure "small" (less than say 5km) distances between them. I can use the haversine formula from http://www.movable-type.co.uk/scripts/latlong.html ...
1
vote
1answer
286 views

How to correctly use cursor.execute() with PostGIS?

I do not understand how the operator works some times... Here is an example that works, "SELECT ST_Distance(ST_GeomFromText('POINT(-3.16496271127842 ...
8
votes
3answers
4k views

How to round a column in attribute table (ArcMap)

I want to use the Field Calculator in ArcMap to round an existing column to two decimals. Currently I have a column that is 6 decimal places long and would like to simply round it down to 2 decimals. ...
3
votes
1answer
752 views

Interpolate undulations for given points using a geoid model

I have two databases, the first one (F.tsj) contains gps points: coordinates and ellipsoid heights and the second one is simply a geoid model where every line stores latitude, longitude, and ...
4
votes
2answers
373 views

How to run an external exe in ArcGIS Python?

I need help with one question. I would like to run an external executable written in fortran which provides one of the inputs inside a python code. Is it possible to run that exe inside python script? ...
4
votes
2answers
588 views

Update Multiple Metadata Tags at Once

ArcGIS 10 SP3 Hello! I have read the other posts in this forum about updating metadata programmatically, and have examined Esri's help topics regarding xslt stylesheets to update metadata, but am ...
1
vote
1answer
450 views

Copying and renaming files on SDE connection

I have a script that renames and copies files (feature classes) on an SDE connection. This script works just fine if the feature class name does not start with an 'S'. If the feature class name does ...
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 ...
3
votes
1answer
984 views

Buffer Selected Line Segments Using ArcGIS 10 or Python

I haven't quite found a solution for buffering selected line segments of a road network without extporting the selected line segments to a new file and then buffering. I want to avoid creating a ...
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 ...
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
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
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 ...
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 ...
11
votes
1answer
655 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 ...
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, ...
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 ...
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. ...
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 ...
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 = ...
7
votes
1answer
1k views

Help with PostGIS polygon geometry - non-closed rings

I've picked up a copy of the super-wicked book 'Python Geospatial Development' by Erik Westra (Amazon link), and I'm working through it. Currently, it's teaching me to load GSHHS coastline data from a ...
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 ...
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 ...
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 ...
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" ...
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 ...
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 ...
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 ...
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.
9
votes
3answers
2k views

ArcGIS Python Tool - Importing Custom Script Into ToolValidator Class

I had posted a question last week about customizing a ToolValidator class and got some very good answers. In working with the proposed solutions, I have created a custom module that performs queries ...
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 ...
3
votes
1answer
440 views

Disaggregating multiring polygon for editing, then recombining

BUMP? We have many rows of multi-ring polygons, displayed on a Flex front end. We need to be able to select a polygon (a row), split the rings for editing, edit them, then combine into one polygon ...
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 ...
9
votes
3answers
8k views

How to create a shapefile in ArcGIS 10 using arcpy?

How can I create a shapefile using Python in ArcGIS 10? I have lat & long. From this I need Python code which will create a shapefile and display it in ArcGIS 10. Thanks.
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 ...
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 ...
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, ...
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
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 ...
9
votes
2answers
748 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 ...
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 ...
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 ...