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

learn more… | top users | synonyms

2
votes
1answer
35 views

Parameters for osm2po web service to route for walking

I have started the osm2po web service using the jar file. In the configuration file, I could see different parameters related to walking but not sure what each one does. I am trying to call the web ...
1
vote
0answers
38 views

ogr2ogr - Shapefile database SQL query; missing .cpg and .xml

I am using gdal and ogr2ogr to perform a SQL query on a database of shapefiles with the code below. The geoprocessing works and the appropriate shapefile is extracted from the query, but when I print ...
1
vote
1answer
20 views

AttributeError: SyncToDisk?

I want to save my 'feat' - selected by criteria polygons in shp.file to save in diferent shp.file on the disk by using SyncToDisk() in osgeo for vector. Code gives me error: ...
3
votes
1answer
72 views

Export raster layer in python to specific folder

I am trying to export existing raster layers as tif files. I just want to avoid saving each raster manually. this is the code I am trying to use, but it doesn't seem to work: from PyQt4.QtCore import ...
0
votes
0answers
25 views

Points within a circle in Python - geoindex

I'm trying to use the geoindex package to perform a nearest neighbor query. For example, I have this two coordinates (in the real case I have a lot more): (40.607255, -73.75083) (40.7261465 ...
0
votes
1answer
25 views

Replacing each point in a point feature with a specific shaped polygon

I have many random points in one layer. I want to replace each individual point with a specific shaped polygon like the image below illustrates. Kind of like applying some sort of irregular buffer to ...
-1
votes
1answer
27 views

Fix AttributeError in python code

I got some code that I think should work, but I'm getting this error: Traceback (most recent call last): File "", line 1, in File "c:/users/proxtr~1/appdata/local/temp/tmpgtrnqo.py", line ...
3
votes
1answer
45 views

How to add label to point without marker displaying in QGIS with python

I'm using a python script to manipulate the display of shapefiles in QGis. My code basically selects an active layer and sets a field as the label of the point. Like this: layer = ...
3
votes
1answer
46 views

Update ID Field Using Common Types

Not exactly sure how to word this, but hopefully I do it in a way that accurately conveys what it is that I'm trying to do... I'm using Manifold GIS for this particular project, but I'm open to any ...
0
votes
1answer
95 views

Python: Trying to figure out Geopy in python for reverse look ups

I am trying to test the following code on my system but I cannot get the correct output. Is this code correct for using geopy with GoogleV3? If so, how can I return country and continent name? ...
0
votes
1answer
85 views

Save raster layers in a python script

Is there a way to loop through every selected layer in qgis and save it as a .tif file with the same layer name using a python script? This is the code I am using, but it does nothing at all. It runs ...
1
vote
0answers
23 views

Python plugins not available, OS X 10.10.5, QGIS 2.8.4

I’m using OS X Yosemite 10.10.5 and QGIS 2.8.4 Wien. My mainproblem is that python support is disabled and I can’t use python plugins. QGIS seems to act fine and I’ve done a lot of work with QGIS. ...
1
vote
1answer
37 views

Geoserver ReST update ImageMosaic

I am currently experimenting with the GeoServer ReST-API andy trying to update the configuration parameters of an ImageMosaic Coveragestore. I've been using Python 2.7 with the requests package as ...
0
votes
1answer
23 views

gdal writeArray causes appcrash at end of python script

i'm using OSGeo4W64 (gdal 2.0.2-8) with Python 2.7.5 on Windows 8.1 64bit. Editor is PyCharm 2016.1.2. I want to save an image with gdal, but i always get an error when the python script is complete. ...
1
vote
1answer
45 views

Pythonic solution for changing shape files properties in QGIS

I'm loading several shape files into QGIS using the python console. The script works by reading a list of directories and a list of shapefiles to load from each directory, then it loads each file. ...
0
votes
0answers
23 views

How to create LayerGroup in GeoServer using Python?

I tried with gsconfig as mentioned here but got error while saving. I followed exact same steps but with error - Traceback (most recent call last): File "test_curl.py", line 75, in ...
1
vote
2answers
84 views

