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

learn more… | top users | synonyms

2
votes
1answer
400 views

How to “Merge Selected Features” with python?

I have been looking for the answer to this question for some time now, but can't seem to find it! My problem is straight forward: I have one layer It contains lots of features (only polygons), say ...
3
votes
1answer
196 views

Get the total distance from a point to the end of a linestring

I have a list of GPS coordinates that make up a bus route: busRoute = [(x1, y1), (x2, y2), ... (xn, yn)] I also have a point that may not be exactly on that route (due to GPS error): ...
4
votes
2answers
1k views

Is there a way to get at C's OGRLayer.Intersection() or OGRLayer.Clip() in Python?

I am working with OGR in Python and noticed that the C libraries have useful Intersection() and Clip() functions as part of the Layer class. Is there any way to get at these functions in Python? I ...
3
votes
0answers
383 views

Create easy Annotations from point features with python in ArcGIS 10.0

Because in ArcGIS 10.0 there is still no simple toolbox function to convert labels to Annotation, I try to go a substitude way with the callable Toolbox function [TiledLabelsToAnnotation][1] on a ...
4
votes
1answer
423 views

Switching between background 64 bit processing and 32 (so I can use 3rd party ie XTools)

I often run scripts now with 64 bit background processing enabled but when I want to use certain tools like Xtools table to text I have to turn it off as these tools are 32 bit. Is there a way to ...
4
votes
4answers
474 views

How to display a “Save As” dialog for raster files?

I'm writing a QGIS plugin in python. I need to show a "Save as" dialog window in order to allow the user to select the path of the output raster file. Do I need to create a QFileDialog and manually ...
4
votes
1answer
1k views

Populating a Value List in one Parameter, from Values Derived from a Second Parameter, Python

Using the Validator in the ArcGIS 10.1 tool GUI, can I loop through and List feature classes from a workspace type parameter (ie a file geodatabase) and then go on and list the values of a field in a ...
1
vote
0answers
218 views

Averaging satellite data with missing values (using Python)

I am using sea surface temperature, chlorophyll, and other data parameters as covariants in a model, and I would like to average them over a particular time period. I am currently doing this using a ...
6
votes
3answers
3k views

Raster: How to get elevation at lat/long using python?

I was wondering if anyone has some experience in getting elevation data from a raster without using ArcGIS, but rather get the information as a python list or dict? I get my XY data as a list of ...
6
votes
1answer
463 views

ModelBuilder: How to extract data by date, export to separate tables and interpolate tables to rasters

I've been using ArcGIS for a couple years, but when it comes to model builder I've only worked with very simple models. I'm hoping someone that is much smarter than myself can help me in building a ...
2
votes
2answers
108 views

How do I create a network from connected links

I have a bundle of links in 'some' networks. I need to find out which ones are connected to each other i.e. I need to find out which links are not connected to the 'main' network. I have been working ...
0
votes
1answer
197 views

Qgis - taudem plugin - python script not found

I installed the sextante toolbox on qgis. my os is fedora. grass works fine but i've got problems with taudem. it seems like some python files are missing. for instance when i try to run the ...
0
votes
1answer
395 views

openlayers python proxy.cgi script is not taking parameters

I have setup the python proxy.cgi in cgi-bin folder in my server. [myserver]/cgi-bin/proxy.cgi returns the openlayers website [myserver]/cgi-bin/proxy.cgi?url=www.openlayers.org returns list index ...
3
votes
3answers
7k views

Use Python to parse string [closed]

OK, I know that this is Python 101, but I can't seem to figure it out. I have a function setup that will return a string, specifically an azimuth in DMS. I need to take the return values and pull ...
4
votes
1answer
596 views

“Sequence size” doesn't match row in Python?

Essentially I am trying to calculate a value for a couple of fields after adding them. Below you can see how I am adding the fields and then an example on how my "for" statement is looping through the ...
2
votes
1answer
513 views

Python code: Using Search Cursor to find missing values in attribute table between two layers in one MXD

I need help! I am writing a program that will look through the table of a station layer and then go to the annotation layer and list all the missing values. For Example: The station layer has a field ...
3
votes
1answer
118 views

