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

learn more… | top users | synonyms

3
votes
2answers
788 views

OSM - Extract Streets from OSM Data (With/Without Python)

I'm currently in the works of creating a pythonic way of extracting street names from an OSM dump for the Province of Quebec. Originally, I wanted to do this in Python to make it easier to integrate ...
10
votes
3answers
333 views

How to convert LAS file to numpy array?

I have begun learning how to manipulate LAS data in python and wanted to see how others handle LAS files. I would like to read the points (I am using a numpy array), and filter out classes 1 and 2 ...
7
votes
3answers
578 views

How to Receive an Email after a script has run?

I'm working my way through my first attempt at scheduled tasks with modelbuilder and python. So far I have: Created a model that reconciles our SDE versions and then compresses the database. ...
0
votes
0answers
152 views

Change field attribute in one column based on Domain value from another field using Field Calculator

When I am editing a feature class, I want to automatically populate another field base on one column in the table. Here are the fields and data I am working with. Proj_Code, Proj_Name DA, Dawn Lake ...
5
votes
2answers
631 views

Stereographic projection of WGS84 ellipsoid on a plane[python]

I would like to ask you for help in following task. What I need to do is to derive local x,y coordinates from latitude, longitude, applying stereographic projection of WGS84 ellipsoid on a plane, ...
3
votes
2answers
688 views

How to get field names in pyqgis 2.0

I am trying to change an plugin from QGIS 1.8 to 2.0. In the 1.8 version I create a table of the field names like this: layer = vlayer provider = layer.dataProvider() feat = QGSFeatrue() allAttrs = ...
0
votes
1answer
107 views

Different output from running algorithm in toolbox and from script

I am unable to get the same results when running the qgis:reproject tool from QGIS processing toolbox (QGIS version 2.0.1) as when running it from a Python script (console). In this example I am ...
1
vote
1answer
119 views

QGIS Python Composer Attribute Table has no content

I post 2 Month ago the same question. So I try it a second time with more code. My Problem still is that I add at the composer a attribute table and in this table there is no content. My Code: ...
4
votes
2answers
1k views

Loading PostGIS raster layer into QGIS

I am unable to load a PostGIS raster layer into QGIS. I have looked through previous posts Loading raster from PostGIS DB into QGIS and Cannot add the PostGIS raster layer with QGIS but was not able ...
0
votes
1answer
121 views

Python - indentation error [closed]

I've started learning python for future use in QGIS and using Ubuntu, installed with Python 3. I'm doing the tutorials from the great book for newbies "A byte of python". I'm having troubles running ...
2
votes
2answers
255 views

Calling variables within ArcPy functions

I have a defined function (ex. def my_function(x,y)). def my_function(x,y): """algorithm""" my_variable = my_function(filex, filey) How can I call this variable within the code block section of ...
1
vote
2answers
94 views

how to identify qgsvectorlayer area?

I need to identify the area from Qgis qgsvectorlayer anyone have an idea how to do that in python ?
1
vote
2answers
165 views

No prj file output from qgis:reproject

I'm trying to reproject a vector layer using the 'qgis:reproject' algorithm in the processing/sextante module of QGIS, from Python. This kind of works, but the .prj and .qpj files created after ...
1
vote
1answer
41 views

How can I avoid creating a new cursor object repeatedly while counting features in a large SDE Database?

I would like to get a script running much faster than it is now. The script completes on my machine in about 33 minutes. It generates a report that counts features with specific attributes in one ...
0
votes
2answers
37 views

Migrating several shapefiles from one server to another?

my organization is a large ESRI user and we are under going some hardware changes. My question is: Is there a way to move several shapefiles scattered across many folders (in one server) to another, ...
1
vote
1answer
274 views

Select by SQL in QGIS Python

In the GUI there is the Query Builder, but that does not seem to be easily available in Python. The processing (SEXTANTE) module has the qgis:selectbyattribute algorithm, but that only supports ...
1
vote
1answer
172 views

Split table column and use to update another table

I have a table (T1) which I need to populate (using python for ArcGIS) the fields Val1, Val2 and Val3 ID Val1 Val2 Val3 0 1 2 with data from another table (T2): ID Data 0 V1 1 V1 2 V1 0 V2 ...
2
votes
1answer
246 views

How to extract vegetation polygons from Imagery using Python?

