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

learn more… | top users | synonyms

3
votes
2answers
67 views

Using arcgis.rand() with variables from code block of Calculate Value tool?

Within a larger ArcGIS ModelBuilder model I am trying to populate a field in an attribute table with a random number, using Calculate Value. The overall distribution of random numbers needs to follow ...
2
votes
0answers
36 views

(How) can I write string data to a raster with Python/GDAL?

In Python, I have a NumPy array of string values (categories of some variable) that I'd like to write to a raster file (.tif or .img) using GDAL. The impression I get is that it's not possible to ...
1
vote
0answers
29 views

Vector layers without geometry in QGIS?

Using QGIS, I have set up a couple of automated layer additions via the toolbar. After adding geometry in each respective layer (point, lineString, polygon) and saving changes to the layers, the added ...
1
vote
1answer
39 views

User defined parameter within code block of field calculator - Modelbuilder - ArcGIS - Python

I am using Reclass within a Code Block in Field Calculator in a Model to calculate field values for a variable based on several other fields. Using reclass is much quicker than select and then using ...
2
votes
0answers
21 views

Align & Sum Grids in Python

I have two grids. One, call it A, is 4320x2160 cells and spans the whole globe. The other, call it B is 8640x3432 and spans the circumference of the globe, but is clipped toward mid-latitudes. Both ...
1
vote
1answer
58 views

Summary statistics on attribute table

I've got a polygon feature class with attributes fields y2010, y2011, y2012, y2013, y2014, country The 'year' fields contain counts of an event occurrence, which can be 0 or > 0. The 'country' field' ...
2
votes
2answers
102 views

Fastest way to transform WKT in python

Is it possible to use pyproj to transform WKT without creating geometry objects such shapely geometry, GEOS geometry or OGR geometry. If not what is the fastest way to do it?
1
vote
1answer
37 views

Import shapefile is not working in pyshp?

I am just trying to use "pyshp" package to open shapefile in Python and use the Attribute data for further development. Firstly I have downloaded pyshp package for python 2.7 and installed it in my ...
0
votes
0answers
30 views

arcpy.Clip_analysis() Automatically Affixing .shp.shp to Target Feature Class Name?

I created a Python script that was previously working fine, but is now giving me an error when I try to use the arcpy.Clip_analysis() function in arcmaps 10.2.1. I am not adding a filetype extnsion ...
1
vote
1answer
24 views

PyQgis Message Bar Woes [closed]

Having a bit of trouble with the basics of getting the (awesomely discreet) new user prompt/warning to properly display. Here is the (troubled) code I am using: self.iface ... ...
6
votes
1answer
129 views

How to get status of a layer in geoserver using gsconfig?

I am getting all published layers from geoserver using gsconfig using following code: from geoserver.catalog import Catalog cat=Catalog("http:// localhost:8080/geoserver/rest") myResource = ...
1
vote
0answers
36 views

Rendering points and polygons with Mapnik

I've tried to render a few maps in Mapnik and I have a little problem. I want to render a map that contains two layers: point and polygon. I've used this script: import mapnik rule = mapnik.Rule() ...
0
votes
1answer
36 views

Is it possible to import arcpy module to PyPy interpreter?

I'm trying to use PyPy for my code because of speed. But my code needs arcpy module to run and I cant find out how to install or import this module to arcpy. I'm using PyPy 2.3, Python 2.7 and Win 7. ...
-1
votes
0answers
48 views

ImportError when trying to import ephem module into ArcGIS Python script tool

I have ArcGIS 10.2.1 installed with Python 2.7 installed. Subsequently I installed Python 2.6 in the C:\ directory. I've downloaded and installed ephem 3.7.5.3. However, I keep getting the following ...
1
vote
1answer
36 views

How I get dbflib module for python27

I'm trying to use a script by python to download MODIS imagery. I follow this script: http://pyevolve.sourceforge.net/wordpress/wp-content/uploads/2009/02/modis.py. I installed: ...
1
vote
0answers
14 views

Vector Layer Symbol (ism) properties?

I would like to streamline the render of a polygon grid vector layer as a simple line (no fill) via Python coding. I am I bit confused by the implementation referenced by the API. Is it possible to ...
1
vote
1answer
40 views

Convert list of coordinates to OGRGeometry or WKT

