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

learn more… | top users | synonyms

3
votes
1answer
82 views

Programmatically finding polygons which are >90% overlapped by another vector polygon layer using QGIS?

I'm trying to figure out how to use python to extract the polygons in one vector that are overlapped by >90% by another vector. I would then like to have a vector/map that will only show those ...
0
votes
0answers
15 views

How to set “draw line inside polygon” using Python?

In the QGIS properties of a layer I want to activate "draw line only inside polygon" for a specific layer, but using Python. I don't want to use the GUI for it. Can this be done? if so, please advice! ...
0
votes
0answers
21 views

Reading and writing block windows with Rasterio? [on hold]

I'm trying to go about reading large rasters by the block windows in Rasterio. Everything works and I can iterate and output the flat file for my coworkers, but I can't for the life of me figure out ...
1
vote
0answers
32 views

How to generate surfaces of different heights from LIDAR points

I am seeking a way to generate surfaces of different heights from LIDAR point clouds.The typical application is like roofs, which may include holes, due to different heights. However, most tools, ...
0
votes
0answers
12 views

PYQGIS Layer to KML?

I am aware that it is possible, in QGIS, to save your Vector Layer as a KML file manually, however, I want to know if there is anyway I can do this programmatically from an external Python Script that ...
0
votes
1answer
227 views

Can't get the correct version of GDAL installed to use ReadAsArray without getting error in Python

Using the instructions here . . . https://pythongisandstuff.wordpress.com/2011/07/07/installing-gdal-and-ogr-for-python-on-windows/ I downloaded the following files: GDAL-1.11.1.win-amd64-py2.7.msi ...
0
votes
1answer
39 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 ...
0
votes
0answers
16 views

QGIS error: 'NoneType' object has no attribute 'isGeosEmpty'. What's wrong with this union?

I'm trying to union two vectors. The red + grey polygon layers shown above. When I run union I get the following error: 'NoneType' object has no attribute 'isGeosEmpty'. Any help with what may be ...
1
vote
0answers
36 views

How to convert Shapefile to KML in Python

My goal is to extract certain shapes from a shapefile, and render the chosen shapes in a KML file. From searching gis.stackexchange, I was able to piece together the necessary components, and the ...
1
vote
2answers
269 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
2answers
4k views

From coordinates find country using Python

I have tweets with coordinates. I'm trying to bucket the tweets by country using the coordinate information. I know that I can achieve this using some hosted web services but all of these have API ...
8
votes
2answers
2k views

How to add a toolbar via python?

Through tutorials I learned how to add a toolbutton to the plugins-toolbar via python. Now I wonder how to add a complete toolbar with toolbarbuttons via python. Can anybody give some example-code? ...
0
votes
1answer
961 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 ...
2
votes
1answer
30 views

Exceptions for invalid files/ filenames that already exist in database

The script below is functional, but it runs into issues if it comes across duplicate files (even when overwriteOutput=True) and corrupt shapefiles when running feature to feature. Are there ...
17
votes
14answers
46k views

Full list of ISO ALPHA-2 and ISO ALPHA-3 country codes

I'm searching for a full list of countries with their country codes. Like on this page (need full and valid): http://www.nationsonline.org/oneworld/country_code_list.htm Thanks.
0
votes
1answer
16 views

Error operating on file using grass