I have been trying to roughly polygonize vegetation areas from Imagery (RGB). I tried using Iso Cluster Unsupervised Classification (Spatial Analyst) but it is still too detailed for my purpose. I ...
1
vote
2answers
222 views

Reducing number of decimal places after X/Y coordinates in a FC

I'm using arcpy.AddXY_management to add coordinates, and I want to reduce each X/Y field by x number. I've tried to reduce it by string slicing and that obviously didn't work. I also tried setting the ...
0
votes
2answers
430 views

GDAL and Python: how to create new files for (e.g.) clipping with gdalwarp

I'd like to learn using GDAL, and I want to use it in Python. Following the tutorial (http://www.gdal.org/gdal_tutorial.html), I succeded in opening vector and raster files using ogr.Open and ...
4
votes
0answers
55 views

Using QGIS plugins from Python [duplicate]

Is there a simple way to automate calls to QGIS plugins from a QGIS Python script? Either from console or a plugin? I am ideally looking for a way to specify input/output parameters and bypass GUI. ...
2
votes
1answer
136 views

Embedded python script module import issue

I have two ArcGIS python scripts. One is a primary python script that calls a number of functions from a second python script. Everything works well, i.e. primary tool calls and uses functions from a ...
0
votes
0answers
225 views

GeoEncoding Fails : latitude or longitude exceeded limits (-14)

Module Installation fails in OpenERP 6.1: Im using OpenERP 6.1 with CamptoCamp GeoEngine (Without GeoEngine it get installed). Trying to install module throws Error: ERROR openerp_trunk_geoengine ...
1
vote
2answers
362 views

How to remove z & m coordinates from shapes with QGIS? (Or arcgis, grass, gdal, Python…)

I've recently received some parcel data in shapefile format that has z & m coordinates (all = 0.0). The WKT for a typical parcel looks like this: "MULTIPOLYGON (((2672464.560700002 ...
1
vote
1answer
394 views

special python library needed for spatialite?

It appears that pyspatialite is very outdated. Do I need a special library like pyspatialite in order to use the spatial functions of spatialite? Or can I just connect to the database via the normal ...
3
votes
2answers
405 views

Get coordinate of second to last vertex for python ArcGIS

I need to obtain the x and y attributes of the second to last vertex for each segment and add to the attribute table using Arcpy (or some other python module). To get the Y co-orodinate of the first ...
5
votes
2answers
404 views

In Python, reading a GDAL raster from memory instead of a file

I'd like to analyze some raster data in Python using NumPy. This data doesn't necessarily exist as a file on the filesystem, it could be the result of a query against PostGIS, or something ...
0
votes
1answer
100 views

How identify Layer name when removing it from legendInterface qgis?

