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

learn more… | top users | synonyms

8
votes
1answer
170 views

The role of '#' in a python 'if':

I recently exported an ArcGIS model to python and was reviewing the script and am confused by the following line: if TRU_W_DatableFeatures == '#' or not TRU_W_DatableFeatures: I can't seem to find ...
8
votes
4answers
1k views

How to split points by polygon?

I am looking for a way to split points by a county polygon feature class. The attached image shows two feature classes: one composed of points and the other a county polygon feature class. The split ...
8
votes
1answer
944 views

How to add a toolbar via python?

Through tutorials I learned how to add a toolbutton to the plugins-toolbar via python. Now I wonder how to add a complete toolbar with toolbarbuttons via python. Can anybody give some example-code? ...
8
votes
6answers
888 views

How do I generate thumbnails images from lots of shapefiles?

A colleague and I recently released an Open Source project called Mapoteca which is a set of Python Scripts that integrates with a GDAL/FWTools installation allowing a full walk-through of directories ...
8
votes
5answers
5k views

update one shapefile attribute table with values from another dbf table

I try to explain here what I am trying to do: I have one shapefile and one independent dbf table with the same fields. In the dbf table all the fields are populated but in the shapefile attribute ...
8
votes
1answer
2k views

GDAL/Python: How do I get coordinate system name from SpatialReference?

In Python, using GDAL, I've extracted a raster's projection as a WKT string as follows: wkt = dataset.GetProjection() # wkt is ...
8
votes
2answers
3k views

How can I iterate over map layers in QGIS python

I'm having trouble figuring out how to iterate over map layers. I can access the currently highlighted layer in the table of contents via iface.activeLayer() but I want my code to operate on all ...
8
votes
1answer
3k views

Problem with setValue() function in ArcGIS 10

I'm trying to add data to an attribute table in ArcGIS 10 using the following code: def make_floor_no( shapefile ): "Makes header for number of Floors (FLO) and calculates value" fieldName = ...
8
votes
1answer
1k views

concurrent use of in_memory workspace in arcpy

i am using a python script that's eliminating small polygons from a feature class. this script creates temporary feature classes with fixed (hardcoded) names in the "in_memory" workspace. example: ...
8
votes
2answers
2k views

How to Rotate Features in ArcGIS for Desktop using ArcPy?

I have a series of polygons that I want to rotate. Each polygon has a rotate angle and an anchor point (xy coordinate) stored as field values. As it happens, all anchor points are on a vertex of ...
8
votes
3answers
947 views

How to get full path of layer selected in drop-down box for ArcGIS Python tool

I have a Python script-based tool in ArcGIS. One of the parameters for the tool is an input raster file, which I've set (using the properties of the tool within the toolbox) to be a Raster Layer. This ...
8
votes
3answers
797 views

Are there any training resources in SQL and Python as applied to GIS database management?

I've taken ESRI database courses, which have been helpful to my work. But I also need training in SQL and Python as applied to GIS database management. Any suggestions?
8
votes
2answers
176 views

Feeder bus service

First of all, a little background. I work for a regional transit agency. We are making a "diagnostic" about our feeder bus service. We'd like to know what proportion of our users could take the bus ...
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 ...
8
votes
1answer
271 views

Python with GDAL and PostGIS as a replacement of ArcGIS

Few times ago, I worked with daily land surface temperature satellite images of an area with the size of Alaska. I had to process around one thousand images. I downloaded them, mosaiced, projected, ...
8
votes
1answer
1k views

How to make a new raster using con() script in Python?

I'm new to Python and have been trying to code a raster calculator style script. Basically, I want to convert a raster that has values 0 to -10,000 into a raster that is populated by 1s between ...
8
votes
1answer
2k views

GDAL RasterizeLayer Doesn't Burn All Polygons to Raster

I am trying to burn a shapefile to a raster using GDAL's RasterizeLayer. I pre-create an area of interest raster from a different shapefile, given a specific pixel size. This AOI then serves as a base ...
8
votes
1answer
341 views

Running ArcGIS 10.0 Under Virtualenv

I am working on a Python package that has a mixture of command line tools and ArcToolbox tools. For Python development it is really useful to use VirtualEnv, especially when working with installers. ...
8
votes
1answer
187 views

Difference between python window and toolbox

Are there differences in performance or other potentially critical area between running a python script in the python window versus running it from the toolbox in ArcGIS 10.0? I am asking in cases ...
8
votes
2answers
531 views

What are mystery green lines in Layout View produced during ArcObjects script execution?

Could any of ArcObjects guru tell me, what are these green lines on my Page Layout and what to do, or not to do, so they do not appear? See image attached. I do used ArcObjects from Python. My script ...
8
votes
1answer
446 views

How to split two interscting polygons by the average linestring of the shared area (QGIS / python shapely)

I have two polygons, POLYGON((-5 -5,-5 5,5 5,5 -5,-5 -5)) POLYGON((1 1, 1 7, 7 7, 7 1, 1 1)) and wish to split them evenly. The result should be a split along the red marked line. I'm using ...
8
votes
1answer
3k views

How do I maintain a resposive GUI using QThread with PyQGIS

I have been developing some batch processing tools as python plugins for QGIS 1.8. I have found that while my tools are running the GUI becomes non-responsive. The general wisdom is that the work ...
8
votes
2answers
501 views

Python script to read CAD data to find polygon extents

I have Civil 3D 2012 with ArcGIS for AutoCAD 300. I want to read the extents of a polygon in the drawing. Feature Class in A4A300 = Boundaries, the CAD layer is PROP-BNDY, there is only one polygon on ...
8
votes
1answer
150 views

QGIS - Calling interpolation extension from python console