How to add dynamic text feedback for QGIS plugin?

I am building a plugin using Qt Designer which will initially allow users to select features for a chosen polygon layer and then when a feature is selected on the canvas, the area is printed out in ...
1
vote
0answers
24 views

Resampling netcdf file?

What is the best way to change the cell size of a netcdf file, keeping it as netcdf? I have looked into ArcGIS and GDAL and have not found anything yet. I prefer to use python if a solution is ...
6
votes
1answer
105 views

Adding GDAL as dependency to Python package?

I am trying to package a Python script that uses GDAL for PyPI. I started by including a direct reference in my setup.py: install_requires=['GDAL==1.11.2'], This way the package failed to install in ...
1
vote
2answers
70 views

Is it possible to round all coordinates in shapely?

Following on from How can I add points to a LineString in shapely?, I'm hitting a problem where floating point representations mean objects aren't precisely where I expect them be after they are moved ...
1
vote
0answers
44 views

QGIS python support disabled

I'm having a problem with the python support of my QGIS version. When I start QGIS, I get the error message: Traceback (most recent call last): File "", line 1, in ImportError: Module use of ...
0
votes
1answer
34 views

How can I add points to a LineString in shapely?

I have two Polygons which intersect along one edge as shown below. I need to add the red vertices at each end of the intersection to the blue polygon. I thought I could do this with by calling ...
5
votes
2answers
93 views

Why am I getting two different outputs from Python and C++ using GDAL?

I am trying to gather information from a *.tif file using the GDAL libraries. When I open the *.tif file using both the Python API, and C++ API, I encouter two completely different answers. Here are ...
2
votes
1answer
65 views

PyQgis: During editing, add new feature attributes

Workflow: Start edit mode -> New feature is created -> On the console (pyqgis), new attributes are set -> Exit edit mode. Problem: The attributes are not saved. Only after completion of the editing, ...
1
vote
0answers
67 views

How to make NoData transparent?

I have been using python to turn a netcdf into a geotiff. Once I have the geotiff, I am using gdalwarp to transfer it into the right projection. Then use gdal_translate to get the tif into a vrt ...
4
votes
1answer
66 views

How do I update joined data from MySQL programmatically?

I have a point vector layer (Sensores) in my QGIS project, I also have a MySQL database layer (SensoresDB) containing only data. I have joined these two layers in order to geographically reference my ...
1
vote
1answer
51 views

How to simplify borders between polygons in shapely?

I have some fairly complex, and not completely accurate shapes stored as shapely Polygon objects. I'm trying to find the common borders, which should be as easy as finding the LineString returned from ...
1
vote
1answer
15 views

QgsComposerTextTableV2 minimal implementation?

I would like to use the richer data and styling API QgsComposerTextTableV2 offers. However I get this error when adding it to the composer: TypeError: QGraphicsScene.addItem(QGraphicsItem): argument ...
2
votes
1answer
38 views

Using zonal_stats with python in QGIS to calculate statistics for each image

I work with Python in QGIS, I want to calculate statistics for each image that I have with a specify shapefile and save result after, I tried to do like this: from rasterstats import zonal_stats ...
2
votes
0answers
56 views

Use QGIS API on standalone python program without install the entire application

I developed a standalone python program that makes use of QGIS API to create .qml files from sld files. This is a small program of about 15 lines of code that imports the following modules and uses ...
1
vote
1answer
78 views

Create Table with postGIS geometry in Python

I'm creating the following table with a postGIS geometry column in python but get an error psycopg2.ProgrammingError: type "geometry" does not exist What should I use to be able to use postGIS in ...
0
votes
2answers
41 views

How to Call ArcHydro Tools in Stand Alone Python Script

I am currently using ArcGIS ArcHydro tools to perform 'Catchment Polygon Processing'. However, it is proving time consuming to perform this for multiple rasters. How might a write a python script to ...
4
votes
1answer
45 views

How to insert a variable into a tool script

I am a bit new when it comes to Python programming. I'm trying to run the GRASS r.sun plugin tool to calculate the global irradiance for my chosen area for the whole year. The problem is that r.sun ...
5
votes
1answer
120 views