from grass.pygrass.modules.shortcuts import raster as r gscript.run_command('g.region', ...
3
votes
1answer
154 views

Identifying flightline ID within an LAS file?

I am working with multi pulse LiDAR data that collects points along a number of lines within the flight path. From what it appears there are four scan lines within the data, at different intervals but ...
6
votes
2answers
673 views

Getting the projection of a LAS file using liblas?

I am using the python api of liblas to read/write las files. I would like to get the spatial reference information of the las file using liblas, but have been unable to figure it out. Can anyone ...
0
votes
1answer
41 views

QGIS Processing Toolbox not valid

I have a 64 bit windows 10 computer with ArcGis 10.2.2 Installed. I just downloaded QGIS the newest version 2.14 64 bit. it downloads but the processing toolbox throws this error Couldn't load ...
1
vote
1answer
24 views

gdal_polygonize returns with a strange error

i'm trying to execute gdal_polygoinize.py command. I have a main python method that takes in input a raster file and a output shapefile, and then calls a method named polygonize.py that builds and try ...
2
votes
1answer
36 views

How do I change the pixel values of raster data from QGIS python plugin

I have been trying my hand at a QGIS plugin. The plug in reads raster layer data into an array, pipes the data to a C++ program, does processing over there, and pipes my results back. After a couple ...
2
votes
1answer
38 views

Python module pyGTiff aligning data

I have been working with pyGTiff for a while and it works great. However my gis data does not have the same projection and extent. I saw that in the repository a a jupyter notebook with a test ...
1
vote
1answer
58 views

Parse and load GPX into database?

Having a PostgreSQL database, with the following tables: CREATE EXTENSION postgis; DROP TABLE IF EXISTS trips CASCADE; DROP TABLE IF EXISTS locations CASCADE; CREATE TABLE IF NOT EXISTS trips ( ...
1
vote
2answers
41 views

Extraction of raster with shapefile python

I have a raster tiff file containing vegetation index & also a shapefile of fields. I want to extract the field wise values from that raster file using GDAL. How can I do this? I can read the ...
20
votes
2answers
8k views

How do I get the pixel value of a GDAL raster under an OGR point without NumPy?

I am working on a computational model of the abundance of wild pollinators across a landscape. The model itself is complete, and I am now struggling with a post-processing step. I have my GDAL ...
0
votes
0answers
34 views

Transitioning MapServer from 32bit to 64bit: CGI Error

I am moving a mapserver system from 32bit to 64bit Windows (too many frustrations with multiple python installations). There is no straightforward MS4W installation for 64 bit. I am using Apache2.4 ...
1
vote
1answer
247 views

Is it possible to embed python in code for HTML pop-ups in ArcGIS

When clicking a point feature I want the html pop-up to not only contain the data of the feature but also an image of the area around the feature (eg. 2 km^2). The image would have the base map 'World ...
1
vote
0answers
29 views

Qgis python: no interaction with Map Canvas

I've created a simple python script to load and show two layers and zoom to the first one. It looks like the script doesn't run the last 4 lines after I uncomment'print lyr1'. Anyway the map canvas is ...
0
votes
0answers
48 views

Mapinfo wor file not working when file paths are updated using python

We did a data move and so I scripted the updating of the wor, so the old file path is changed to the new file path. It looks like it works perfectly but when I open the wor file it doesn't. When I ...
5
votes
2answers
750 views

How to access the road graph plugin in python?

I am developing a few scripts in Python for QGIS 1.8 to automate some geo-tasks and one of them would be to calculate the shortest distance from a hospital to each building in a town. I would like to ...
0
votes
0answers
21 views

Replacing path names in FME Workspace with python

I need a Python code which replaces the place holders ('%p%') in a template FME Workspace which is imported via fme_in = open(self.filename1, 'r') and writing the path name which come from a input ...
1
vote
2answers
52 views

Clustering geographical data based on point location and associated point values

Given data points with longitude, latitude, and a third property value of this point. How can I cluster points into groups (geographical sub-regions) based on the property value? I searched by google ...
0
votes
0answers
24 views

connecting Postgis, Python, Openlayers

I'm in the process of learning Geo-mapping and I'm curious to create a web-application Python-Django, Openlayers 3 and PostGIS. I need to know whether Django can be combined with PostGis and ...
1
vote
1answer
47 views

Creating a polyline with a specified slope

I would like to create a road (polyline) starting from a point, with a specified slope, until reaching the top of a hill (or going out of the DTM Raster). The dowstream slope of the DTM must always ...
3
votes
1answer
746 views

Extract data from netcdf using a shapefile polygon in python

I need to subset data from a NetCDF using a specific shapefile. The data are sea surface temperature and ocean color at 1/4 degree resolution. I have 4 polygons describing the US. Northeast ...
2
votes
1answer
451 views

Python script for dark object subtraction on Landsat 8 Imagery

Does anyone know of any python scripts that will allow me to conduct such a process? I am limited to open source software and have minor experience in Python.
1
vote
0answers
22 views

Per-pixel Descriptive Statistics through multiple Raster layers

I'm looking for computing different descriptive statistics through a set of raster layers. I need to make it with a python script capable of running into a standalone tool within the QGIS. To do so ...
5
votes
2answers
657 views

Randomly select a record to update using arcpy.da.UpdateCursor

This question is related to Correct usage of a counter using arcpy.da.UpdateCursor. What I would like to do is use a cursor with a where clause to select a number of records. For each row, the values ...
0
votes
1answer
51 views

RasterStats import zonal_stats error [on hold]

I just installed rasterstats 0.10.3 Python library on my Windows machine and everything went fine with pip installation (had to install fiona, rasterio wheels separately prior to installing ...
2
votes
1answer
124 views

pyQGIS changing Paletted Raster Layers to Grayscale

I've written a plugin which imports a number of colour geoTifs (map tiles) and works correctly but it would be great to display these as Grayscale after loading in. The geoTifs load as paletted ...
0
votes
0answers
17 views

Opendap automated download with Python in ArcMap [closed]

I want to use python to automate the download of satellite images from OpenDap. I did find a similar post here, but I have tried using this script and it does not work How I can extract a subset of ...
0
votes
1answer
51 views

Why Does Fiona Crash Python When Creating an Output File?

I've basically followed the Fiona online manual verbatim to write an output file but my code crashes when I call Fiona.open() to create said output file. Traceback reports that the reason for the ...
0
votes
0answers
6 views

Tuning Geoserver datastore with gsconfig

I'm trying to create a datastore in Geoserver with gsconfig and it works, up to a point where i want to enable for instance "Expose primary keys" or "Support on the fly geometry simplification" tags ...
2
votes
1answer
115 views

Implement r.cross / ArcGIS Combine with GDAL

I am using GDAL to process a lot of rasters. I then need to combine all the arrays to create a single output raster that represents all the unique combinations of values. I.E the same thing as ...
2
votes
1answer
216 views

gdal_calc works but I get a Python error at the end of each process

I have a problem while using gdal_calc by a .bat file. Here is the code : call "C:\OSGeo4w64\bin\o4w_env.bat" gdal_calc ...
2
votes
1answer
35 views

QGIS Python variable not updating after new features are inserted

I have the following script that sets the a feature id automatically after a new feature is digitized. I added the function inside the project's Macro section inside openProject() function: The ...
3
votes
3answers
1k views

How to filter out multipart polygons and then buffer?

I've written a small script trying to accomplish the task described in the question title. It basically looks like: in_fc = '...' # Some shapefile goes here # Get the fields (column names) of the ...
1
vote
1answer
128 views

Using twitter coordinates in OSGeo library

I have twitter data with coordinates such as: [-7.2377761, 112.73091137] I'm working with a python geo library called osgeo. The sample code indicates creating a point like this. point = ...
3
votes
1answer
28 views

QGIS python getting number of new features to be stored in layers

I mean, how could I get the number of features that have been created in a given layer and that are pending to be saved in the layer when "Toggle editing" or "Saving layer edits"?
1
vote
1answer
177 views

Couldn't load plugin PRISM due an error when calling its classFactory() method in QGIS1.8 inWin8

When I load a plugin in QGIS ,met some problems : I had tried copy other Python27's files to QGIS's Python 27 file but it still does't work. Couldn't load plugin PRISM due an error when calling ...