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

learn more… | top users | synonyms

3
votes
1answer
137 views

Shapely/ Python looping through a number of polygons

I am trying to loop through a set of polygons in shapely so using python) to determine whether they overlap or not. I do not want to do it manually as later i want to generalise the procedure and do ...
4
votes
1answer
82 views

Is there a public API that can be accessed with Python and will geocode Points of Interests?

I recently downloaded tagged hospital data from OpenStreetMaps.org using the API. Some of the data have a 'node' tag which are attributed with a lat/long while other data are tagged as 'way' format ...
3
votes
2answers
89 views

Extract values from raster based on points and pixels adjacent to the point

I have an issue. I have a set of points (n=~2000) and I would like to extract the pixel values from multiple rasters (a single-raster solution is also ok) for location of that point as well as that of ...
1
vote
1answer
47 views

how to open shp file which created by using python-ogr in qgis?

I have done following steps, so how I open that created shp file in Qgis driver=ogr.GetDriverByName('ESRI Shapefile') out=driver.CreateDataSource('pts.shp') ...
0
votes
1answer
38 views

Arranging elements horizontally in ArcGIS tool

Is it possible to arrange multiple check boxes horizontally in a tool and changing the parameters dynamically (adding/removing) based on user selection of check boxes?
2
votes
1answer
41 views

Cut polygon shapefile with 2 parallel lines to derive new inside polygon?

Using Python scripting: How can I clip a polygon shapefile with parallel lines (polyline shapefile) to derive new inside polygon?
7
votes
0answers
177 views

Geotransformation for polar stereographic?

I'm currently working to import CANGRID climate data (provided as Surfer Grid ascii, ".grd" files) into ArcGIS. The grid is 95 rows by 125 columns in size.Metadata provides lat/lon of origin (lower ...
3
votes
1answer
59 views

Trying to generate a PDF for each feature in a feature class based on an attribute with Python.

I have a feature class of points that represent storm water inlets. I am trying to automate a process that does the following. finds all of the inlets that have a field called "Marker" populated ...
1
vote
0answers
31 views

Error writing defaultdict values to feature class rows

I originally posted building dictionary from feature class field values, how can I ensure there are no duplicate values per key. The goal is to update another field with all the values per key, which ...
0
votes
0answers
58 views

Python trainings comparison

My employer provides me with a generous annual training budget and I'd like to use it on one of the following two Python courses. As a GIScientist, I would like to attend the course which will give ...
2
votes
0answers
36 views

How to Use GetGeomtype Gdal Python

I am just wondering what I am doing wrong when trying to use the GetGeomType. I need to focus on separating layers from a pix file. Two categories are the bitmaps(which are vectors) and then the ...
1
vote
2answers
50 views

building dictionary from feature class field values, how can I ensure there are no duplicate values per key

I found this code sample that builds a dictionary from two fields; the end result is a concatenation of all values per key to a new field. It's a great tool except that it doesn't account for ...
0
votes
2answers
59 views

Select Layer by Attribute: SQL and variable problems

I've had a good look around the site and haven't been able able to find any 'select by attribute' questions regarding string variables and how to integrate them into an SQL statement. In my particular ...
0
votes
0answers
60 views

Error selecting geometry from Oracle DB

I'm trying to select a geometry column as well-known text from a feature class in an Oracle 11g/ArcSDE 10.1 geodatabase. (This is in a Python script using pypyodbc as a driver). This is my SQL: ...
2
votes
1answer
48 views

Compiling custom plugins for QGIS on Windows

I've made my first plugin using plugin builder and I want to compile it. I read that I need two commands to do it under windows: pyuic4 and pyrcc4. But when I use any of these commands I get this: ...
1
vote
0answers
52 views

How to change color ramp in graduated classification with standard deviation using pyqgis

I'm using graduated clasiffication with standard deviation to style my shapefile (see code below). But I need to use different color ramp for classes below mean (-1std, -2std etc.).I'm thinking of ...
2
votes
1answer
35 views

ERROR 001243 preventing automatic publishing of geoprocessing service

I am trying to automate the process of publishing a geoprocessing service to ArcGIS for Server 10.2.2, using a python script: import arcpy result = r"C:\data\ContourLineFunction.rlt" ...
1
vote
1answer
30 views

