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

learn more… | top users | synonyms

1
vote
1answer
39 views

Python script to export .csv tables from GDB

I am very new to Python programming and have been tasked with writing a program to export a csv file from a file geodatabase feature class. The csv should contain only certain fields and the records ...
0
votes
0answers
3 views

Central Feature Tool Key Error u'M'

I was trying to execute two tools (Mean Center Tool and Central Feature) when suddenly it gave me a error that I couldn't find the resolution too no matter what I tryed. The code is here (along with a ...
0
votes
0answers
5 views

kriging interpolation of many z

I have similar questions with Iterating through z-values in ModelBuilder. I want to interpolate my z's with my specific interpolation extent raster and extract each value to specific grid points (I ...
1
vote
1answer
25 views

Python Geospatial development book error?

I am currently reading Python Geospatial Development by Erik Westra but I am stuck at the first hurdle where the book suggests that the easiest way to install gdal onto a windows machine is using ...
0
votes
1answer
45 views

Data driven page with Count

I was wondering if there is a way to add coding to Data Driven Pages with python. I would like to be able to take the "Data Driven Page with Count" and increment the count by one or in some cases ...
1
vote
0answers
16 views

geotiff conversion to coordinate system with gdal

I would like to get the coordinates X Y Z from a geotiff file. I am using the gdal translate for the conversion. Which output format is the more adequate for containing a 3 numpay array X Y Z ?
0
votes
1answer
26 views

Editing KML breaks icons

Edit: Solved it. When I was creating my new zip/kmz my code was creating various folders within the zip/kmz. Changed: NewZip.write(addedfile) to: NewZip.write(addedfile, newfl) /Edit I have KMZs ...
0
votes
0answers
83 views

QGIS 2.4: plugin changes map tool canvas click behavior from 2.0

I had created a plugin for QGIS 2.0 to add new features more easily. It involves changing extents and updating snapping options along with triggering the default actionAddFeature(). However, I've ...
4
votes
4answers
520 views

How to optimise and speed up Python code?

Again my lines of surface runoff... I made a script, solving the issue when lines cross other lines. Something like generalization. Like on the picture below. The problem is that I have to solve 30 ...
5
votes
3answers
2k views

Python, comtypes and ArcObjects: Error creating AppROT object

I am experimenting with comtypes and ArcObjects under Python 2.6.5 and ArcGIS 10 SP1. I'm using the pure Python method to wrap the ArcObjects OLBs described in this answer, but getting an error in the ...
3
votes
2answers
1k views

ArcObjects + comtypes at 10.1

Has anyone played around with using ArcObjects in Python at version 10.1? I am having all sorts of problems, such as TypeErrors when wrapping the ESRI OLB modules and AttributeErrors when attempting ...
0
votes
3answers
79 views

UpdateCursor 'is not defined' Python

I have several files (shapefiles). Table 1 has only one row with several fields whereas Table 2 has several rows. What I want is to take a value from Table 1 and populate all rows in Table 2. I used a ...
3
votes
1answer
33 views

Which parameter data type is used in the Integrate geoprocessing tool for ranking?

I'm trying to figure out which parameter data type is used in, for example, the Integrate geoprocessing tool. It looks like this: I'd like to use it in a geoprocessing tool I'm making, but can't ...
1
vote
1answer
64 views

Executing tool comes back with an error arcpy.JoinField_management

I have this script snippet, written by Aaron. import arcpy import os #set workspace arcpy.env.workspace = "C:\\Users\\Documents\\Wetland\\New_Folder" #in the folder "New_Folder" is a geodatabase ...
0
votes
0answers
25 views

Python comtypes and ArcObjects: Snippets GetApp() fails at 10.2

I have been experimenting with Python's comtypes module to access ArcObjects. We are still using ArcGIS 10.0 as we are in the process of upgrading our ArcGIS for Server to version 10.2.2. I am ...
1
vote
1answer
31 views

Con() does not recognize raster values

I have a problem when using the con() argument. What I want to do is to remap all raster of a raster file ("Red_SL") cells with values larger than 40 to the new value 5. All other values should be ...
1
vote
1answer
22 views