I would like to call the QGIS interpolation extension function (TIN method) (Raster->Interpolate) from python console. I can't find the corresponding function within QGIS API or within the ...
8
votes
5answers
423 views

How to set ArcGIS for Desktop license to lower level for testing whether Python script still runs?

I have a Python script that will need to be given to a client. We are currently evaluating what license level the client will need in order to run the script for their software acquisition purposes. ...
8
votes
2answers
532 views

How to remove spikes in polygons with ArcGIS 10/Python?

In the picture below you can see a polygon layer, representing steep slopes, extracted from a TIN. The polygons have a lot of spikes in them. I would like to remove these spikes while the rest of the ...
8
votes
2answers
1k views

How to buffer a vector shapefile using ogr python?

I am trying to learn how to use ogr in python using the country and populated places datasets from http://www.naturalearthdata.com/downloads/50m-cultural-vectors/. I am attempting to use filters and ...
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 ...
8
votes
0answers
339 views

Two machines running the same arcpy based software - only one is leaking memory [closed]

Ok, so I'm running a rather large Python application based on arcpy on two separate machines - one of them is leaking memory and one is not. Both are running the same operation in the software. The ...
8
votes
0answers
373 views

Using a different Python IDE/debugger for ArcGIS [duplicate]

Possible Duplicate: How can I effectively debug arcpy Python scripts? I prefer to use PyScripter over IDLE as my IDE/debugger for writing GP scripts in Python. In ArcGIS, however, when I ...
7
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 ...
7
votes
3answers
1k views

How to extract the number of vertices in each polygon?

I have ArcGIS Desktop 10.2 and my challenge is how to extract the of number vertices in each polygon for all features like this: I have many parcels in my feature class and I want to extract ...
7
votes
6answers
15k 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 ...
7
votes
2answers
3k views

Generating GeoJSON with Python

Hi I want to programatically create a GeoJSON file using polygons from a shapefile but adding attributes from my own application. This is easily done for a shapefile: def ...
7
votes
5answers
3k views

How to workaround large mosaic process which is failing?

I need to mosaic about 550Gb of tif imagery together and the software I have tried keeps failing. The area has been split into zones so that the smallest has approx 200 tiles. I have used the latest ...
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 ...
7
votes
3answers
5k views

How to include variable in where clause of arcpy.Select_analysis?

I am trying to loop through a shapefile, selecting each feature in turn and copying it to a temporary shapefile to by included in a union analysis. I'm using a cursor to find the ID name for each ...
7
votes
2answers
4k views

Basic Field Calculator Python Question

I'm trying to used the Python syntax in ArcGIS 10's field calculator and am thoroughly confused. So far the most basic calculations are failing me, and I don't understand why. I'm trying to create a ...
7
votes
2answers
1k views

How to access Esri ArcPy modules from Enthought Canopy?

I have ArcGIS 10.1 running on my windows system and I have also installed the new 32-bit Canopy Express Enthought Python Distribution. Is it possible to load and use the Esri ArcPy modules from ...
7
votes
5answers
664 views

python.multiprocessing and “FATAL ERROR (INFADI) MISSING DIRECTORY”

While trying to do multiprocessing with arcpy, I am occasionally running into this error: FATAL ERROR (INFADI) MISSING DIRECTORY I have no clue what is triggering this error, and it crashes the ...
7
votes
6answers
4k views

How can I calculate the orientation of each side of a polygon in ArcGIS 10?

I want to examine the orientation of each line in a polygon so that I can calculate their solar exposure. Each polygon represents a building, and has an associated height. For the moment, I just want ...
7
votes
3answers
3k views

Problems setting up eclipse (with PyDev) for ArcGIS 10

I'm trying to use eclipse with PyDev to program in python. In Windows 7 x64, I've added a PATH environmental variable (PATH C:\Python26\ArcGIS10.0\python.exe;) and what I thought were the relevant ...
7
votes
3answers
2k views

GDAL and Python: How to get coordinates for all cells having a specific value?

I've got an Arc/Info Binary Grid---specifically, an ArcGIS flow accumulation raster---and I'd like to identify all cells having a specific value (or in a range of values). Ultimately, I'd like a ...
7
votes
2answers
3k views

How to create a checkbox parameter in a ArcGIS custom Python tool?

I am working on creating an ArcGIS tool from a Python script I am writing. I am wondering if it is possible to have a checkbox parameter. Basically what I want to do is have a parameter where the ...
7
votes
2answers
1k views

selecting by attribute and specific value replace

I want to select all of the features by attribute where the attribue in myattrib is like... Selection "criteria H". That is not a problem. However then I need to replace (myattrib," H", "") except ...
7
votes
1answer
311 views

Difference between Make Feature Layer (Data Management) and using in_memory workspace?

I was wondering the difference is between Make Feature Layer (Data Management) and using an in_memory workspace? To me, one can use either to do some steps in memory, instead of writing data to a ...
7
votes
1answer
214 views

Is Python essential for working in QGIS?

I am a beginner in QGIS. I Generally have a doubt: to work in QGIS is it necessary to know Python? whether i am asking we should know to write python programs to make certain modules run?
7
votes
3answers
446 views

How to count the number of lines connected to a point?

I have a water network which and I need to install elbows and Tees (T). When 2 lines connect to a point, I want to install an elbow, when 3 lines connect, I want to install a Tee. How do I get ...
7
votes
2answers
215 views

Finding specific pixel values ​​in ArcGIS using Python

I have a raster file containing some integer values. I need to find all pixels whose values are not defined in list like this one: l = [1,2,4,8,16,32,64,128]. Is there any easy way to solve that ...
7
votes
2answers
443 views

How to create a solar intensity map for a garden plot?

I'm interested in creating a raster surface that depicts the average solar intensity per unit area for a small garden plot. I imagine the inputs into the model would be the following: Plot ...