Speeding up length calculation in QGIS 2.0 Python plugin

In a qgis 2.0 plugin for windows, I calculate length and update a field with the values. It works, but takes a lot of time. Execution for this part only takes about ten minutes. Can anyone suggest ...
3
votes
2answers
53 views

How to calculate the a list of rasters?

I'm writing ArcPy code in ArcGIS trying to calculate a list of rasters. I get an error message that says: TypeError: unsupported operand type(s) for -: 'unicode' and 'unicode'. Here's my ...
1
vote
0answers
16 views

Print Custom Feature Form using PyQGIS

I recently asked a question and accepted the answer, as it was a good guide on accessing the print composer using python. However, I am still looking for a way to print the custom feature form. Does ...
0
votes
2answers
80 views

Improving this script - GPX reading and processing with Python OGR

I am trying to plot every GPX trace I have in a folder, by reading it with Python-OGR, clipping it by a bounding box, and plotting Curently I have a working script, but it seems very uggly, and I ...
2
votes
2answers
128 views

Use updatcursor to replace values in multiple fields

I have spent a couple days digging through forums here, ESRI help and elsewhere and each variation of the codes I have tried has not worked. As best as I can tell this is due to my attempt to loop ...
1
vote
2answers
67 views

How to label only house number in python? [duplicate]

I have parcel data that has the site address field as ex. 123 First Avenue. I only want to label the house numbers on the map, so 123 in the example. How can I do this using the label expression in ...
2
votes
2answers
49 views

No plugin icon in the toolbox in QGis 2.4

When i'm loading my plugin into QGis 2.4 the icon doesn't appear in the toolbar. There is only an empty button. I have the icon.png in all the necessary files: resources.py: <RCC> ...
3
votes
0answers
38 views

Get value from Metadata in Python Script for attribute