I am using a Visvalingam-Whyatt simplification script and the output is a list of coordinates such: [[[[-10885205.10690245 3525662.26531131] [-10885369.01690829 3525374.0741439 ] ...
1
vote
1answer
35 views

Get coordinates from polygon outline with greatest distance

I'm looking into a task in ArcGIS 10.2 of which I need to discover the two points on a polygon outline where they would be at the greatest distance from each other. I have looked at ET Geowizards ...
3
votes
2answers
57 views

assign a number for each group in field calculator

I have several thousand features each of which has a name. The names are not unique. what I want to do with the field calculator is assign a number to each name so I can refer to a number and always ...
4
votes
1answer
109 views

QGIS 2.2 - possible to do a JOINS from the Action list?

I have a set of layers that need to be joined (Layer Properties > Joins) to one specific layer. The reason for this is that I will be updating and adding new layers into my project and would like a ...
2
votes
1answer
27 views

Error reading large virtual raster with rasterio: “Cannot invert degenerate transform”

I've created a virtual raster using gdalbuildvrt, which covers a large extent (England) at a high resolution. The data is fairly sparse, focused around the coastlines with no files covering inland ...
1
vote
0answers
34 views

how to call the method of DescribeFeatureType in owslib

I want to execute DescribeFeatureType operation of wfs services. However, I can’t find the method to fulfill this operation in the owslib. Can anyone kind enough to tell me how to do this. The ...
0
votes
1answer
34 views

python code to create an intersection loop with a geodatabase [closed]

I am trying create a loop that will intersect each individual township with a statewide section layer. I am having trouble with the syntax of the intersect tool I think, but maybe it is something ...
1
vote
0answers
26 views

How to make crs transformation of a QgsVectorLayer?

I need to transform QgsVectorLayers in python from one crs into another crs. By googling I found the following solution ...
2
votes
1answer
37 views

SetFeature creates infinite loop when updating sqlite feature using OGR

when using the SQLite driver in python - setting a feature after changing an attribute field value creates an infinite loop on the first record. the same code works fine if i substitute the sqlite ...
1
vote
0answers
34 views

How to programmatically interrupt QGIS initialization and startup

I'm wondering how to interrupt the initialization of QGIS 2.0 on Windows XP before start up. I've put a dialog in one of my plugins that shows up on start up. However, I'd like to make a quit button ...
2
votes
0answers
45 views

Saving/Loading QGIS style .qml and avoid specified symbology

Is it possible to save QGIS styles without the symbology style? This may seem like a strange question, but I am trying to automatically set the ValueMap widget under layer properties via a plugin for ...
1
vote
1answer
38 views

Replacing text string on layout text element by reading lookup value from table via SearchCursor?

I'm not sure what the best way is to go about this, but here's my situation: In short, I exported a domain to a table (and I exported the table as a CSV, too, just in case it might be easier to work ...
0
votes
1answer
28 views

Rank cell values across multiple grids

I have multiple grids, one for each month of a year. I would like to create a new grid for each month/year combination that the cell value is the percentile rank of that cells value in the grid stack. ...
3
votes
1answer
42 views

raster landuse calculation

I want to calculate the counts of each landuse type based on the unique landuse code from each raster datasets. Raster dataset consists of six major landuse and their unique codes are below: 1) ...
0
votes
1answer
49 views

How to delete column/field in PyQGIS?

How to remove or delete column fields in a shape file using python?
2
votes
1answer
69 views

Is there any way to fast read pixel value using gdal in C#

I create with C# a series of lat/lon value pair in the code(using i, j loop) and I want to extract the pixel value based on either lat/lon pair or pixel location (i, j). I know there is one gdal ...
0
votes
0answers
29 views

geoprocessing service keeps running with default value for choice list, instead of actual value selected

I have published a script tool to a geoprocessing service. The tool is supposed to take user input from a choice list (which contains values from a field), and then that is loaded into select by ...
4
votes
0answers
105 views

addins vs python tools, which makes more sense? [closed]

With the upcoming release of ArcGIS Pro and the eventual retirement of Desktop and ArcObjects does it make more sense to start new customizations in python or continue to use ArcObjects/addins for the ...
1
vote
2answers
72 views

Exporting lists of Feature classes and fields from SDE

I'm using matt wilkies' arcplus module http://gis.stackexchange.com/a/5943/16793 to export a list of feature classes within an SDE database to a text file. I've also written a tool to write field ...
0
votes
0answers
48 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 ...
0
votes
1answer
22 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 ...
3
votes
2answers
174 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 ...
1
vote
1answer
62 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 ...
1
vote
1answer
40 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 ?
3
votes
1answer
43 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
0answers
69 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 ...
0
votes
1answer
41 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 ...
2
votes
1answer
37 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 ...
6
votes
4answers
645 views

How to optimise and speed up Python code? [closed]

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 ...
1
vote
1answer
34 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 ...
0
votes
2answers
38 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
49 views

How to write a (memory) 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 ...
0
votes
0answers
34 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 !
1
vote
1answer
33 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, ...