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

learn more… | top users | synonyms

6
votes
2answers
2k views

Are there any Python scripts for creating .mxd files?

I am a newbie to both ArcGIS and Python. My requirement is to automate the below MANUAL process: Creating a layer in ArcGIS for Desktop. To put it in another words, creating an ArcMap document ...
4
votes
2answers
675 views

What's the best projection for rasterization of random latitude and longitude data in the northern Atlantic?

I have a dataset in the WGS84 geographic coordinate system that I would like to interpolate along a grid using Python. It appears gdal_grid is not available through the Python bindings, so I plan to ...
6
votes
1answer
1k views

ArcPy script causing python.exe to stop working (memory issue?)

I have a script written in Python that uses ArcPy to create maps of the kernel densities of thousands of datasets. Each dataset is relatively small, but there about 50,000 sets in total. When I run ...
3
votes
3answers
1k views

How do I apply Dijkstra's algorithm in Python with PostGIS data?

I have currently parsed OSM data, from a PBF file, into a pgRouting database with the use of osm2po, an excellent parsing tool. I don't however want to use the algorithms provided by pgRouting and ...
1
vote
0answers
150 views

Is there an inbuilt arcpy method to insert a new line? [duplicate]

I need to extract a list of all the files and folders within a top level folder. My first thought was to use os.walk in a small python script as it is a simple task. However, I cannot run scripts on ...
3
votes
1answer
2k views

How to install SciPy for QGIS Standalone [closed]

A number of QGIS plugins require the Python package SciPy to be installed. This package is available using the OSGeo4W package based installer or precompiled for Windows, but is not provided as part ...
4
votes
1answer
1k views

Interpolating Maps - Statistical Learning Techniques vs Spatial Statistics Techniques

I have recently begun experimenting with the interpolation of variales over a whole country. I have good sized training set where I have several dependant variables (continuous and categorical) ...
7
votes
2answers
3k views

Installing ArcGIS for Desktop with existing ActivePython install?

I just did a clean OS install and installed ActivePython 2.7.2 I want to use this Python install for use with ArcGIS 10.1 I just installed ArcGIS 10.1 and it did a new Python install. What do I ...
3
votes
0answers
385 views

Importing matplotlib basemap and shapely

I'm not sure if this is the right place to ask this, but here we go. I have a python script that uses matplotlib's basemap and another part that uses shapely to do an intersection of 2 polygons. If ...
1
vote
1answer
70 views

Compare features attribute

I have a polygn layer and each polygon has the MEAN elevation as an attribute. I want to write a python script to select each polygon and compare its elevation with its neighbouring polygons and store ...
5
votes
2answers
476 views

SelectLayerByLocation not Selecting

I have been trying for some time now to create a script to extract the polygons within an extent, but am unable to get the same result as when I use the user interface manual method. Maybe someone ...
2
votes
1answer
115 views

What is causing sr.lock on tables after looping?

The following code puts an sr.lock on each table in my List. What’s causing my tables to lock up? I understand my script is reading or opening my tables temporarily to perform the ...
2
votes
1answer
705 views

Using Python in the Field Calculator, how do I refer to a field in another shapefile?

I want to compare the changes in geometry between two shapefiles (of election districts in NYC. One is from 2001 and the other 2005). I am attempting to calculate a new field in the 2005 shapefile ...
1
vote
0answers
243 views

Why is not ST_GeomFromEWKB() working?

