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

learn more… | top users | synonyms

6
votes
4answers
2k views

Matching GPS tracks

I'm looking for a proper way to process multiple GPS tracks (so time ordered list of lat/lon points) and match/classify that segments, that are covered by multiple tracks: So it's not about ...
1
vote
1answer
189 views

Error Opening OpenLayers plugin in QGIS [on hold]

I have installed version 2.12 of QGIS and I have installed the OpenLayers plugin. However, when I try to add a basemap through Web > OpenLayers plugin I get the following error message "An error has ...
5
votes
1answer
2k views

How to create mask bands in GDAL and Python?

I have small program in Python that uses gdal and numpy to perform a logarithmic scale of some data into the RGB 0-255 range. Now this input data has a nodata value set to mask the valid values, and ...
0
votes
0answers
12 views

numpy.unique: ValueError: all the input arrays must have same number of dimensions

I'm trying to get the unique values of an array but am getting an error that doesn't make any sense. Here is my pseudo code: import numpy as np import gdal # I have a .tif file, call it ...
5
votes
2answers
180 views

How do I include 64 bit python with ArcGIS 10.4 install?

I recently updated to 10.4 and was hoping the 64 bit python install was automatic, but apparently it isn't. I can't remember what I did in 10.3.x to get the 64 bit python. Does anyone know how to ...
0
votes
1answer
16 views

owslib - geonetwork - Failed to establish a new connection: Connection refused

i am tring to search for a specific record in geonetwork with owslib, according to documentation in https://geopython.github.io/OWSLib/. but it fails : >>> geonetwork = ...
1
vote
1answer
40 views

Python Script GetParameterAsText?

I am writing a python script to be added to a toolbox and I do not know how to call an existing tool to be a parameter. import geocoder ##geocoding library import csv import arcpy ...
1
vote
2answers
94 views

Scripting (Python) Feature Class content into Shapefiles following an UTM data structure

Consider a Feature Class and two of its fields are "UTM_grid" and the "OID". Scripting with python 2.7 for ArcGIS 10.3. "UTM_grid" field contains the geographic info (e.g. B1SD40B) and was broken ...
1
vote
0answers
22 views

Merge points from multiple features that share common attribute

I have several point feature classes that all share similar attribute structure. How might I extract the points from all 9 feature classes that share a specific attribute? Background: There are 9 ...
3
votes
1answer
52 views

Clip raster by mask layer returns error “wrong number of parameters”

Using Python for QGis 2.14 Essen i try to clip a raster by a Polygon, as indicated here: http://docs.qgis.org/2.6/de/docs/user_manual/processing_algs/gdalogr/gdal_extraction/cliprasterbymasklayer.html ...
3
votes
1answer
43 views

Memory error in python when reclassifying array

I have a .tif that I read into an array (call it tifArray), and I would like to classify the array based on set of conditions: Where 1200 <= tifArray <= 4000, outputArray = 1 Where tifArray ...
0
votes
1answer
10 views

owslib - ValueError: All strings must be XML compatible: Unicode or ASCII

i try to use owslib to search metadata in geonetwork, and a i have problems when the string contains non ascii characters. geonetwork = ...
2
votes
0answers
23 views

Bold and Italic layer labels with Python in Qgis

I'm trying to apply some labeling properties to a layer using Python. Everything went fine, except the way I tried to apply the Bold and Italic settings. Here is a part of the code: ...
1
vote
1answer
243 views

how to find that two polygon boundaries are connected?

I am working on a Geo database where there is a layer with many polygons. i want to find that which polygons boundaries are connected so that i can create new layer from that polygons and which ...
2
votes
0answers
27 views

Approach to controlling which layers display in a QgsComposerLegend

I've tried 2 approaches to control what shows up in print legends. Neither of them work which is troubling because other than pruning the layerRootTree in advance of composer.addItem(legend), there ...
1
vote
1answer
473 views

Error in Select Numeric type column in pyodbc with ArcCatalog?

I created a python script that uses "pyodbc" plugin to connect a SQL Server database and write out data. It was imported in an ArcGIS 10.1 tool and run from there. try: arcpy.AddMessage('FLAG 0') ...
3
votes
1answer
424 views

WindowsError: [Error 32] The process cannot access the file because it is being used by another process

