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

learn more… | top users | synonyms

3
votes
2answers
129 views

Geopandas Polygon to matplotlib patches Polygon conversion

Unfortunately geopandas plotting is extremely slow and takes a lot of resources, hence I would like to use instead matplotlib for plotting. When I use pure Fiona to open and read the shapefile I ...
1
vote
1answer
37 views

Fixing python error in QGIS Freehand raster georeferencer plugin?

I am using QGIS 2.8.9 stable release in the 32bit form on a Windows 7 64 bit compatible PC. I want to use the Freehand raster georeferencer plugin. It installs without difficulty but when I try to ...
2
votes
1answer
36 views

QGIS or PostGIS auto-split long line features

I have a dataset of LineStrings in a postgis enabled database and would like to automatically split any feature longer than a certain threshold (say 1 mile). I am aware of the Split Feature tool in ...
3
votes
0answers
75 views

Using ogr2ogr in python?

I found this helpful post that got me started using ogr2ogr in python: Using ogr2ogr to convert GML to shapefile in Python? as well as this one: How to convert ArcGIS Server JSON to GeoJSON? I am ...
3
votes
1answer
33 views

AddRaster using pyqgis

I am able to attach a raster by using python console using the command shown below. qgis.utils.iface.addRasterLayer('D:/Work/dt0017810q.tif') But, when the same image/raster path is read from a ...
9
votes
4answers
8k views

Using ogr2ogr to convert GML to shapefile in Python?

I am trying to convert a GML to an ESRI shapefile using ogr2ogr utility in a python script. I have successfully installed the GDAL/OGR package via osgeo but I am now struggling to find/understand ...
1
vote
1answer
69 views

Force Python GDAL/OGR to flush changes to disk

I am trying to write a simple list of features and export it as a KML file, adding one extra attribute: in this case trafficability. However, ogr is failing to flush the data to disk when I run the ...
1
vote
1answer
160 views

mosaic rasters with gdal_merge.py

I want to mosaic 2 rasters "rasa" and "rasb" using gdal_merge.py . While running the code, it produces an error " No input files selected". Can somebody help me to find the error in the code? ...
3
votes
1answer
45 views

How to check if a geoserver layer is raster or vector using gsconfig

I am using gsconfig and python in order to retrieve information regarding some geoserver layers. What I am trying to do is to find out if a specific layer is raster or vector. I read online that I ...
1
vote
0answers
26 views

Autofill fields of pyQgis script

I have three fields of output vector layer in Qgis script: ##output_vector_first=output vector ##output_vector_second=output vector ##output_vector_third=output vector When user fill first field I ...
0
votes
1answer
53 views

Python Gdal write virtual raster

Is there a python module to create Virtual Raster (.vrt) xml files? Rather than writing text strings to a file, I'd like to know if there is an automated way to do this.
4
votes
2answers
101 views

Python: color Canadian provinces in a shapefile based on given values

