Python is an open source interpreted programming language used in many GIS programs.
9
votes
2answers
466 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 ...
9
votes
3answers
2k views
Setting parameters in Script Tool using Python
I hate to bug you all with the same problem over and over again but I run into a new problem everytime I make a slight change to the code. All I did to the code below was to replace field names to ...
9
votes
2answers
335 views
Gdal Dataset.ReadAsArray() crashes Python
I am using Python 2.6.5 (32bit) with Numpy 1.3 and Gdal 1.9.1 installed on Windows 7 64bit. I am trying to read an 800 MB Imagine (.img) raster dataset into a Numpy array to do some raster algebra, ...
9
votes
1answer
225 views
OGR/GDAL threading results in low core utilization
I'm trying to process some raster data using ogr/gdal and I can't seem to get full utilization of all the cores on my machine. When I only run the process on a single core, I get 100% utilization of ...
9
votes
2answers
608 views
How to call gdal_translate from Python code?
Is it possible to use some gdal API to call gdal_translate from Python code? I do not mean simply executing the gdal_translate.py from the file system, but rather call it somehow in code so I do not ...
9
votes
1answer
441 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 ...
9
votes
1answer
354 views
Arcmap Select by Attribute with Python
I would like the following to select (highlight) the "project" layer that intersects the grid, and then pull a record from the selected "Grid". I do not need to save the layer.
Note: Running the ...
9
votes
1answer
479 views
How to implement MultiValue Parameter with Multiple Columns?
This might be a simple question, but I haven't been able to find a straightforward answer.
I'm working on an ArcGIS (9.3) Python script. One of the inputs is a list of features. For each feature, I ...
8
votes
3answers
1k views
How do I use variables from one Python script in other Python scripts?
I want to set up a single python file containing variables that have the locations of all my data sources. This would then be used by all my other scripts, then as a data source changes, I only have ...
8
votes
4answers
171 views
Subset Folder Contents ArcPy
I have about 1500 .txt files within a folder named 3410001ne => 3809962sw. I need to subset about 470 of these files to process with a Python script. Below is the section of code prior to my for ...
8
votes
7answers
4k views
How to get raster image as array in Python with ArcGIS
When starting to work with Python and ArcGIS 9.3, I assumed there would be a simple way to get a raster image into a Python array so that I can manipulate it before storing it back as another raster ...
8
votes
5answers
797 views
Who uses FME Python extension and how?
I saw a great interface to FME with Python there
What you guys are doing with it? I want ideas.
8
votes
2answers
291 views
Why is this simple arcpy script so painfully slow?
I have a simple arcpy script to update a field in a point shapefile with info from the polygon feature that it is within. It takes 9 minutes to do 100 points in arcpy but a spatial join in arcmap is ...
8
votes
3answers
1k 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.
...
8
votes
2answers
276 views
How to bypass errors in arcpy for/while loop?
I have a handy script tool that loops through a workspace and renames and copies shapefiles to a feature dataset. However, if there is a corrupted shapefile somewhere in the workspace the script ...
8
votes
3answers
2k views
How to find the locations of the highest values in a raster?
Using ArcGIS 10, I have a raster where I would like to find the pixel with the maximum value in the raster and return its location (center of pixel) in decimal degrees. I would like to iterate through ...
8
votes
3answers
4k 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.
8
votes
4answers
1k views
Best way to find the polygons crossed by a line
I'm trying to find all the polygons crossed by a single line (a GPS track).
I'm using the OGR library (from python) for computing this, but it's currently a bit 'brute-force' (and slow). For every ...
8
votes
4answers
845 views
Is there a mapping between OGR and python data types?
I'm writing a shapefile using OGR in python, creating fields on-the-fly from a python data source. Creation of a new field requires an OGR data type, is there a mapping between OGR and python data ...
8
votes
5answers
1k views
Will there be a Python API for ArcGIS Server?
It seems like an obvious next step given the big push towards Python in ArcGIS Desktop at 10.0. Are there any limitations of Python compared to javascript, flex, etc that would prevent ESRI from ...
8
votes
3answers
151 views
Is there a way to tell the geodatabase version using Python?
I want to find out if either a file or personal geodatabase is 9.3, 10.0, 10.1, etc
Is there a way to do this using Python?
8
votes
2answers
619 views
ArcMap running scripts slower if you import Arcpy
I am finding ArcMap runs slower, if you have written a script, which imports arcpy.
You may wish to write a script that can be operated in ArcMap, through the python window, or as a standalone ...
8
votes
3answers
1k views
Looking for a pythonic way to calculate the length of a WKT linestring
I was quite unsatisfied with Calculating Length of Linestrings in WGS84 in Miles. It kept me wondering if there is a more convenient, Pythonic way to calculate the length of a WKT linestring according ...
8
votes
1answer
214 views
Fastest methods for modifying attribute tables with Python?
A while ago, I wrote a quick Python function for converting an attribute table to a python dictionary, where the key is taken from a user-specified unique ID field (typically the OID field). ...
8
votes
3answers
2k 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
1answer
762 views
Polygon overlay with Shapely
I'm trying to capture all the non-overlapping polygons indicated below using Shapely (given polygons A,B & C). Moreover, I'm hoping to do so without iteration, testing for intersect etc. The ...
8
votes
3answers
6k views
How to create a button in Arcmap 10 to run a Python program?
I have a script that I want to run within ArcMap when a button in a toolbar is clicked, and so far I have only been able to make the script into a script tool. I need it to run as a command, not as a ...
8
votes
1answer
140 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
6answers
700 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
3answers
4k views
How to change feature class and field aliases in bulk?
I have over a hundred FCs, each with 10 or 20 attributes to add or change the aliases for, two or more times a year. Needless to say, this is not something I'm going to grunt my way through. How can I ...
8
votes
1answer
4k views
How to create a script tool that will create a copy of a feature class and offset it by a given distance? (arcpy)
I want to duplicate a polygon feature class and offset all of the polygons by about 10 feet in both the x and y directions. I asked if there was any way to do this last week, and I was informed that I ...
8
votes
1answer
509 views
How do I get the pixel value of a GDAL raster under an OGR point without NumPy?
I am working on a computational model of the abundance of wild pollinators across a landscape. The model itself is complete, and I am now struggling with a post-processing step.
I have my GDAL ...
8
votes
1answer
2k 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
5answers
467 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
187 views
Is there a way to properly have GDAL raise exceptions in Python?
I am working with GDAL in Python and have wanted to get GDAL to raise exceptions so that I can do something useful with them. For instance if a file cannot be opened with gdal.Open() I would like to ...
8
votes
1answer
281 views
How to integrate eclipse (PyDev) with Python Add-In development (ArcGIS 10.1)?
In ArcGIS 10.1, Python Add-Ins make various buttons, toolbars, extensions, etc, available to those already familiar with Python and OO in general. I am in the process of developing a Python Add-In and ...
8
votes
3answers
645 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
1answer
2k views
“Field Mapping” in ArcGIS 10 - ArcPy
I've wrote a Python script that does a spatial join and some simple calculations. My problem is with setting the merge rule for one specific field, and leaving the rest of the fields as is. For ...
8
votes
3answers
3k views
Bilinear interpolation of point data on a raster in Python?
I have a raster that I'd like to do some point interpolations with. Here is where I'm at:
from osgeo import gdal
from numpy import array
# Read raster
source = gdal.Open('my_raster.tif')
nx, ny = ...
8
votes
1answer
321 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
338 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
2answers
263 views
Generate near table for x number of neighbours using arcpy
There are 3 likely scenerios that I am trying to capture near distances for:
An interchange subway station, which has 2 or more neighboring stations. That is, the station in question connects 2 or ...
8
votes
2answers
137 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
213 views
How to find differences between shapefiles?
Every month I have to QA/QC some streets data for an entire county (over 47,000 records). The first step is to compare the two files. Currently, I'm using a tool that was created in house via VBA ...
8
votes
3answers
1k 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 ...
8
votes
2answers
398 views
Scriptable alternative to ArcScan (particularly vectorising lines within tolerances)
Sadly the answer to this question suggests that it is not possible to script ArcScan from within a python script.
Therefore, does anyone know of any alternatives to ArcScan (either within ArcGIS, or ...
8
votes
0answers
355 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
4answers
1k views
how can i convert a shapefile to lat and lon boundaries?
i have a shapefile of country subdivisions and i would like to extract an array of bounding lat and lon for each division.. is it possible to do?
7
votes
4answers
2k views
How to develop GUI in Python for geoprocessing?
I want to develop GUI in Python for geoprocessing, but I don't know what is the best GUI tool or library (Tkinter, PyQT, wxPython) for geoprocessing? Can I use PyQT for GUI programming in ArcGIS?
7
votes
3answers
6k 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.



