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

learn more… | top users | synonyms

8
votes
1answer
909 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
2answers
412 views

Best design for Open Source Python / PostGIS prototype

I am writing a data intensive web application that is delivered through apache. My question is about how to best arrange processing given that there are multiple options. I have at my disposal ...
8
votes
1answer
957 views

Importing GDAL from Python window of ArcGIS for Desktop?

I am trying to run some Python code using the Python window in ArcGIS 10.1 that uses both the arcpy and gdal modules. However, when I try and import the gdal module I get an error: ImportError: No ...
8
votes
1answer
322 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
164 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
474 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
376 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
2answers
434 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
5answers
261 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
436 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
325 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
368 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
7answers
13k views

Full list of ISO ALPHA-2 and ISO ALPHA-3 country codes

I'm searching for a full list of countries with their country codes. Like on this page (need full and valid): http://www.nationsonline.org/oneworld/country_code_list.htm Thanks.
7
votes
3answers
599 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
13k 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
2k views

How to read an Excel sheet in ArcPy script

I'm writing a python code to convert X,Y points in excel to shapefile. In this process i have toread xy points from shhet1. What is the step i have to include in my process to read data from sheet1 of ...
7
votes
2answers
2k 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
4answers
2k 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
4k 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
5answers
3k views

Large mosaic process failing - what are the options? software independent only focussed on result

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
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
5answers
624 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
1answer
1k views

How to create sidebar help information for custom arcgis script tools?

I have been creating custom gis tools with python via the arcpy module. I can set up the tool successfully with parameters and all, but I cannot figure out how to create help text that shows up on ...
7
votes
3answers
1k 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
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
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
1answer
148 views

How to save python session in QGIS?

After running a lot of scripts in QGIS' python console, I have more than 10 dictionaries and lists, and I need these for further analysis. Is there a way to save python session, with all these ...
7
votes
7answers
6k views

How to Remove return/newline (\n) character from Field using Python and Field Calculator?

I have a geodatabase table with a field that I'm trying to remove return characters (new line). I found this post (How can I remove (chomp) a newline in Python?) of how to do it, however it is not ...
7
votes
2answers
3k views

How to fully load a raster into a numpy array?

I have been trying to check my filters on DEM raster for pattern recognition and it is always resulting in missing last rows and columns(like..20). I have tried with PIL library, image load. Then with ...
7
votes
2answers
2k 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
3answers
328 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
198 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
393 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 ...
7
votes
1answer
1k views

How to perform a table look-up using Python in ArcGIS 10.0?

Using ArcGIS 10.1 the arcpy module has a TableToNumPyArray command, which converts a table into an array. Unfortunately I don't have access to 10.1 on my work PC. Is there a workaround which will ...
7
votes
2answers
819 views

Process a raster with multiple geoprocessing tools in arcgis 10 using python - flow between processes

I'm writing a short python script that includes processing rasters with different geoprocessing tools in ArcGis 10, for example, the three processes below, is this best way to use multiple tools ...
7
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 ...
7
votes
1answer
801 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? ...
7
votes
4answers
744 views

Visualization of satellite image - directly in python

Is there any way (a package or what not), to visualize a geotiff image directly in Python? I don't want to use ENVI or ArcGIS or anything else. Thank you in advance.
7
votes
3answers
948 views

Use Esri Geoservices REST as backend for Python web framework (Django?)

I would like to know if it's feasible to use an existing Python web framework such as Django/GeoDjango as a frontend to work with Esri's Geoservices REST API? I envision developing a database engine ...
7
votes
3answers
2k views

How to create a circle in arcpy

Suppose I have a dataset where each record has an x,y and r (the centroid and radius of a circle). How can I create a polygon feature class containing parametric circles? Sorry to those who have a ...
7
votes
2answers
453 views

Autoincrement field when New Feature added

I know that this is probably a very basic programming but I am brand new to Python. I have a layer in a geodatabase that I need a unique ID field (for joining). I can't use the ObjectID because that ...
7
votes
1answer
867 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: ...
7
votes
1answer
383 views

Reduce extent of raster processing

I need to reduce the processing extent of my raster by some sort of automatic procedure in python. Currently the borders of the dataset I've been using has anomalies (due to the classification of the ...
7
votes
1answer
944 views

How can I auto-increment output file-names in Toolbox ESRI ArcMap 10

I have a simple tool which outputs a file. I would like the filename to be a number which increments every time the tool is run. How would I go about implementing this using the toolbox in ESRI ...
7
votes
3answers
870 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 ...