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

learn more… | top users | synonyms

0
votes
0answers
45 views

Issue blocking QGIS feature form dialog with Python

I'm not sure where I'm going wrong with this python logic for a custom form in QGIS 2.0.1. There are a few things required by the validation function: that index of combo boxes aren't 0 (first index ...
0
votes
0answers
27 views

QGIS Plugin: Show a symbol at coordinates

I want to code a plugin for QGIS showing a specifig image (e.g. a .png or .ico file in the file system) at given coordinates. The background is, that I'm receiving coordinates and other information ...
0
votes
0answers
21 views

RemapValue Usage

I successfully produce and empty cost raster at the end of this script. I am fairly confident it has something to do with RemapValue parameters? Does anyone know why my out put cost distance raster ...
0
votes
0answers
48 views

Programmatically add paramaters to ArcToolbox based on number of FCs in GDB?

I'm creating a custom geoprocessing tool. If a user inputs a GDB with a variable number of feature classes (FC), how can I retrieve and add a list of the FC to the tool? If the user doesn't add a ...
0
votes
0answers
32 views

PyQGIS loading layer style with PostGIS

I'm loading layer styles from .qml files in a Python plugin. I'm about to switch to loading them from a non-local postgreSQL db. I've been looking at the (from QgsVectorLayer (v2.2)) ...
0
votes
0answers
33 views

Data driven page error when adding world_file

my python script for data driven pages causes a runtime error when I set world_file=True, or geoTIFF_tags=True. Else it runs and shots the ddp - in this case a grid of my city. I'm searching the web ...
0
votes
0answers
22 views

How to make turn feature class from line feature class?

I have a road network of one county in Norway . To this road network, I will make myself a turn feature class of all the road barrier in the road network. I have a feature class with all the road ...
0
votes
0answers
44 views

How to read out the geoPDF data downloaded from USGS ned database?

I am new to GIS, so this might be a stupid question. Google foo din't get me anywhere, so here goes.. How do I read the geoPDF data that I download from the National elevation database from USGS? ...
0
votes
0answers
16 views

How to select Qgis features through Python Plugin

Hi I am very new to Python so this may be a bit basic. I am trying to find a way to select and zoom to the features in a QGIS layer. I have created a plug in and built a custom form. I have 3 ...
0
votes
0answers
23 views

No data appears when using gdal_calc.py but source had data values

I'm in the process of calculating topographic exposure using a mix of GDAL, grass, R and python in Windows. I need to process a very large tiff file using the following calculation: ...
0
votes
0answers
22 views

TileStache : Unknown geometry type in geoJSON file

I'm currently trying to set up a TilSstache server on Ubuntu 12.04 to serve some GeoJSON tiles from a shapefile/JSON file (administratives boundaries) for a web mapping project using the Leaflet ...
0
votes
0answers
15 views

Add a raster specifying the projection in pyqgis

I would like add an raster but I want to specify the projection. If I do : qgis.utils.iface.addRasterLayer(url,layerName) QGIS ask me to specify the projection. I want to this with python. How I ...
0
votes
0answers
19 views

Convert raster_stats list output to array / csv file

I usually program in R, but recently I have started to use python for most of my spatial programming. My python skills are still limited, and please excuse the simplicity of the question. I am ...
0
votes
0answers
21 views

Points Missing on Import of LongLat data to SHP using ESRI script CreateFeaturesFromTextFile()

In ArcMap 10.0 I am using a 9.1-era ESRI script in Python called CreateFeaturesFromTextFile. There appears to be no ArcMap 10 update. The input text format is the strict format ESRI point,X,Y layout ...
0
votes
0answers
75 views

I could use some help with a bit of code optimization

See edit below. I posted here a couple weeks ago looking for some advice on the best way to iterate through data. You can find that post here. I have since done some tweaking to the code, and ...
0
votes
0answers
41 views

using postgis function in pyqgis

I'd use Postgis function in Pyqgis script. This code: qsql="(select gid, id, St_Buffer(the_geom,200) as geom from archi)" uri = QgsDataSourceURI() uri.setConnection("ip", "port", "x", "x", "x") ...
0
votes
0answers
41 views