I am reading images (through Python) and do something. These images are placed in a temporary file, through: tf = tempfile.mkdtemp(filename) I use gdal to read the images (short part of code): ... ...
1
vote
1answer
45 views

Point otbApplication for python to the relevant OTB DLL's

I installed the latest OTB and Monteverdi on a Win 7 machine. Via osgeo4w I downloaded otbApplication for python, without any dependencies. Python, gdal, numpy scipy and so forth was custom build ...
3
votes
2answers
65 views

GDAL/OGR ogr.Layer.Intersection fails when producing mixed geometry results

I am trying to intersect layers using the ogr.Layer.Intersection method, in Python. This works fine for pairs of polygons, but I have found intersecting two linestring layers containing matching ...
1
vote
2answers
37 views

Select by attributes on PYQGIS 2.14 Essen

I'm trying to make a selection by attribute with python on QGIS Essen, but it looks like I am making a mistake on the script and I can not find it. Can somebody tell me what I have made wrong, or how ...
3
votes
1answer
40 views

Generate 1 shape out of many GPX files

I have many GPX files and i want to show them as layer on mapbox tiles. I managed to create "simple polyline" from gpx and then build GeoJson which include many features. That GeoJson is pretty big, ...
1
vote
3answers
57 views

Multiple python import from feature class into feature dataset in geodatabase

Is it possible to create a python script to import shapefiles/feature classes, from different sources into specific feature datasets in geodatabase, but in one script? I managed to write the script ...
1
vote
0answers
40 views

Getting started with GeoJSON using Python [on hold]

I am a GIS analyst who knows ArcGIS and Python pretty well and have used QGIS. I am attempting to learn about GeoJSON and web-mapping. I am looking for suggestions on tutorials explaining GeoJSON, and ...
0
votes
1answer
937 views

ArcPy SelectLayerByAttribute Error and how to control GP output layer name

I have a rather long script that first references an SDE feature class (non-versioned) to perform an attribute selection based on a SQL selection. I've been unable to figure out why the script will ...
1
vote
1answer
64 views

Writing result of PyQGIS to shapefile

I try to perform some zonal statistics on a shape- and rasterfile and write the output to a completely new shapefile! import sys # where is the module ...
4
votes
2answers
128 views
+100

How to render layer into png in a standalone application?

I would like to use standalone appliction to apply .qml style to a layer and use QgsMapRenderer() to save it as image on a hard disk. The are a lot of questions like mine at this site and it seems ...
2
votes
2answers
39 views

Sort Column and Sequentially Number Separate Column

I am trying to sort (alphabetize City) a column, and sequentially number a separate column for the purpose of labeling and creating a map key. What is the best way to do this?
0
votes
1answer
77 views

Compare features attribute

I have a polygon layer and each polygon has the MEAN elevation as an attribute. I want to write a python script to loop through each polygon and compare its elevation with its neighboring polygons. If ...
0
votes
1answer
81 views

How to delimit point distances in ArcGIS for Desktop per Thiessen polygon

I have 2 shapefiles. The first set contains x,y coordinates for 1100 hospital locations. The second pair contains x,y coordinates of about 7000 villages that are served by the hospitals. This means ...
2
votes
1answer
36 views

Drivers of Fiona

What drivers does the python package fiona have? When I check the manual it says [...] and the possible formats are enumerated in the fiona.drivers list. However, when I type in python from fiona ...
3
votes
0answers
18 views

Automatic point plotting in ArcGIS from thresholded image

I would like to know whether it is possible to plot points automatically on a map in ArcGIS by using a raster file as a reference. The image below would represent an example of line that comes from ...
0
votes
2answers
43 views

How to connect push button in dock widget form?

Following this tutorial as a guide, I created a plugin using the Plugin Builder with the dock widget form. I am now trying to connect a pushButton to a function. The following is a snippet of code: ...
2
votes
1answer
31 views

QGIS - how to retrieve information on features during editing [duplicate]

I am developing a QGIS plugin that allows me to draw QgsPoints on a vector layer. When drawing, I toggle QGIS's edit mode. In some cases, the last drawn point needs to be deleted. In order to do this, ...
1
vote
0answers
15 views

QGIS cannot load macro function?

