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

learn more… | top users | synonyms

3
votes
2answers
6k views

Using conditional statements in Field Calculator

I have two fields, "P_Area" and "PC_Area", whose sizes I'd like to compare in a third field, "Areas_Equal". The "Areas_Equal" field should contain a "Yes" if the other two are equal and a "No" if they ...
9
votes
7answers
2k views

how to overlay shapefile and raster?

I have a shapefile with polygons. And I have a global raster file. I want to overlay the shapefile's polygons onto the raster grid and calculate the mean raster value for each polygon. How can I do ...
2
votes
2answers
743 views

r.mapcalculator and python again

I've been trying to write a script creating binary maps: a=raw_input ("enter a threshold") b=float(a) grass.run_command('r.mapcalculator', formula="**'base_map'>=b**", outfile='map'+str(a), ...
3
votes
1answer
1k views

Sorting shapefile records on attribute to update new rank field using Python?

Basically, I am trying to sort the records within the shapefile based on an attribute(eg: pop) and then add a new field that indicates ranking based on the sort. eg: the record with the highest pop ...
2
votes
1answer
518 views

Removing duplicate features in PyQGIS

I'm trying to remove duplicate features from PyQGIS. Manually I can do it by using "Edit -> Merge Selected Features" and then "Multipart to Singlepart" from fTools in QGIS, but can this functionality ...
2
votes
2answers
173 views

Exposing ArcInfo level liscenses to ArcView desktops via ArcGIS Server and custom python script tool

I have a script that uses an ArcInfo level tool. The script works great on my machine but uses an ArcInfo level tool which the ArcView users don't have. Is exposing these ArcInfo level tools ...
2
votes
1answer
806 views

How do I change a raster's geotransform with GDAL?

I'm trying to use GDAL to set the geotransform of a new raster that I've created by following the steps outlined in the GDAL API Tutorial. # create the new dataset driver = ...
6
votes
1answer
806 views

How to attach GP script tools, standard tools, and Python script to a toolbar?

I need to build a custom toolbar that can launch the following items: A Python script tool - shouldn't be a problem, as you can already attach these to a toolbar Out of the box functions such as the ...
5
votes
3answers
5k views

ArcGIS 10 Python split string

I am trying to use Python to split a string field into three new fields at the separator " - ". The field is in the format "a - b - c". So I initially had this in the field calculator for newFieldA: ...
4
votes
1answer
873 views

Bing's geocoder with GeoPy not returning a zipcode

I'm just getting started with GeoPy and have been running some tests to determine the quality of the different available geocoders. I have noticed that Bing's geocoder is more accurate than Google's ...
3
votes
3answers
1k views

Tracking change with ArcSDE/Oracle

I'm looking for the simplest way to track changes ([delete, update, create] feature(s)) made to the DEFAULT version of a given feature class in ArcSDE(10) and Oracle(11g). Qualifier: I am not a dba ...
1
vote
1answer
3k views

ArcGIS Iterate Files tool in Model Builder

I want to use a "simple" iterator to process all the text files in a directory using my model but model builder won't let me connect the file to the first step of the model. Once I run the Iterate ...
5
votes
4answers
1k views

Spatial Query from PyQGIS?

Is it possible to reach the Spatial Query plugin functionality in QGIS from a Python script (PyQGIS)? If so, how do I accomplish this? Haven't found any documentation for it, even in the C++ API ...
2
votes
1answer
214 views

clipped data not going into the folder

I created a model in python that clips and converts different data sets into DWG based on the the grid number. I will like the DWG data (Output) to go into the folder I created as part of the ...
4
votes
1answer
752 views

Using ArcPy for Copy Parallel, Move, etc (from Editor toolbar)?

Since VB can activate the Editor, then use the tools listed in the Editor, such as copy parrallel, I am wondering whether Python can do the same job? I have been searching the website all day. Still ...
7
votes
1answer
1k views

Add layer to open mxd using ArcObjects from outside the map document crashes ArcMap

I have an Access database (MS Access 2010) that allows users to enter a variety of land treatment information including associated points, lines, or polygons which users can select and the database ...
1
vote
0answers
544 views