Using ArcPy, is there a way to change the color of a symbol in a UniqueValuesSymbology object?

I have an template mxd I reference with several pre-defined layers. The only variable I need to modify is the color of certain symbols in the layer. I have tried to modify and dig around the Symbology ...
0
votes
0answers
37 views

Nearest road in the vicinity of a point without queries (openstreetmap)

I know that many similar questions about map fitting have been asked. Everywhere there were answers about sql queries like this: SELECT ST_AsText (ST_ClosestPoint (pt, line)) AS cp_pt_line, ...
0
votes
0answers
36 views

QGIS Plugin to open metadata and show metadata information

I try make plugin to open and read metadata (.xml) and show information inside metadata like map scale, map fiture and bounding box and auto fill it to QLineEdit This code i use to open metadata ...
0
votes
0answers
36 views

Getting “Segmentation fault: 11” with ogr in Python

This is the code I'm trying to run: In [1]: from osgeo import ogr In [2]: datasource = ogr.Open('testdata.shp') In [3]: datasource.GetLayerCount() Out[3]: 1 In [4]: layer = ...
0
votes
0answers
34 views

Suggestions on how to create an Owner Index for a Plat Book?

I've been tasked with creating a county wide plat book for publication this june. The cartography portion is fairly straightforward as I am using ESRI's Data Driven pages for ArcInfo 10 to produce the ...
0
votes
0answers
37 views

Algorithm to find coordinates at selected intervals along a polyline?

I am developing an algorithm to search down a river at selected intervals and return the coordinates. See below: def Downstream(start, interval, data, offset=0, out=None): if out is None: ...
0
votes
0answers
58 views

Error getting spatial reference as string in arcpy

I am trying to get the string associated with a spatial reference to print into an xml using arcpy and xml.cElementTree. Using the snippet: ... spatial_ref = arcpy.GetParameterAsText(3) ... Prj = ...
0
votes
0answers
14 views

std::bad alloc when writing simple script in QGIS

I'm running QGIS 1.8 on Scientific Linux and I'm attempting to write a script (obviously this will be built upon to do something useful) which simply writes to a file. ##raster=raster value=5 ...
0
votes
0answers
39 views

How to get the signal when the color changes in pyQGIS?

I would like to have the signal when the color of a vector layer is changed by the user. In the doc, there is a signal that seems to fit ...
0
votes
0answers
46 views

Creation of drainage ditch in ArcGIS - Line with a certain slope

I have a digital terrain model and a list of problematic points, in which water accumulates. It's not important how I obtained these points (by observing or some algorythm). I would like to use these ...
0
votes
0answers
70 views

GEOS assertion failed