Adding a graphic line element to open mxd using python comtypes to access ArcObjects

I attended a pretty awesome demonstration from Jeffrey Barrette at the Esri UC a few weeks ago on creating dynamic tables in ArcMap. This functionality will greatly benefit the aviation department at ...
1
vote
1answer
32 views

Write layer from QGIS to PostGIS

I am looking for an "elegant" solution to write, from a python script, a layer from qgis and into a new table of a PostGIS database. I thougth that this might be solved by QgsWriteVectorLayer, but I ...
1
vote
1answer
48 views

What is the inverse of QgsGeometry.asGeometryCollection() in qgis python?

What is the inverse operation of QgsGeometry.asGeometryCollection() as documented here: http://qgis.org/api/classQgsGeometry.html#a7cb1cbf8cfa441456067a66ad3a25a94 I'd like to do something like: ...
0
votes
2answers
32 views

Check layer data type in gdb

I have path to layer or feature C:\base.gdb\test How to check is table or feature class by arcpy?
1
vote
1answer
21 views

Iso Cluster tool in script failing to open clip raster

I have been coding in Python for only a few months, so maybe I'm just overlooking a minor detail as a newbie. I have written the script below for a class project. It is supposed to clip two rasters, ...
0
votes
0answers
26 views

Is there a way to take control of the mouse pointer using python in QGIS?

i would like to take control of the mouse pointer in QGIS (for example constraining it to a given extent...) Is there any way to do that using PyQGIS ? Thanks !
8
votes
2answers
220 views

How is the data access cursor performance so enhanced compared to previous versions?

The data access module was introduced with ArcGIS version 10.1. ESRI describes the data access module as follows (source): The data access module, arcpy.da, is a Python module for working with ...
0
votes
1answer
32 views

How can I efficiently use a list comprehension on an ogr.layer inside a loop in Python?

Problem statement I'm using python 2.7 and ogr 1.11.0 on Windows 7. I have two shapefiles: one for streets and one for junctions. The streets shapefile has fields listing the IDs of the start and ...
2
votes
2answers
1k 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 ...
3
votes
2answers
249 views

Multiprocessing issues with ArcPy

I am using ArcGIS 'watershed' routine in a script which makes use of multiprocessing. This works fine, but during execution I get the message: Unable to remove directory. Possible causes: 1- Not ...
1
vote
2answers
119 views

AttributeError: 'int' object has no attribute 'save'

I am trying to use a conditional statement to generate a raster with binary values from a raster with probability values (floating point raster). This is easily done within ArcMap by batching the ...
1
vote
1answer
30 views

Pyqgis 2.2 : How to allow editing on layer and features

I'm writing a pyqgis plugin with qgis 2.2 I succeeded in accessing and displaying vector data (geometries & attributes). Now I would like to allow editing for all my layers and all features ...
4
votes
1answer
671 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) ...
3
votes
1answer
236 views

Python SQL connection causes crash in ArcMap

I have the following code which I have striped down to just included the part that is causing a crash in ArcMap. import pymssql # Connect to the Research db using Windows Integrated Authentication. ...
1
vote
2answers
26 views

Debugging SQL in arcpy.da.SearchCursor RuntimeError: An invalid SQL statement was used?

I am going through a python script in arcpy 10.1 to Select a field value (i.e. NEAR_DIST) based on three condition as 1) NEAR_DIST<=radius(i.e.500 or anything from user input) 2) ...
1
vote
1answer
34 views

Automating polygon mergers with python