Large point to Polygon by buffer-join-buffer-dissolve issues

I have a few large datasets (about 10 million points) which I am buffering, then joining, dowgrading and finally buffering and dissolving. This is all in a model which works fine with sample smaller ...
2
votes
2answers
933 views

GDAL Clipping (hack)

I am trying to use the python script from http://www.sparkgeo.com/labs/2010/07/07/gdal-clipping-hack/ to clip a raster based on many shapefiles. The script is using a mysql database an i would like to ...
22
votes
5answers
2k views

OpenSource Remote Sensing Tools for Classifying Roofs

with envi image processing and classification tools, you can get roofs from images with some spectral value and then you can convert it some vector data for your app. in python with OpenCV which have ...
2
votes
2answers
882 views

create relationship class with stand alone python script

I have created a relationship class in arc catalog using the same arguments I'm using below, however if I try and create it using the script below I get: arcgisscripting.ExecuteError: ERROR ...
3
votes
4answers
9k views

Parse XML files in Python (ElementTree)

I am trying to parse some xml and rss feeds to extract some of their data in order to store it in a PostGIS database. The file I want to parse is here: ...
1
vote
0answers
192 views

ArcGIS 10.0 - How to have GP Service make rest calls instead of Silverlight client?

I have a Silverlight client that densifies a user drawn polyline. The returned vertices from the polyline are then sent to esri elevation sample server for each vertex to find an elevation value. ...
0
votes
1answer
709 views

Null output from field calculator code block

I have a simple calculation to compare two columns and populate a new column with the lower value but I am getting null output...any ideas? expression ...
3
votes
2answers
2k views

Error installing GDAL 1.9.0 python package

I'm trying to install the GDAL python package in a python 2.7.1 environment on RHEL 5. I am using the command 'pip install GDAL'. I have no problem installing other packages like numpy, etc. in this ...
27
votes
9answers
3k views

How to easily shift all features in a vector dataset?