python sqlite giving errors

I have python code that I am executing but it gives me following error: <sqlite3.Cursor object at 0x7f3c7666dc00> when I execute the cur.execute(statement). the code that is below the ...
8
votes
1answer
1k views

Pros and cons of using Ruby/Rails/RGeo or Python/GeoDjango for a web based GIS

We're at the investigation phase of creating a web based GIS. We're assessing options for an ORM to use in all of our backend import/export and processing routines. From my research, GeoDjango appears ...
2
votes
1answer
3k views

Python GDAL: Save array as raster with projection from other file

I have an array of data, and for each datapoint I know the latitude and longitude. I'd like to save it as a GTiff with the same projection as other rasters I have. This is what I've tried so far, but ...
1
vote
0answers
163 views

How to programmatically change an SVG symbol in the Vector Layer?

I'm trying to change the symbol used in a layer via Python. I've been able to tunnel through a vector layer to the symbol layer, but I don't know how to change the symbol it's using. I'd like to ...
7
votes
2answers
1k views

Converting KML files for use with Python library Shapely

I am trying to get a KML-file (wijken.kml) into Shapely. The KML-file is validated against the proper XML schema, so I guess the input is correct. Routes I have tried: 1) Converting to WKT or WKB ...
3
votes
0answers
116 views

traversing KML files with ogr python

i'm new to OGR processing and KML format so be gentle: i've got a series of KML files all containing multiple regions partitioning a larger area in each. i also have a series of geocoded points for ...
0
votes
2answers
1k views

Using Python to parse an XML containing GML tags

I am trying to write a python script which pulls GML tags out of an XML file and formats them into WKT for inserting into a PostGIS database. I have been successful in doing so for an XML containing a ...
1
vote
0answers
85 views

Clipping Buffers

I have buffered a line shapefile where many lines are intersecting but not broken at intersections. I am trying to select each record in the buffer file and clip all intersecting polygons in the same ...
3
votes
2answers
1k views

Delete feature selection using Python (ArcGIS 10)

I'm having some issues with a Python script for ArcGIS 10. The idea is to delete points from a single shapefile according to the values of two columns ("Tracks" and "Tracks_1"). Therefore, I want to: ...
1
vote
1answer
506 views

How do i use gdal2tiles for creating tilecache?

I want to create tiled cache from raster file, so i downloaded gdal2tiles.py. Now i don't get what (and how) i must do with that python script file.
5
votes
3answers
1k views

Interacting between Openlayers and Python

I have a openlayers website like this one that gives the user the ability to draw polygons and then creates a GeoJSON file. I want to process this GeoJSON with a python script. The python script ...
6
votes
4answers
2k views

Efficient arcpy method of points in polygon

Coming from a background of Mapinfo and Manifold, I frequently find myself frustrated with the ArcGIS SQL toolset. In both these former programs it is trivial to write a query asking, for instance, ...
2
votes
4answers
2k views

How can you auto-populate field using spatial location of another feature and its attributes?

I want to auto-populate a field based on the spatial location of another feature's attribute. Add a point on top of a building. The point automatically adds the name of the building. This seems like ...
2
votes
1answer
331 views

OGR - Weird GeomType -2147483645 on polygon shapefile

I am trying to import a shapefile (multipolygon) in an app with ogr but I got an error about invalid geom type. If I inspect the data with ogr like this: datasource = ogr.Open("c:\\temp\\data.shp") ...
1
vote
0answers
63 views

How to identify grid shift file used by osgeo in Python?

I wrote a Python script reprojecting points from a source coordinate reference system (SCRS) to a target one (TCRS) both identified by an EPSG code. I would like my python script to retrieve details ...
2
votes
2answers
296 views

Python Toolbox Raster Parameter Error

I borrowed a simple script I found online to clip a shapefile from the extent of a raster. It works perfectly from the ArcMap built in python command prompt. I modified is slightly to use in a tool. ...
4
votes
2answers
349 views

Moran's I z-score in ArcPy