The following SQL is working fine from the terminal: SELECT MIN(ST_Distance( ST_Transform(ST_GeomFromText('POINT(-3.163916 55.926528)',4326),32630), ...
6
votes
2answers
1k views

Error getting text attributes from shapefile with python / pyshp

I have a shapefile, containing only points in XY-coordinates and a string attribute for each point. I would like to read the coordinates and the attribute for postprocessing in python, but can't get ...
1
vote
2answers
783 views

How do results from a Python script get added to an ArcGIS map? [duplicate]

I have a Python script for ArcGIS that makes a new feature class. I can add this to ArcGIS as a new Script (without parameters), however the resulting feature class is not automatically added to the ...
3
votes
2answers
2k views

Constructing file path within Python for Feature Class within Feature Dataset?

Based on my understanding of the ArcGIS path structure, a feature class inside a feature dataset inside a geodatabase can be accessed by the following: C:\Menu\Lunch.gdb\Sandwich\Cheese Where ...
6
votes
1answer
388 views

Efficiently identifying overlapping polygons with Python

I'm parsing the NOAA severe weather alert feed and using it as a datasource for a weather alerting system. In the feed, I occasionally find a polygon entry for an alert. Unfortunately, counties that ...
4
votes
1answer
466 views

QGIS - Add a combobox to a toolbar

Is there a way to add a combobox to a toolbar for QGIS? So far I can only find examples that add buttons. I found this tutorial which seems to explain how to do this with general PyQT but haven't had ...
1
vote
0answers
144 views

Extract an ArcSDE datasets (rasters/shape files) using python?

I would like to write a python script to extract/export a dataset (rasters/shape files) in ArcSDE. I saw this posts to connect to the server: Define Workspace for SDE Connection in Python But how ...
2
votes
3answers
2k views

How to use ArcGIS 10.1 to make Python scripts for ArcGIS 9.3?

Recently I have been making scripts to run geoprocessing tools for a client who is running ArcGIS 9.3. However I only have access to ArcGIS 10.1. As a result I cannot use model builder in 10.1, and ...
3
votes
1answer
719 views

Reset python add-in

I have a toolbar which enables a second and third combobox when a selection is made on the previous. I would like to add a button to 'reset' the toolbar. Basically reload the toolbar to it's original ...
2
votes
1answer
535 views

How to use ArcPy cursor to define each feature sequentially as current selection of layer?

I want to implement a script that runs through each feature of a feature class, zooms to the extent of the feature, sets the scale to 1:5.000 and adjacent takes a picture of the scene. The steps are ...
7
votes
2answers
1k views

Getting unique value of second field using arcpy.da.SearchCursor?

I have a feature class and using arcpy.da.SearchCursor I'm getting unique values of a field (e.g. Name). How can I use this method to get the associated row value of a different field (diff field = ...
0
votes
1answer
1k views

Find and Replace data source script

The following script is supposed to find and replace all shapefiles in a mxd (that exist in the folder) to the new SDE data source. No errors when running the script however, when I open the MXD in ...
2
votes
1answer
136 views

How to get a list of all projections that are currently available in QGIS via the PyQGIS-API

i'm building a QGIS-Plugin and i want the user to choose a CRS out of a combobox in which the coordinates he would enter into some textfields are represented, so these can be converted into another ...
2
votes
1answer
1k views

GRASS Geoprocessing in Python Script

I´m trying to get some GRASS geoprocessig tools running in a python script outside GRASS. I´m able to import grass.script, but I´m not able to get the tools running yet. Does anybody know what I´m ...
1
vote
0answers
60 views

How to clip Raster using multiple polygons and Python? [duplicate]

Possible Duplicate: clipping a raster by multiple datasets or polygons I have polygon layer and DEM and I want to write a program using python to cut the raster into multi-raster based on ...
1
vote
0answers
34 views

Script for populating field in ArcGIS 10 with consecutive numbers (where start numbers is decided by me) [duplicate]

Possible Duplicate: How to add automate values to attribute field? I need a script (for Arc GIS 10) by which I can populate a field against some selected polygons features. For instance, i ...
0
votes
0answers
202 views

using mapnik xml file to render tiles in python

Is it possible to use an xml file in python? without using the bindings for python for mapnik. basically i'm using django/geodjango, postgis and well i decided i'd try and design the map on tilemill ...
4
votes
3answers
1k views

Python OGR: convert a point geometry into polygon

I'm writing a routine for creating the convex hull envelop around shapefiles of islands. I could read the data, extract polygons vertices into a geometry and then compute the convex hull. Now I need ...
3
votes
1answer
1k views

Import functions in python Add-In logic script

I am running into an error. I have a set of functions which I want to import in the python Add-In script at the time of execution, but when I built Add-In with "import stats" line then tools are ...
6
votes
4answers
1k views

Code to open web browser crashes ArcMap when run from a Python add-in

I created an ArcMap Python add-in using ArcGIS 10.1 to open a webpage after the map is clicked. It opens the page but then ArcGIS crashes. import arcpy import pythonaddins import webbrowser class ...
2
votes
1answer
77 views

Python code for locking elements in Layout view

Is it possible to lock elements in layout view in Python? I know it is possible in the production cartography extension from ESRI but all I need is the funcionality to lock elements. I am wondering if ...
0
votes
1answer
77 views

How to use a property of a different interface for a created ArcObject

I have created an arc based three points (from point, through point, and to point). To create the arc I used this code: import arcpy, comtypes.client import comtypes.client.CreateObject as ...
4
votes
1answer
256 views

changing symbology

I have problem with my script. Layers are in one geodatabase, and have names like: orne1942, orne 2003, orne 2009 (the same forpart e.g. orne). Script should changing symbology layers wich have the ...
4
votes
2answers
557 views

Randomly select a record to update using arcpy.da.UpdateCursor

This question is related to my question here. What I would like to do is use a cursor with a where clause to select a number of records. For each row, the values in two fields, TYPE_A and TYPE_B ...
0
votes
0answers
12 views

Arc 10.0 Running Python function CADToGeodatabase() crashes ArcMap/Catalog contd [duplicate]

Possible Duplicate: ArcGIS 10.0 Running Python function CADToGeodatabase() crashes ArcMap/ArcCatalog Sorry, no room to put all this in the coments window - tried putting this in Answer but ...
5
votes
2answers
629 views

Correct usage of a counter using arcpy.da.UpdateCursor

In the Python code inside a Calculate Value tool in my model, I have the following: getNum("%Selected Features%") def getNum(ftr): lst = [4, 11, 15] #values for SQL expression x = 20 fields ...
0
votes
0answers
676 views

Python package for Google Maps API v3?

I am looking for a Python package that can generate the JavaScript to display Google Maps API v3. I would like to integrate such package into a django website. I know pymaps exists but it's for ...
6
votes
3answers
769 views

Classifying point coordinates to countries or continents?

I have about 50 000 points (latitude and longitude), and I would like to find out in which country each of the points is located. It does not need to be super precise, though. (Or actually I only ...
7
votes
2answers
2k views

How do I use QGIS python console to iterate through simple layer queries and png outputs?

I'm really new to QGIS coding and I'm having a hard time finding (especially) the api classes/functions to carry out actions of the Query Builder window. I'm basically trying to do this: Iterate ...
1
vote
1answer
871 views

How do I copy all feature attributes to a feature in a new layer?

I'm trying to create a new layer in QGIS based on an existing layer. The new features should have all the attributes of the corresponding features in the original layer. I've been trying to use ...
3
votes
2answers
695 views

Can python read the value of a cell in a spreadsheet? [closed]

Can python read the value of a cell in a spreadsheet? The simplest example would be a script that ran a buffer tool on a given shapefile. For the distance parameter, instead of just using a number ...
2
votes
1answer
475 views

Setting parameters in Arcmap for dynamic python script

I have a simple python script that works when run from PythonWin, but when I try to make it dynamic to run inside ArcMap I keep receiving: : ERROR 999999: Error executing function. Failed to execute ...
0
votes
1answer
220 views

ArcGIS 10.0 Running Python function CADToGeodatabase() crashes ArcMap/ArcCatalog

My code: import arcpy, csv from arcpy import env dgnfile = str(arcpy.GetParameterAsText(0)) outFeatureClass = str(arcpy.GetParameterAsText(1)) #the fc in my fgdb template to be ...
1
vote
1answer
163 views

cannot print listRasters

I'm trying to run this very simple script to check a problem in another more comlpex one. import arcpy arcpy.env.workspace= 'C:\\Users\\Umberto\\Desktop\\Prove_Script\\Karakoram\\temporary_01' rst= ...
2
votes
2answers
582 views

The name contains invalid characters

I'm having a problem with the following script. When listing parameters that are optional I've used the "" before, so I can't figure out why this isn't working. import arcpy import os ...
4
votes
1answer
910 views

How to import DGN geometry into a file geodatabase?

Specifically, I have an empty File GeoDatabase template consisting of several Group Layers, each containing several Feature Classes. In fact each FC has several subtypes exposed by including a .lyr ...
1
vote
1answer
303 views

How to add multiple rasters to a layer file?

I'm trying to make a .lyr file to bring into ArcMap with arcpy.mapping. I can bring a single raster into a .lyr with the script below. I'm unsure how to proceed to get multiple rasters from the same ...