Let's say that I put together a Shapefile and all the features have their vertices shifted by a constant amount. What's the easiest way of shifting all the features (hence the (x,y) position of their ...
1
vote
1answer
483 views

Merging OD Cost Distance Matrix result (ArcGIS 10 Network Analyst)

I've created small python script that calculates OD matrix between certain locations, i.e. not between each origin and destination but for each origin I have a set of destinations that I want to ...
0
votes
1answer
375 views

Generate a random 100x100 m bounding box in any projection in pure Python?

I'm given: Extend of WMS Layer SRS Now I want to, in standard 2.6 Python (no OGR or C lib dependencies), to generate a 100x100m random bounding box within that extent (assuming it is more than ...
1
vote
1answer
783 views

Dynamic Text in ArcMap 10.0 and arcpy - getting user name in specific format

I need to put in a specific text into a text element. The initials of the user who built the map. With arcpy I am trying to set the text element with dynamic text. If I put <dyn ...
1
vote
0answers
432 views

How do you convert a bounding box into the canvas CRS?

I need to convert the pixel coordinates of a bounding box to the same CRS being used by an existing layer. Here's the relevant code so far: # First, get the layer-coords version of the bounding box: ...
16
votes
2answers
4k views

How to find the angle between intersecting features in two featureclasses?

I have two intersecting line featureclasses. I want to find the angle at each point of intersection using ArcGIS 10 and Python. Can anyone help?
6
votes
2answers
1k views

Creating geodatabase from CSV using python

I have a file with weather data (daily) for multiple weather stations for multiple years. I am looking for some python script to automate the database creation process and its interpolation on a daily ...
9
votes
2answers
2k views

Error handling with python script in ArcGIS 10

I have a python script that I am using to create a list of all mxd files (with full pathing) in our Projects folder. The script then uses that to iterate through the list and do a ...
2
votes
2answers
1k views

With Python and ArcGIS, how do I add features to a featureclass?

In ArcGIS Python code: CopyFeatures_management copies features to the same featureclass - that means overwrite to the feature class. How can I add new features to one featureclass or namely different ...
8
votes
6answers
16k views

How to get X Y coordinates and cell value of each pixel in a raster using Python?

I’m really new to Python and I would like to know whether there is a quick method to get cell values of a raster pixel by pixel and the coordinates (map X Y coordinate of centre of each pixel) using ...
1
vote
0answers
135 views

Is Django's LayerMapping capable of putting a static value into all features?

I'm using GeoDjango's LayerMapping utility to try and import a set of features. The catch is that aside from the attributes in the source layer, I want all the destination features to have the same ...
0
votes
0answers
153 views

How to enable user to specify field mappings from a table joined to a feature class?

I have a feature class and a new table every few days. I need to have the table's attributes added to the feature class based on a join. What would be a good interface in ArcMap to let the user map ...
2
votes
2answers
1k views

Using newline/page break tag in ArcGIS Desktop Text_Element in arcpy.mapping? [duplicate]

I want to update a Text_Element with a newline or page break using ArcGIS Desktop 10.0. Does anyone know the tag or syntax?
5
votes
2answers
1k views

Python: How to export Shapely objects to DXF file

Using shapely package for Python how to export the resulting shapely objects such as buffer to a DXF file?
5
votes
3answers
5k views

Select Layer By Attribute using loop

I have 273 features in the feature class and i want to select them one by one and use the statement in the following code. At the line: *arcpy.SelectLayerByAttribute_management ...
5
votes
1answer
2k views

How to set QGIS Python path so that I can use system packages on Windows?

Several Python packages are best installed with a Windows installer. But those installers install to the system-wide Python directory. How do I set the Python path in QGIS? I tried setting PYTHONPATH ...
3
votes
1answer
475 views

Spatial Interpolation Methods like PRISM

I am looking for some kind of software (free software) that allows me to make an interpolation like PRISM software. The interpolation used in PRISM is a local regression and accounts for ...
10
votes
2answers
2k views

How do you delete an in-memory Table View?

In a Python script, I'm cycling through thousands of Excel files and using arcpy.MakeTableView to create in memory table views from the first spreadhseet in each file. How do you delete the reference ...
5
votes
3answers
434 views

QGIS Gazetteer query without adding data to canvas

I have a PostGIS database with 30 million gazetteer points, each have an X Y coordinate. I want to query this and then zoom map to location. However, I dont want to add the data to the project because ...
3
votes
2answers
8k views

select column in csv file in Python

I would like to study a range of data using the same technique in ArcMAP (it will take too much time to do it one by one ;) !). I've been just recently playing with ArcMAP and Python (which can help ...
7
votes
1answer
2k views

Python-arcpy : How make feature list from gdb and value list from field and use them in gaLayer function?

I'm not an expert in python, however I have to write a script to do geostatistical analyses with the GACreateLayer function from Arcgis. I have several data (>2000) and I want to use list of features ...
3
votes
1answer
263 views

Best Method for Validating polygons?

I would like to assess the spatial accuracy of a load of polygon shapefiles which are supposed to show air quality for a bunch of countries. Firstly I want to assess whether each shapefile has a ...
2
votes
2answers
304 views

Is code completion available in QGIS Python Console?

I wanted to know if the autofill functionality is available in the python console for QGIS as the one available in ArcGIS Desktop's Python Console or am I supposed to hardcode it.
1
vote
2answers
778 views

Resources for python scripting [duplicate]

Possible Duplicate: QGIS tutorials and resources I would like to know regarding the available resources for starting to learn about python scripting for QGIS.
1
vote
1answer
490 views

Gdal tiling error for EPSG: 3857

i have lots of data which was coordinated with gdal some programatic way at below: gdal_translate -of GTiff -a_ullr %s %s %s %s -a_srs EPSG:3857 %s/%s %s/%s.tif then for tiling them all i am ...
0
votes
0answers
273 views

Missing QGIS python plugin database connectors

I am working with python plugins for QGIS.I developed my plugin and inorder to incooperate the same into QGIS i copied the folder in C:\Documents and Settings\comp90\.qgis\python\plugins I opened ...