Export .qml file using QGIS API

Im loading a shapefile using the method QgsVectorLayer() and adding a style to it using the method loadSldStyle() and the path to the sld file. So far so good. What I want now is to export that style ...
1
vote
0answers
53 views

QGIS: startup.py missing [closed]

I am trying to set QGIS 2.8.1 (Linux Mint 17.2) to add the filename/path to layouts. I am using this post as a guide How to add the current document path on Print Composer? However, I haven't got ...
1
vote
0answers
74 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? ...
1
vote
0answers
41 views

Programmatically adding folders & layers to QgsComposerLegend

I've been building up QgsLayerTree object with a directory structure that reflects the desired legend. Specifically I'd like the Group(s) to be titles and their contained layers to legend items. ...
0
votes
0answers
25 views

Convert geoalchemy2 Geometry(polygon) column to OGR Geometry

I would like to use OGR to perform analysis. My data currently lives in a PostGIS database. I am loading my data into a python environment using geoalchemy2. I am hoping that a line similar to the ...
1
vote
1answer
45 views

Connect / Disconnect GPS device via PyQGIS

In QGIS I would like to establish a connection to my GPS device programmatically (not via button in the GPS control panel) I found out how to get available ports with QgsGPSDetector i.e. ...
1
vote
1answer
52 views

Qgis -> Settings -> Customization : how to import ini file with python?

With QGIs, from "Settings"->"Customization" i can hide/show the components of the GUI. I can export a INI file with my customization. There is a way to import my INI file with a python command in ...
2
votes
1answer
92 views

Accessing GPS from QGIS 2.14.1/Python 2.7 /Windows10

I would like to access the device described at QGIS live GPS tracking /recommended hardware (GPS USB stick) via QGIS/Python. A gps module does't seem to be part of the standard installation of python ...
0
votes
1answer
38 views

How can I write private tag GDAL_NODATA to a TIFF using libtiff?

In an earlier post I asked how to retrieve this tag from TIFF using python and libtiff. Eventually I found the answer and I reported on the solution last week. I also realised that in order to write a ...
0
votes
1answer
41 views

Python: Running a function on all points in a list [closed]

I'm trying to get a list of cartesian points along contour lines and convert them to polar coordinates. I'm trying to run a function to convert them to polar, one for the length and one for the angle. ...
2
votes
1answer
33 views

Raster brightness, contrast, saturation in PyQGIS

I'm trying to find a way to change these properties (especially contrast and brightnes) and I've found a QgsBrightnessContrastFilter class, but I can't fugure out how to apply it to my raster layer. ...
1
vote
0answers
43 views

How do I calculate the percentage of progress using raster data using Python?

How do I calculate the progress amount of two or more raster data being processed? I have seen examples of vector data but it becomes difficult to calculate the progress when no vector data are ...
0
votes
0answers
46 views

cartopy: plotting shapefiles

I am new to gis and am trying to plot a shapefile containing land polygons. (From OSM.) Unfortunately my output image is always empty (i.e. white). Can somebody tell me what I am doing wrong? import ...
0
votes
1answer
34 views

Shebang line for ArcGIS Desktop [closed]

I'm writing a script to be run on ArcGIS for Desktop, which only runs on Windows machines. Is there any use for a shebang line at its beginning, and if there is then what should it be (e.g. ...
0
votes
0answers
51 views

Getting closest point on road to point in OpenStreetMap using Python?

I need to find the closest point on a road to a external point in OSM, but I need to do it without downloading the OSM data nor using PostgreSQL, i.e., I can't use the solution pointed in How do I get ...
2
votes
1answer
70 views

How can I get a map image from an ArcGIS mapserver centered on a single feature?

I have a Python program that is not using arcpy. I need to get an image from a mapservice centered on a single feature using the REST api. I can call the export method to get a map image: ...
3
votes
1answer
57 views

Error when using r.series in a python script

I’m writing a tool script in python and at a certain point I want to use the GRASS tool r.series. I want the algorithem to read all raster files from a folder and calculate the maximum with r.series. ...