The following script fails, if I import the 'rasterstats' library. import rasterstats import ogr geom1 = ogr.CreateGeometryFromWkt('POLYGON ((415924.806155724043492 ...
0
votes
0answers
40 views

Creating a line along an existing polyline from a point

I have a large data set of points, all of which lie on a river network and have x, y co-ordinates. I want to calculate the slope of the river channel at each point from the underlying DEM by taking ...
0
votes
0answers
29 views

How to add field to postgres layer with PyQgis?

I'm fetching a posgtres layer with PyQgis and then I'm trying to add field with this: lyr.startEditing() lyr.addAttribute(QgsField("class", QVariant.Int)) But It is not adding the field and also ...
0
votes
0answers
47 views

arcpy.SearchCursor strangely throwing IO Error

I've been trying to use arcpy.SearchCursor on an xls file. Something I've done countless times before. I had a script running and then yesterday it started throwing: IOError: ...
0
votes
0answers
89 views

ArcGIS Python Field Calculation

Ok so i've got a problem with the field calculator in ArcGIS: I'm already pretty far with it since i got some help :P but it still doesnt work. What i've got: -A complete table of several states of ...
0
votes
0answers
40 views

Spatialite not available from qgis python console

I have a problem using pyspatialite from within the qgis python console. When I run the following code in ipython from pyspatialite import dbapi2 as sqlite conn=sqlite.connect("MyDB.sqlite") ...
0
votes
0answers
34 views

How to get the color of a vector layer in pyQGIS?

I have see this topic (How to change the color of a vector layer in pyQGIS?) but I'm looking for get the color not to change. How I can resolve my problem ? Thanks
0
votes
0answers
53 views

How to programmatically set a rule-based renderer in QGIS?

These days im in a process of developing a plugin , which highlights/change color of set of features in a vector layer depending on some calculation. i found nice article about QGIS – Rule based ...
0
votes
0answers
95 views

Creating multiple feature classes from multiple text files using python

I have a folder with multiple text files. I am writing a code that reads all of the text files, and creates a point feature class (i.e. a shape file) for each one. The text files are all tab ...
0
votes
0answers
49 views

Kartograph - “projection not named”

The Kartograph package looks very promising, so I have been trying play around with it. As it turns out, I have been able to get the most basic map to work (the "world.json" example), but I could not ...
0
votes
0answers
45 views

Creating Parallel Road Lines

I am aware of the "Copy Parallels" option from the editing toolbar. It works fine when I'm dealing with 1000 roads or so, but when I need to create parallels for 300,000 roads it takes a long time, as ...
0
votes
0answers
42 views

Accessing QGIS attributes table interface with python

I try to use a python script to manipulate the attributes table windows in QGIS. The only thing I find is how to open the windows for a specified layer : iface.showAttributeTable(observLayer) I ...
0
votes
0answers
112 views

ArcMap 10.2 SplitLineAtPoint setSplitRule not calculating RATIO

I am trying to set a length field to use the RATION split policy. I set the split policy for the feature layer but when I use the SplitLineAtPoint_management it does not calculate the RATIO length. ...
0
votes
0answers
18 views

How to integrate osgeo4w to main python installation?

I'm not sure if I can do this but I would like to access methods from osgeo4w from my main python27 installation. How do I accomplish this or are you only able to import osgeo4w from the python ...
0
votes
0answers
39 views

Invalid MXD filename in a python script

I have a script that prints and exports a batch of MXDs. It runs fine as long as the lenght of the path and mxd are shorter. I can't tell what the 'sweet spot' is, but I know it runs fine on my ...
0
votes
0answers
41 views

How to bulk change the schema name of layer properties in ArcMap

I would like to change the data source location (schema) in layer property in ArcMap. Our data are stocked in an Oracle Spatial database. Recently, the DBA has changed the schema name and then I ...
0
votes
0answers
30 views

ArcPad checkout/in process, only selected features

I am working on developing a python toolbox to automate the steps required for checking data out and back into a file geodatabase. My question is what is the best way to limit the features checked ...
0
votes
0answers
42 views

CAD to GDB import using ValueTable function

I have several CAD files (DWG) that I want converted to Feature Classes within a file GDB. Each feature class will be based on a polyline attribute "LAYER" value, so I have a query filter applied ...
0
votes
0answers
42 views

Custom UTF Grid Renderer performance improvement help

Back in November I asked a question (Create interactive map with no server) and had lots of great responses all of which I tried but because my dataset was so large I wrote my own custom UTF Grid ...
0
votes
0answers
60 views

Using cursors to update field that has relationships

I am still learning python and arcpy. I have spent too much time trying to figure out this code. I need help. What I have is two feature classes that have the same column names. One has older data ...
0
votes
0answers
55 views

QGIS and usage of ExportToKML()

I am trying to dump to a csv file the geometry (and attributes) of a shapefile, including a KML dump (using a python script as described in shp-to-csv) but I am unable to get the correct coordinates ...
0
votes
0answers
23 views

How to add programmatically new plugins repository in QGIS?

Is it possible to add name of repository and URL to the third part plugins repository using python in QGIS 2.01?
0
votes
0answers
90 views

Successfully extracting values from a GRIB2 file…is it possible?

Let me say first that I'm starting to work with GRIB2 files, I've read the docs, and more or less know how they are structured. My goal is to be able to parse some GRIB2 files from NOAA, more ...
0
votes
0answers
60 views

How to install python-mapscript in a virtualenv?

I am on a django project where I want to use the python implementation of the mapserver mapscript library. I was able to install mapserver and python-mapscript from source. However, due to the ...