I am trying to connect the removing layer action with a slot for doing some processing after that. I already try this: QObject.connect(self.iface.legendInterface(), ...
0
votes
0answers
26 views

The names of all the tables created are forced to be converted into lowercase in Pyspatialite 3.0.1

after the update of PYSPATIALITE from 2.3.1-3 to 3.0.1-1 in QGIS, the names of the all the table created by SQLite3 are forced to be converted into lowercase. After fallback to 2.3.1-3, the issue ...
3
votes
0answers
51 views

How to automate creation of Network Turn Features from line segments? [closed]

I have a road network which I will add Turn features in. From the road network, I have created a model that cuts out the line segments where the turn features will be located. My problem is how to ...
2
votes
1answer
584 views

How to call processing toolbox in Qgis' python console

I have been trying to use processing toolbox via python console in Qgis 2.0.1. I am able to write the following comamnds: I am particularly interested to run 'r.statistics' from GRASS module. ...
0
votes
1answer
59 views

Inverse Distance Weighted Python error in QGIS 2.0

When I wanto to use the command Inverse Distance Weighted in QGIS 2.0, I want to execute as batch process but when I open file it appears a window that say Error de Python This is what it says: ...
0
votes
0answers
84 views

Qgis: Can prt or python generate high res, scale 1:250 images of entire map?

I need to create a very high resolution, scale 1:250, image from my multi-layer map (30 seconds x 40 seconds). The PRT function in Qgis falls short as it reduces the resolution when using PRT. Also ...
2
votes
0answers
162 views

How can I create random concave polygons for test purposes?

In the context of generating random test data using QGIS (in a shapefile): I can generate random, continuous (adjacent) polygons by first creating n random points using ftools and then generating a ...
4
votes
1answer
334 views

How to apply “Band” settings using gdal Python bindings?

I am trying to replicate the gdal_translate command, but using pure Python: gdal_translate infile.tif outfile.tif -co COMPRESS=JPEG -co PHOTOMETRIC=YCBCR -co TFW=YES -b 1 -b 2 -b 3 I have ...
5
votes
1answer
398 views

Is there a python option to “join attributes by location”?

I am trying to perform the function join attributes by location as found on the QGIS menu Vector>Data Management Tools. I am seeking an open source python option for this. I know arcpy has a spatial ...
1
vote
0answers
62 views

How to create a startup prompt that populates definition queries on multiple feature classes

I would like to create an ArcGIS start up prompt or custom button that asks for a user's initials and then populates multiple feature class & layer definition queries. More specifically, I would ...
0
votes
1answer
76 views

Pyshp Editor error

Following my predecessors (here and here) I am trying to append new data to shapefile using Pyshp. The specifics of my problem is the need to save the file with the same name (without creating a new ...
0
votes
1answer
46 views

OGR FeatureCount returns '-1' with OSM data

I am trying to read in an OSM file with OGR. import ogr driverOSM = ogr.GetDriverByName('OSM') roadsDs = driverOSM.Open('data/map.osm', 0) roadsLayer = roadsDs.GetLayer() The feature count returns ...
0
votes
1answer
65 views

Get Index for a group QGIS Python

I am trying to add new layers into a specific group which I can get to work if I know the index but how can I get python to fid the index of a group so it can load the new layer into the group ...
1
vote
1answer
171 views

Cursor Update Python Script for Multiplying Several Fields against a Ratio (Real) in ArcGis

Disclaimer: Python Neophyte, Uber-reliant on GUI, working to wean... I have a Python script for replacing multiple Field values with another table value that was graciously provided by the inimitable ...
1
vote
0answers
65 views

Access to python addin objects/variables in python window

Following up on this question: Can a Python script be executed from a .NET AddIn and also write its standard output and geoprocessor messages to the ArcMap Python Window? Is is possible to access ...
3
votes
2answers
214 views

arcpy.SearchCursor loops one time but then does not repeat

The part of the script I'm having trouble with is the arcpy.SearchCursor. The cursor runs 1x and then does not re-run. The goal was to re-retrieve the field value and apply it to the image layout. It ...
3
votes
1answer
641 views

set values in feature class attribute table to null

I've created a point-data featureclass (fc) containing data from a simple .txt file using Arcpy as follows: arcpy.CreateFeatureclass_management(out_path= outPath, out_name= 'fcTest', geometry_type= ...
0
votes
2answers
172 views

Qgis action adding layers using relative paths

in QGIS 2 windows I have some index layers I use for loading raster and vector tiles through an Python action. Currently I am using absolute paths which works fine but I would like to set it up so ...
0
votes
1answer
62 views

using joinDelimiter with MergeRule “Join” (Python in ArcGIS 10.1)

In this example from ESRI, the MergeRule is set to "Mean" and the values from two fields from two different feature classes are averaged and written to a new field. # Set the merge rule to mean ...
4
votes
1answer
420 views

ArcGIS Server Geoprocessing Service: Good Async, Bad Sync

I'm working a geoprocessing service for ArcGIS 10.1+ written in Python / arcpy. It runs fine in asynchronous mode, but does not write output to disk when switched to synchronous. I know that ...
0
votes
1answer
61 views

Updating matplotlib using OSGeo4W - FOR BEGINNERS

This question has been asked, but I can't seem to find an answer suitable for a non-computer programmer. A link would be great, or a quick 'how-to'. I updated to Dufour (2.0.1) and have run into a ...
1
vote
1answer
265 views

Python scripts execution in ArcGIS Runtime WPF app

DEAR PEOPLE FROM THE FUTURE: Here's what we've figured out so far… I am facing a quite interesting requirement: "run python scripts within an ArcGIS Runtime app". checking the concepts in the ...
4
votes
1answer
116 views

How to modify script published as GPService in ArcGIS Server?

In ArcGIS 10.1 before publishing script as a new GPService I have to run it in ArcMap. It is a good solution when I handle small amount of data. When I want to change something in my script I have to ...