The goal here is to create a choropleth map of Canada in Python. Suppose I have a dictionary with values referring to each Canadian province/territory: values={'Alberta': 1.0, 'British Columbia': 2....
2
votes
0answers
49 views

QGIS equivalent of Calculate Adjacent Fields for Atlas

Is there a QGIS plugin available or a processing model to calculate and populate fields that can be used to label the adjacent pages in a map book? Although there are tools to create vector grids, I ...
1
vote
1answer
65 views

Why does joining all layers in a group not work?

I am attempting to re-join all layers within a group to another layer ("Main.shp") outside of this group. The idea is for users to change values in one of the group's layers. As these layers are ...
21
votes
3answers
5k views

Is it possible to look at the contents of Shapefile using Python without an ArcMap license?

I wondered if it is possible to look at the contents of a shapefile using Python without having and ArcMap license. The situation is that you can create shapefiles from many different applications, ...
1
vote
1answer
25 views

Wrong boundary when plotting Canada's shapefile in Python

I want to plot the Canadian shapefile with province boundaries highlighted and hollow filling. I have downloaded the shapefile from here. This is the script I use to visualize the shapefile: ...
2
votes
1answer
64 views

Computing distance between two points following network and doing it for 100.000 points?

My starting data : a collection of points which are buildings a collection of points which are electrical transformation plant a network of vectors which is the public electric network from an ...
0
votes
0answers
31 views

How to add a field to an OSM file in Python?

I am writing a program that takes in a .osm file and then calculates some new attributes for that feature. I am using the python libraries gdal and ogr to help deal with the data. So far OGR has ...
0
votes
0answers
49 views

Patch processing of multiple HDF5 files using Python and Gdal (gdalwarp)

I am trying to extend this process http://geoinformaticstutorial.blogspot.com/2014/06/reading-and-map-projecting-amsr-2-data.html wherein a set of raster data with separate geolocation arrays are ...
1
vote
0answers
29 views

Merging DEM file generted many negative value in QGIS

With four DEM files downloaded by Python Elevation package, I merged them in QGIS 2.8.3. I use raster-> Miscellanaous -> Input direction, no more attribute was added. The four dem data has ...
1
vote
0answers
20 views

Run and install packages from local folder QGIS [duplicate]

I use QGIS in my work and sometimes need install python libraries for plugins to work but I don't have write access to C:/ where QGIS and python is installed (OSGeo4W). Is there a way I can install ...
1
vote
1answer
124 views

Regrouping points together qgis based on a sum

I work with QGIS and Python. I have a vector layer containing points. Each point has an attribute called 'number of houses' I want to dissolve this vector layer in many areas, each area must contain ...
2
votes
2answers
61 views

GRASS 7 environment setup for Python

I would like to use some GRASS functionality from a Python programme. With GRASS 6 this required the set up of various environment variables, as detailed in the GRASS Wiki. I am trying a similar ...
0
votes
1answer
46 views

Exception using PyGRASS: “No module named 'core'”

I am trying PyGRASS on Ubuntu 14.04. I have GRASS 7 installed from the UbuntuGIS PPA: $ dpkg -l | grep grass ii grass 7.0.4-1~trusty1 ...
0
votes
0answers
72 views

How to analysis the spatial distribution similarity?

There are three different data source aiming at atmospheric chemistry research: Simulated concentration of ground level air pollutant Satellite retrieved concentration for the same area. ...
4
votes
2answers
107 views

Installing third party python libraries in ArcGIS location

I'm running ArcMap 10.2.2 for desktop and have Python 2.7 installed as part of the software package. I'm trying to get the pyexcel and xlutils libraries installed. I ran a script to find the path of ...
3
votes
2answers
225 views

Automatic selection of pixels, from a raster series, greater than minimum image of the series

Given a series of rasters, and the raster image of the minimum values of the series, I am looking for a python script capable of selecting, for each raster, the pixels whose values are greater than ...
1
vote
1answer
192 views

Opening HDF5 satellite images in GDAL with Python? [closed]

I want to read and open HDF5 satellite images by python for batch processing. How can I read and open both image bands and meta data? For batch processing I need to geo-reference and read IR bands. ...
4
votes
1answer
1k views

How to use QGIS field calculator in python?

I would like to use QGIS Field Calculator in Python to update the existing column based on certain conditions? How can I do this?
2
votes
0answers
22 views

classify colourramp with new min and max value with python

For my script i want to update the existing colourramp of a raster with new min and max value. In my current code is can fill the min and max but can't classify and update the raster. How does the ...
1
vote
1answer
67 views

Counting nodes/vertices in large polyline GeoJSON?

I have a large .geojson file (~ 1 GB) of made up of thousands of polylines. My objective is to count the number of vertices (not end points) in the entire file. Is there a python module that is ...
1
vote
0answers
13 views

Duplicate an existing geoserver style using gsconfig

I am playing around with gsconfig and trying to assign a new style on a layer I have created. What I want to do is to actually create a new style, which is the same with an existing one. I searched ...
2
votes
1answer
43 views

How to use create a plugin that contains a set of processing scripts using Qgis Script feature?

I have some script that I would like to share easily. I have read here that its possible to create a plugin using a set of scripts using "Scripts/Tools group in the Processing toolbox, double-click ...
2
votes
0answers
19 views

get active colourramp form qgis rasterlayer

I m building a pythonscript were i need the active singleband pseudocolour colourband of a raster. I want to give the active colourramp a new min and max value. I can only find examples like this ...
3
votes
4answers
8k views

Trying to write a python script to crawl a directory and list all datasources

I'm editing a scrip from ESRI to try and create a list of all datasources within MXD's. I've got the script to crawl the file tree and find all the info, but I would like it to output the data for ...
2
votes
1answer
65 views

Update raster color ramp with new min/max values using python?

For a script, I want to update the exsiting min and max of a colour ramp with a new one. In the image you can see what I want to update. To do so I tried to follow this thread. I tested the ...
2
votes
1answer
72 views

How to get attribute values from vector features visible in the qgis canvas

I have a vector layer (grid). Currently I select some tiles with the select tool and paste some python code to get information about these features. layer = qgis.utils.iface.activeLayer() ...
0
votes
0answers
19 views

finding orientation of nitf to display on cesium js globe

I am trying to display my nitfs on a cesium js globe. My first hope was to build kml of tiles and zip into a kmz file. This worked great in google earth, but cesium js does not support this. Their ...
3
votes
1answer
67 views

inaccurate distance measurements in Python

I've tried several ways of measuring the distance between two points in my Django application and comparing the results to a reliable measurement. My numbers are way off. For example, I'm assuming the ...
1
vote
1answer
31 views

ArcGIS Server - problem publishing python script that uses urllib

I have problem publishing this simple python script as geoprocessing service with ArcGIS Server. import urllib import arcpy u = arcpy.GetParameter(0) url = "http://geoegl.msp.gouv.qc.ca/cgi-wms/...
1
vote
2answers
189 views

plotting US cities on a map with matplotlib and basemap

I am hosting a conference and want to show a map of where the attendees have arrived from. I have an input file with the names of the cities. I'd like to put a dot on each city, and have the size of ...
0
votes
2answers
1k views

How to round up/down an pixel value of a raster to a pixel value with 2 decimal places?

I have a raster (DTM) with floating points as pixel value. Now i want to round up/down the pixel values (to its next nearest value) to 2 decimal places. I use ArcGIS (with extensions) and tried the ...
0
votes
0answers
23 views

How to convert Integerized Sinusoidal Grid to lat long?

I'm trying to convert MODIS Integerized Sinusoidal Grid (0.25km/250m) to corresponding latitude and longitude. I found this tool to convert the data. I've written the algorithm for converting ...
0
votes
1answer
21 views

System locale settings error creating GRASS location from Python

I am trying to use GRASS 7 from Python without explicitly creating a location. I am starting with the script provided at the GRASS-Wiki. This script tries to create a new location in the /tmp/ folder ...
1
vote
0answers
57 views

Cannot run QGIS algorithm with python script without interface

I'm trying to run the QGIS 'intersection' algorithm from a Python script: (Working with Ubuntu) #!/usr/bin/env python # -*- coding: UTF-8 -*- import sys from qgis.core import * from PyQt4.QtGui ...
0
votes
0answers
20 views

64Bit Applications installed with QGIS/osgeo4w

Is python 64bit and gdal 64bit automatically installed when QGIS 64bit is installed via osgeo4w 64bit? I currently have a custom 64bit python and gdal setup on my pc. However, this setup causes some ...
63
votes
13answers
52k views

Installing GDAL with Python on windows?

Can anyone explain how to install GDAL/OGR with Python on Windows? I have Windows Vista and I have tried following the information on the website and it does not seem to bind the exe files for me. ...
2
votes
1answer
50 views

How to include QgsRasterBandStats in plugin

I'm making a plugin were i want to get the min and max value of a raster. When i tried the following code in the qgis python console it worked fine but in my plugin code i get the following error ...
0
votes
0answers
36 views

need to convert tiff and kml to geotiff

I'm looking to combine a tiff and kml file into a geotiff (this needs to be integrated into a program i'm writing, unfortunately not a one off). Due to dependency issues I can't use GDAL and it ...
0
votes
1answer
58 views

Does Gohlke GDAL break Command-Line GDAL/OGR in Windoiws?

I recently gave up trying to get the gisinternals versions of GDAL's Python bindings to work, and sought instead to use the 'gohlke' approach - getting the appropriate wheel from the UCI repository. ...