I am working on a python script to create some feature classes from dbf tables. As part of the script I would like to pull two values (FGDC "publication date" and ArcGIS Spatial Reference ArcGIS ...
1
vote
1answer
38 views

Issues with FME and the ArcInfo licence

I have ArcInfo 10.2.1, Python 2.7 and FME 2013 SP4 installed on my Computer. I want to run a python script I exported from ModelBuilder (where it ran without issues) and imported in FME as shutdown ...
1
vote
2answers
41 views

How to provide a default value in an arcpy script?

How do I provide a default value like recommended in every Arcpy script? This script is exported from ModelBuilder where every output except the last one is set to temporary and managed. I want this ...
1
vote
1answer
29 views

How to Set Label Expression Using a Long Field Type in Toolbox

What I am hoping to be able to achieve with this Tool within my Toolbox is to allow the user to input a number of layers and to set all of the labels with the same font settings (font style, color, ...
1
vote
1answer
45 views

Can't Remove a Menu in Python Add-in

I have a Python add-in with a good amount of buttons and menus. I'm trying to remove a menu using the addin_assistant, but the menu isn't being removed from config.xml. I've tried removing the add-in ...
0
votes
0answers
24 views

export qgis point symbols per feature

I am currently trying to export the drawn symbol in a QGIS map for a webmap. The current approach is to extract the properties: if i.rendererV2().dump()[0:6] == 'SINGLE' and i.geometryType() == 0: ...
2
votes
0answers
80 views

Script to unzip a file geodatabase fails with Memory Leak

Hijacked the ESRI script to unzip. After research I found there is a memory leak. There are three zip files I download on a regular basis. Each .zip contains one (1) .gdb. The largest is 2 GB zipped, ...
1
vote
1answer
77 views

How to create a shapefile or gml from a Oracle database using SDE.ST_Geometry?

I have a ORACLE database 10g(Oracle Database 10g Enterprise Edition Release 10.2.0.3.0) with a SDE.ST_Geometry field and i want to make a program in python so i can create several shapefiles based on ...
0
votes
2answers
64 views

arcpy calculate string field: Any ideas what how to fix this?

I'm trying to store a string value obtained from a loop through a tuple into a field called ROW_1. The code goes like this: for creekclass in listOfClassTuples: (classname, Permanency, ...
2
votes
0answers
46 views

QGIS 2.2.0-Valmiera 64bit on windows 8.1 displays error while creating ROI in SAC plugin

I don't know what happened while creating ROI during Classification using Semi automatic Classification Plugin 3.1.0 "Rome" installed on hp Pavillion i7 with windows 8.1 When i started to generate ROI ...
3
votes
1answer
124 views

Using GDAL in python to stack Landsat bands

I am processing a large amount of landsat data. Landsat scenes ship as a collection of tiffs- one file for each spectral band, plus a bunch of masks. I need to stack some of the bands into a single ...
1
vote
1answer
43 views

Using Selection Sets with Python

I am trying to build a model that reads through about 30 different point feature classes and appends only the selected features to a new feature class. Some of the feature classes don't have any ...
2
votes
2answers
76 views

How to open the “File Browse” dialog in Windows from a PyQGIS plugin code?

I am in the process of developing a plugin for QGIS using Python. Note that this is my first plugin, so the query could be quite basic... I have used this Digital Geography link to create the basic ...
1
vote
0answers
41 views

midpoint of segments in QGIS determination

Gene thanks for your note on the problem yesterday ... This is a follow up to a question I posed before (How to find the middle point of a line in QGIS - Where to place input file name). Errors coming ...
1
vote
0answers
52 views

Is there a python function in QGIS to detect if the output file is saved to the hard disk?

I'm currently using QGIS 2.4 and writing some custom scripts on it. A proper script not only accomplishes its function, but also accepts user defined parameters and checks for possibilities of errors. ...
2
votes
2answers
54 views

csv to shp missing file

I transform a csv file into a shape file using the following script import shapefile as shp import csv import tkinter.filedialog import urllib.request import os a = ...
2
votes
1answer
60 views

Exporting layout elements and constants to Python script?

Is it possible to export the elements and constants used in a layout to a Python script? Something similar to creating a model and exporting it to Python but instead of being a model, it's a layout? ...
2
votes
1answer
52 views

Adding new Field and writing values for all features

I need to create new Field in Attribute table of vector layer, and afterwards to calculate values and store them in that Field for all features I have in that layer. I have solution which works, but ...
3
votes
4answers
282 views

Having trouble with 'and' 'or' statements and negative numbers

I have set up a program that calculates the relationship between a point and the first point of a polyline. The aim of the program is to run this calculation and then copy the result to a certain ...
1
vote
0answers
66 views

QGIS Add WMS layer with python

I'm developing a stand alone python script using QGIS 2.2.0 libraries. I want to add a WMS base layer to my map, and I follow the instructions reported by the documentation: urlWithParams = ...
3
votes
2answers
60 views

Python, OGR and Mapnik: Possibility of passing existing ogr.Open() datasource into Mapnik without using mapnik.Ogr()?

Okay, I'm trying to modify create_utfgrids.py to use an OGR VRT file, rather than shapefiles, and while the OGR stuff in this code responds to the VRT, the Mapnik stuff is not. It's failing with.. ...
0
votes
0answers
19 views

Using setCrsTransformEnabled in qgis 2.4

In the python console of qgis I try to load layers from shapefiles which have different CRS using the setCrsTransformEnabled() method. To test the procedure I changed the CRS of the shape file using ...
5
votes
1answer
61 views

PySAL natural breaks from Numpy array

I am attempting to extract natural break values from a raster using Python. The intended process goes: Arcpy raster object to NumPy Array (using RasterToNumPyArray) to natural break values (using ...
4
votes
0answers
72 views

How to create a python plugin in QGIS 2.4.0?

While I am learning to create a python plugin in QGIS 2.4.0, I have followed the proceedure expalined in ...
1
vote
2answers
162 views

GDAL/PYTHON: Batch Process Project All Level 2 HDF Files Only(Filter) and save to new directory

I have downloaded numerous hdf files from an ftp site. Let's say I already have 500 hdf files, 250 of them were level 1 hdf files and the rest were level 2. The level 1 format is: ...
1
vote
0answers
46 views

User input and passing variables with ModelBuilder

I have created three modelbuilder tools that must be run in sequence. After running each tool, the user must examine several shapefiles and potentially change the input parameters of the next tool. ...