I have a ArcPy script to calculate Moran's I several times (50 to be precise). However, I am not interested in the Moran's I value, what I need is the z-score returned by the tool. Even though the ...
2
votes
3answers
881 views

Accessing GEOS functions in Python

The issue: I am using Windows 7, 64-bit operating system with Python 3.2. I must continue to use Python 3.2 because of a dependency with another API. I need some functions in GEOS that are not ...
0
votes
0answers
259 views

mapnik error - fatal flex scanner internal error--end of buffer missed

I am using Mapnik 2.0.1rc0 on a Windows 7 with python 2.7 32bits inside a GeoDjango App. I often got this error: fatal flex scanner internal error--end of buffer missed that makes python to crash ...
0
votes
0answers
16 views

Sextante Modeler Error “global name os is not defined” [duplicate]

I want to generate a model whic reclassify radter values. So i added Saga reclassify grid values tool to Modeler and saved the model. When i run the model i got this error both on Ubuntu OSgeolive 6.0 ...
2
votes
2answers
271 views

How to determine the coordinates of the corners of the raster layer

How can we determine the coordinates of the corners of the raster layer? The image opens function QgsRasterLayer.
0
votes
1answer
350 views

MapProxy installation

I'm tryign to install MapProxy on a windows manchine. My hope is that I can install it and test it on my own computer before moving it to a server. At the moment I can seem to find mapproxy-util and ...
1
vote
0answers
468 views

How to transfer the attributes of features based on their spatial relationship?

I'd like to check if a point feature class is placed on a line feature using python in ArcGIS 10.0. I have created a set of point features and placed them directly on a group of line features at ...
2
votes
1answer
404 views

Compare two Digital Elevation Model (DEM)

I would like to know what's the best method(s) to compare two DEMs without using any GUI soft like QGIS or ArcGIS. I'd like to do it in Python or C++, with GDAL or other similar lib. Does calculating ...
4
votes
1answer
105 views

How to return text from GP service?

So I've got a website that I want to extend by letting people look up postal/zip codes for an address they enter. I've already got all the addresses (with their postal codes) for the city in an ...
3
votes
3answers
1k views

SearchCursor() fails to read feature class

First of all, I would like to apologize if this problem is trivial for you guys since I am very new to ArcPy and Python in general. I want write a script to read attribute table from a feature class ...
3
votes
0answers
367 views

Extracting x,y,z values from a postgis linestring to python using ogr

I am trying to load a postgis linestring into python (using ST_DumpPoints) and extracting x,y,z coordinates, which is working but extremely slow..and if i mean slow, i really mean it (yes, it takes ...
1
vote
0answers
481 views

How to calculate average value within a polygon(in Qgis with Python)?

Now I have a point and polygon shapefile and I want to calculate the points' average value within each polygons How to do it with python? I tried to find out but google gives me a lot of raster ...
6
votes
1answer
5k views

Calculate area within Python script in Arcmap

I am trying to calculate the area of a polygon within my Python script. I create a new polygon from merging two together, and I'd like to add the area of the resulting polygon to a field in the output ...
1
vote
1answer
122 views

How to save ArcGIS process output to variable?

I've created script in Python for ArcGIS that simplify Line, and make buffer from processed line. input = "input.shp" name = "bord" buffer = "buffer.shp" gp.SimplifyLine_management(name, input, ...
9
votes
1answer
169 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 ...
3
votes
0answers
295 views

Field calculator error [duplicate]

NOTE: This problem is similar to one that was answered here: Why does Field Calculator return 0 values when decimals are expected? I'm relatively new to python, and am trying to run a simple field ...
1
vote
1answer
746 views

Why does Add Field to Layer File give “ERROR 000840: The value is not a Feature Layer”?

I'm trying to add a field to a layer file, but it always gives an error. What I did was making a closest facility layer and save the result as a layer and after that I tried to add a field, but then ...
2
votes
1answer
468 views

How to transform KML from lon-lat to UTM (E-N), using Python?

I have a lot of KML files set as lon-lat (geographic coordinates) and want to set them as UTM (E-N) and WGS84 with Python (using arcpy, ogr, or gdal) Does anyone knows how to do this?