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

learn more… | top users | synonyms

4
votes
2answers
68 views

ArcGIS Toolbox, parameters for python script not as positional arguments

I have an ArcGIS Toolbox with a bunch of parameters. A python script is used to perform some raster operations, based on this parameters. I am using Python argparse in the script to get the ...
1
vote
1answer
41 views

Calling QgsProjectionSelector from QGIS Python plugin?

I am trying to create a dialog that allows the user to select a coordinate system from either the recently used projections or a general list of all available projections. This would basically offer ...
0
votes
0answers
33 views

when using arcpy.mapping.ListDataFrames, python.exe crash

Has anybody had this problem? this drive me crazy. what is wrong with my code? import arcpy mxd = arcpy.mapping.MapDocument(r"D:\Project\Project.mxd") df = arcpy.mapping.ListDataFrames(mxd, ...
0
votes
1answer
70 views

How to select a feature and get its fields by mouse click using Python Addin in ArcGIS?

I'm building a python addin tool in arcgis and I would like to click a feature, say a polygon on the map, and get the polygon's attributes,i.e. ID=3,NAME = "CITY3"...It's similar as the arcmap tool ...
-4
votes
1answer
34 views

how solve this proplem :NoneType' object has no attribute 'start' [closed]

patternRE = re.compile('(^|\s|\")([^\s]+?)\",{'+str(HeaderLineIndex)+'}') #patternRE= '\n("."){'+str(HeaderLineIndex)+'}' #patternRE=re.compile('(^|\s|\")([^\s]+?)\",') Buffer = ...
1
vote
0answers
60 views

Batch Zonal Statistics to Spreadsheets?

I have a pretty immense amount of Zonal Statistics as Table computations to do, and would love to find a way to grab mean and variance values from the little .dbf tables ArcGIS creates and put them ...
0
votes
0answers
69 views

GRASS “Argument list too long” with run_command

I have a python script that uses the grass.script.run_command function to read in, process, and export a bunch of raster files. On projects where I have a large number of rasters (>1,000), it fails ...
0
votes
0answers
16 views

Is it possible to override default QGIS error messages?

From my QGIS plugin I would like to override/replace one of the the default QGIS error message ("The layer layer_url is not a valid layer and can not be added to the map") with my own message. I have ...
3
votes
1answer
38 views

How to choose workspace when uploading SLD to Geoserver with the REST API

I have 200+ SLD's I would like to upload to Geoserver using the REST API. I successfully uploaded an SLD using the gsconfig Python module. However, I would like to be able to set the workspace when ...
0
votes
0answers
34 views

leaflet.js ImageOverlay projection bug

We are trying to display a image over the leaflet map using "ImageOverlay" layer, but it does not work according to expected. In Google Maps works perfectly. Apparently Leaflet just stretches the ...
0
votes
0answers
18 views

Using file directories from a table

I have a toolset that will be using a set of file directories as input (shapefiles, raster etc.).The table can be stored as CSV or DBF. Is there a way to read a specific cell (row,column) of the ...
0
votes
3answers
77 views

Python QC field calculator

I am new to Python and am trying to run a simple QA/QC on a particular set of fields. I basically want to verify that fields x and y add up to z, I may have to incorporate rounding since a small ...
0
votes
0answers
42 views

Accessing CRS info with pyqgis in a standalone application

I'm currently having trouble accessing and defining CRS information in a standalone application. I've read the API documentation and have tried it in the python console in QGIS 2.2.0. The python ...
1
vote
2answers
99 views

How to create a Shapely LineString from two Points

If have two points, from which I want to create a straight LineString object: from shapely.geometry import Point, LineString A = Point(0,0) B = Point(1,1) The Shapely manual for LineString states: ...
0
votes
1answer
63 views

How to use “this” Levenshtein Python code into ArcGIS 10

I need some help with this: First of all, I wanted to "Compare strings from two fields", and asking before at gis.stackexchange, in this post someone help me with this topic, referring me to a Python ...
2
votes
1answer
156 views

How to compare string fields in the same table with ArcGIS 10

I don't know exactly if there is a tool for this or a maybe a python script could be more suitable. I want to compare string elements from a field (POI_NAME) with another string element in another ...
0
votes
0answers
39 views

How to pass a layer to a thread in PyQGIS?

In my plugin, a user can select one of the loaded layers from a combobox, and then proceed to do further calculations. These calculations are done in a separate thread, "WorkerThread". My question is ...
1
vote
1answer
82 views

syntax error when using gdal in python console QGIS

When I run the following code in the python console in QGIS I get a syntax error: import osgeo.gdal gdal_rasterize [-b 1] [-burn 255] [-a Pixelkost] [-te 170000.2 168000.27 177999.8 177999.8] ...
2
votes
1answer
141 views

ESRI File Geodatabase with a field calculator with an incrementing number

I've got a python script that runs on the Field Calculator of a ESRI File Database. Right now it runs correctly in that it will increment the last three digits of the value. But this is a script ...
1
vote
1answer
125 views

Configuring spatialite database access for Python 2.6.6

I'm working on a GIS project, and I would like to implement and test some geo-spatial algorithms in Python. For this purpose, I will not only need sqlite, but also spatialite, in order to store and ...
1
vote
1answer
211 views

How to open a shapefile using Python in QGIS?

I have tried to open my shape files with the help of a tutorial (http://spatialgalaxy.net/2012/01/27/qgis-running-scripts-in-the-python-console/) but unfortunately I couldn't open my shapefiles for my ...
0
votes
1answer
88 views

How to compare two rasters and reclass the greater value(python script)?

I am working on an assignment that requires us to reclass a raster(via python) from two rasters. We need to compare the power received at one cell(on raster1) and compare it to the same cell on raster ...
2
votes
3answers
153 views

How to extract data using arcpy.da.SearchCursor

I have a shapefile of point features showing fire locations in a given year. One of the fields is named "YYYYMMDD" and indicates the corresponding date that that fire happened. In Python, I am trying ...
0
votes
2answers
99 views

Matlab script - how to access from/run in GRASS GIS?

I am currently working on shell script in GRASS GIS and Ubuntu. At some point, I must run a calculation (based on an ascii grid) that I have available as Matlab script and .exe (created from Matlab I ...
0
votes
0answers
19 views

Call post-execution command manually in QGIS Processing

I wrote myself a Processing Script and it works fine. Now i want to style the outcome (a new raster layer) with a QgsColorRampShader(), but the problem is that Processing adds the output after the ...
0
votes
1answer
55 views

How to set up pycsw on xampp (win7)?

I'm trying to setting up pycsw on xampp. In the pycsw's default.cfg I've the following configuration: [server] home=C:\Users\masa\xampp-201405\htdocs\pycsw url=http://localhost:8000/pycsw/csw.py ...
0
votes
1answer
54 views

an efficient way to find the pgrouting edges contained within an isochrone

So I am working with some pgrouting road network data in postgis2.0/postgresql 9.1. I am interested in routing around certain types of disasters like tornados or such. If a disaster event happens at ...
0
votes
1answer
63 views

Get the outer ring inner ring for a given polygon using ogr python binding

I am trying to read the geometry of some shapefiles, now I meet some problem when I try to identify the polygon with holes, since a polygon may(or not) have one hole(or multiple holes). This is the ...
1
vote
1answer
91 views

Union multiple shapefiles with overlapping shapes

I have several shapefiles that overlap and I would like to union their geometries to get rid of those overlaps. I know how to do this with OGR and Python for single geometries. from osgeo import ogr ...
1
vote
1answer
50 views

Updating a Tool Validator Class from a CSV File

I have a CSV file which contains a list of clients and different project numbers and project names. This list is generated periodically. The list can contain multiple values for client name but ...
1
vote
1answer
61 views

pyshp problem with naturalearthdata-shapefile

trying to follow this example: https://code.google.com/p/pyshp/wiki/ShapeRecords entering the following code: import shapefile r = shapefile.Reader("ne_110m_admin_0_countries") sr = r.shapeRecords() ...
1
vote
1answer
28 views

Error in LineEdit when show parsing value as string

I m trying to make QGIS plugin to open xml, parse it and then show value i parse from xml to line edit, i use this code : from PyQt4 import QtCore, QtGui from ui_testparse import Ui_testparse import ...
0
votes
3answers
121 views

Multiple Conditional Statement with in a Con Tool

Well i want to apply multiple conditional statements within a Conditional tool. My aim is to loop through a list of rasters and on the basis of a specified range assign each range with a constant 1, ...
0
votes
2answers
53 views

How to make variables output to user defined workspace

I am running a script in ArcMap and I want to reference the user defined workspace as an output instead of hard coding it in. I have the scratch output set as a user defined parameter. However, I ...
0
votes
1answer
61 views

Import raster into PostGIS using Python

I am trying to import information from a Bathymetric Attributed Grid (BAG) file into PostGIS using Python and psycopg2. I'm working, for now, on a Windows box with pre-compiled packages, so I don't ...
3
votes
3answers
282 views

What is the simplest way to write data to CartoDB using Python?

I'm trying to write a function in Python that will use the CartoDB API to write data to one of my tables. Does anyone have a simple example that shows how to do this that I can use to start?
3
votes
1answer
134 views

How can I rename multiple feature classes (each different name) using Python?

I have a geodatabase including (cnty06,cnty07,cnty08,cnty09...) that I'd like to rename to (c06,c07,c08,c09...). I can use the ModelBuilder (or script from ModelBuilder) to complete this task. Is ...
1
vote
1answer
108 views

How do I plot a line on a map, or obtain the latitude and longitude coordinates of such a line, that is 120km north of the US-Canada border?

How do I plot a line on a map, or obtain the latitude and longitude coordinates of such a line, that is 120km north of the US-Canada border, including parts of the border that cross water? (I managed ...
1
vote
1answer
59 views

Error with data frame in python script

I'm running a python script from arccatalog and it works, however, I am trying to add layers to an mxd and need to declare the data frame. I keep getting this error message. type ...
3
votes
1answer
91 views

Spatial Classification

I am not sure what to call my problem. From this image, I have a set of classified polygons (colored). I would like a way to classify the white polygons in the image. I don’t have any attributes to ...
1
vote
1answer
55 views

Shapely WKT precision/rounding

I'm using Shapely's wkt.dumps function to get WKT from geometry objects. I can't seem to find a way to limit the precision of the coordinates. Any help is appreciated.
2
votes
3answers
83 views

Creating a simulation of how people moving around a site

I am working on a project aiming to create a geographic simulation for how people interact around a site. Situation: There are x people in an enclosed area (such as a zoo). There are y locations to ...
0
votes
2answers
60 views

Use Python lists in Field Calculator?

I couldn't find this question, although I am sure it has been asked. How could I use a python list to condense this script? This code block currently works, but is clearly not very efficient. def ...
0
votes
1answer
49 views

“ImportError: No module named fiona” (post-installation of package)

I'm in need of the Fiona and Shapely modules to develop a QGIS 2 plugin, and thus downloaded them from http://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal and installed them. I have no trouble importing ...
0
votes
0answers
46 views

MODIS products reprojection problem

I am working with Modis Data (MOD02, MOD11, MOD03, MOD35). In particular I am looking for a solution to reproject the subdatasets below, into albers equal. Because I am using NLCD dataset which uses ...
1
vote
0answers
38 views

PyQGIS: How to color raster layer with existing colorBrewerMap

With pyqgis I have added multiple new raster layers to the legendinterface(). Because i like the ColorBrewer style i want to color some of them with the "Spectral" gradient. How can I do this in ...
1
vote
1answer
75 views

Parsing metadata text files with Python

I am trying to use python to parse the .pvl metadata file from some GeoEye imagery. I would like to write a script that locates the productCloudCover and countryCode tags found within the .pvl. Does ...
3
votes
1answer
104 views

Why does the next() method fail after the last record, using arcpy.da.SearchCursor?

Using the older arcpy.SearchCursor, the next() method would return Nothing once the last record had been passed. Using the newer arcpy.da.SearchCursor, I'm finding that the next() method crashes the ...
0
votes
1answer
84 views

Auto increment a new column using Model Builder Field Calculator in QGIS?

I am making a model which requires creating a grid and clipping various layers to it. Using the Create grid function does not provide an ID column, instead it creates 2 columns: "longitude" and ...
3
votes
2answers
97 views

A python tool like GNU's diff for shapefiles?

I often use the GNU diff tool to compare two files or even two folders for differences. I was wondering if there is a Python based tool out there that does basically the same for shapefiles? In the ...