This is the first real world python program am trying to write. I am trying to create a scrip that takes a shapefile that has n polygons with an integer formatted date (e.g. yyyymmdd or 6/24/2014 is ...
0
votes
2answers
295 views

problems with py2exe, shapely and fiona

I have a short python script, called test: import fiona with fiona.open("C:\\Essai_compil", 'r') as l_Obs_shp: for shp in l_Obs_shp: print shp['geometry'] I want to compile with ...
0
votes
2answers
278 views

Python Error while Publishing mxd ArcGIS 10.1

I was in the process of publishing my mxd , I had reached till the analysis step where I encontered the error at staging the service. Before this below mentioned code I had created a connection ags ...
2
votes
2answers
644 views

OSR Python testSR.ImportFromEPSG(4326) returns empty spatial reference

This is empty using Python .ImportFromEPSG(4326): import osr #this fails: testSR = osr.SpatialReference() testSR.ImportFromEPSG(4326) print testSR.ExportToPrettyWkt() #why did the import from EPSG ...
0
votes
0answers
26 views

Read large raster into lat/lon value pair to csv file using python and/or gdal?

I have rasters for all of the states in US and they are in 10m resolution. So they can be very large, containing a large number of pixels if you think of TX or AK. I want to create a csv file with ...
2
votes
1answer
39 views

How to return end of string up to a certain character using Field Calculator?

I am trying to accomplish this task: http://stackoverflow.com/questions/15851568/how-to-get-the-last-part-of-a-string-before-a-certain-character within the Field Calculator. I have the below but ...
1
vote
0answers
39 views

ArcPy Multiprocessing 000714 - Working in Debug Mode

In an attempt to render an interactive window via matplotlib I am using an out of process script in a toolbox. If I debug the script, it is possible to step through and render the window as expected. ...
1
vote
0answers
30 views

How do you duplicate a point within a shapefile using Python?

How do you duplicate a point within a single feature class using Python? I have a partial sample script below, but in a nutshell, I want to duplicate a point, copy it into the same shapefile, and ...
2
votes
2answers
33 views

Selection of lines that lays mostly in defined zone (majority overlap)

I have lines of surface runoff and I need to select the ones that are lying mostly in internal buffer of polygon. I'm trying to make some script in python, but it's very important to make the script ...
0
votes
1answer
30 views

Erdas python scripting help

I want to write scripts for Erdas in Python. I downloaded some Python examples here but I could not make much. Where can I get the full Help material for Erdas python scripting?
-3
votes
0answers
36 views

Batch Convert shape files into aoi's in erdas

How to Convert Shape files in batch mode to aoi's in erdas through python script?
7
votes
2answers
183 views

Conflict between ArcPy and GDAL/OGR?

TL;DR I can't get an installation free version of GDAL/OGR to work from within ArcMap 10.0. I get an ImportError: DLL load failed on _mod = imp.load_module('_gdal', fp, pathname, description). ...
0
votes
1answer
89 views

Writing shapefile with projection defined crashes fiona

I've just started trying to use Fiona to write out shapefiles. I found the example code below, which seems to work fine from shapely.geometry import mapping, Polygon import fiona # Here's an example ...
2
votes
1answer
84 views

Does not show shortest path in networkx (in QGIS)

I used the following commands (in qgis console) to get the shortest path with astar algorithm. But the result shows 'NetworkXNoPath' every time. Why was that? Please help me to find a solution to this ...
6
votes
1answer
74 views

Competing approaches to line & polygon simplification

There seems to be a few theoretical options around at the moment for geometric simplification. Douglas–Peucker seems the most established, followed by Visvalingam's approach (used by d3.js). Now ...
3
votes
1answer
227 views

How come “Zoom to Polygon” always puts me in the middle of Nebraska?

This is an issue related to this question I'd asked a few days ago. I've got that code working, to an extent. Every time, though, that I double click on one of the Polygons in the attribute table that ...
1
vote
1answer
49 views

Communicate synchronously & continuously (coords, etc) from terminal to application-based mapping software such that updates are displayed live on map

I run a lot of spatial queries. Hundreds of thousands a week. While these things are running, it would be nice if I could see what (where, actually) my scripts are working with. Distance calculations, ...
7
votes
1answer
877 views

Inserting newlines in Rectangle Text elements via ArcPy causes overlap?

I ran across an issue the other day when I tried to use ArcPython's mapping module to edit rectangle text elements with newlines (\n) in an ArcMap document. Here's what the output looked like: ...
1
vote
0answers
21 views

How to sort a column in attribute table programmatically

Is there any way to sort ( alphabetically ) a column in the attribute table programmatically (without clicking on the column header) in QGIS ?