This has me stumped. For some reason, I can no longer run a function from a project macro even though macros are enabled (from Settings > Options > General > Enable macros > Always). Just ...
0
votes
0answers
29 views

How to georeference *.tiff to a given feature geometry automatically?

I´ve got the task to georeference an tiff image to the referencing polygon footprint (Polygon). I have found a lot of ways to do get the footprint from a raster but I could not find a way to use ...
-4
votes
0answers
33 views

Can a GIS do this for me? (KL-1) [on hold]

I need to develop a system that will not only map out single family addresses, but identify a contiguous set of them (say 20), produce a map of these, and prevent subsequent runs from reusing them. ...
0
votes
0answers
12 views

owslib - GetNextFeature() - cannot parse - element arg attribute name had invalid value TYPENAMES

i am new in Python and owslib, and i try to follow advices given by Gene in ouvrir un WFS - debutant, but it fails... from osgeo import ogr driver = ogr.GetDriverByName('WFS') wfs_ds = ...
2
votes
0answers
15 views

Reading raster attribute table using gdal in python

Is there a GDAL function that can read in a raster attribute table? Something functionally similar to this function in pygeoprocessing: ...
4
votes
1answer
44 views

Can't delete features from layer using QGIS' Python API

I've only recently started using QGIS and it's Python API. Currently I've loaded two OpenStreetMap datasets. I would like to remove lines with from the second set where the name is already present in ...
4
votes
0answers
48 views

Issues updating field values programmatically for particular field data type on 64bit Windows computer using QGIS 2.8.7

I have an issue with a plugin for QGIS 2.8 I'm developing when using it on a Windows 64bit machine (as opposed to 32bit). I am trying to update values in a particular field in my plugin, and the ...
0
votes
1answer
37 views

How do I convert a DEM GeoTIFF to Contour Shapefile

I have a digital elevation model as a GeoTIFF and I'm looking to generate a Shapefile of contours with 5m bands on the command line. Is this possible? Ideally using GDAL and Python.
1
vote
0answers
16 views

QGIS 2.14.1 Processing Plug-In does not work anymore (Python error)

I did not change anything and started QGIS 2.14.1 today and was greeted with the following error message. So the Processing tab is missing and I cannot activate it. The error: 2016-04-26T17:58:43 1 ...
3
votes
0answers
14 views

Python with ArcCatalog for Table or Geography view?

Is there a way to automate the preview tab in Arc Catalog using Python? Say if I wanted to preview the geography of a feature class where I have the path and just don't really want to connect to the ...
2
votes
1answer
319 views

How to deactivate my custom tool by pressing the Escape key using PyQGIS?

I'm developing a QGIS plugin and I have created a custom tool. Once the process is over, if the user presses the ESCAPE key, I want my custom tool not to trigger mouse events on the map anymore. How ...
3
votes
2answers
38 views

Find points that intersect a user-defined polygon in GDAL

I'm trying to do something that I don't know is possible in GDAL/Python. I have a list, L, of pre-defined lat/long points that make up a uniform grid. A user will send me a set of points that make ...
2
votes
0answers
34 views

How to use ST_VoronojDiagram for points that are almost aligned?

I am trying to use the spatialite ST_VoronojDiagram function on a table containing four 4 points that are almost aligned: (1.01 2.02, 2.02 3.03, 10.01 10.02, 11.01 11.02). I wrote the following script ...
4
votes
2answers
841 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 ...
5
votes
1answer
337 views

ArcGIS Python Security Concerns

I’m working for a large organization which are using ArcGis Desktop on some (windows) clients. The security requirements for the system is very strict, and a part of that is prohibiting the users the ...
0
votes
0answers
47 views

ArcGIS 10.2x64: Batchfile->Python->Batchfile->Python with Arcpy [on hold]

I'm using ArcGIS 10.2 x64 with Python 2.7. Here's the outline of what I'm trying to do: Step 1 - Execute a batch file which kicks off a python script, pylaunch.py, which imports arcpy Step 2 - ...
-1
votes
1answer
40 views

Listing Points Within Polygon for Hadoop? [closed]

I am very familiar with a point in polygon analysis but instead of counting how many points are within each polygon. Does anyone know how to list the points within the polygon and add a field that ...