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

learn more… | top users | synonyms

19
votes
2answers
6k views

How to make a separate Python installation that can call ArcGIS' arcpy?

I see a lot of threads asking how you can create a separate Python installation (e.g. the Anaconda or Python XY distribution) that can use arcpy, while not 'breaking' the original ArcGIS python ...
0
votes
0answers
12 views

Problem with dicttoxml module import

I have python 2.7 and I have just installed (via pip) a module named 'dicttoxml'. This module should work with 2.6+ python version. I am importing it to my *.py file and using it in my plugin code. ...
0
votes
0answers
17 views

QGIS python pyd extension and execute python command from pyd

I create python extension as pyd in visual studio. This test made in Delphi. Extension run python command use PyRun_SimpleString or any RUN function. If this extesion import from python console ...
-3
votes
0answers
42 views

Can I open windows task manager with Python? [closed]

I want to make a program that can open task scheduler. Is it even possible? If so - what is the code for it?
0
votes
1answer
225 views

How to connect mouseclick to map canvas in QGIS?

How to connect mouse click to map canvas in QGIS using python script? I have two lines of code to connect mouse click to map canvas: button.clicked.connect(self.onClicked) self.areapushbutton.clicked....
2
votes
1answer
52 views

Python if, and, or to compare field values and assign new value

I have 3 fields in a table that i need to evaluate and return a new value based on the results using the field calculator (PYTHON) They are: SETSPAID (long) This field must = 0 TYPEOFSERVICE (string)...
0
votes
0answers
47 views

Python Error when loading QGIS on Windows 10 [duplicate]

I used the standalone installer (QGIS-OSGeo4W-2.14.4-1-Setup-x86_64.exe) to install 2.14.4 however 2.16.0 was also installed. Have I done something wrong to get 2 versions installed? Also 2.16.0 ...
0
votes
1answer
37 views

Converting polyline coordinates to lat/lon for use in google maps

I am given an ArcGIS polyline (or polypoint) from a WFS service (e.g. 1693669.5143, 5672605.5392), and am looking for a function (python, java, whatever) to convert it to a lat/lon so I can use it in ...
1
vote
1answer
305 views

Calculate tree cover over certain area from raster data

Last year Hansen et al. published Global Forest Change map as set of raster data available in TIFF format. Basically those are 30-meters resolution satellite images with pixel values ranging from 0 (...
3
votes
2answers
529 views

GDAL with GEOS support, pandas and VTK using python on Windows?

So far I have been using OSGeo4W shell (or OSGEO install) as really convenient way to use python together with additional packages, namely gdal, shapely, numpy, scipy and matplotlib. I was happy till ...
0
votes
0answers
22 views

Finding intersections in multiple files and exporting to single shapefile using OGR

I saw this solution using Shapely, but unfortunately I can't get Fiona to work with my Python IDE nor with OsGeo4W. I have a single shapefile that has a 500m buffer on about 350 trail polylines. I ...
1
vote
1answer
211 views

How to set time field when generating a GPX track with Python OGR?

I want to generate a GPX file with Python OGR. In particular I want to generate a tracks (layer of features of OGR type wkbMultiLineString) My script is below. I get the error ERROR 1: No such field: ...
1
vote
1answer
59 views

Resample SMOS dataset using cKDTree and Bilinear interpolation

I have three datasets now. One is SMOS level3 soil moisture dataset which is in EASE grid 2.0 ~25km cylindrical projection. (EPSG: 6933). TRMM precipitation dataset which is in 0.25 degree. SMAP soil ...
3
votes
2answers
54 views

How to rename a QGIS plugin?

I updated a plugin such that now it does more operations than the original title suggests. Is there an easy way to change the name without going through all of the files line by line?
2
votes
1answer
344 views

Using Spyder IDE to develop python for Grass GIS, get 'ImportError: No module named grass.script'

I am trying to use Spyder IDE to develop a python script using python library from grass-6.4.3. I run the script below, and get 'ImportError: No module named grass.script' I am using python 2.7, ...
0
votes
2answers
61 views

Calculating distance between latitude and longitude Python and CSV

I wanting to compare the distance between two sets of lat/long and I need help inputting my lat/long fields into the Haversine formula. I am able to print my two sets of lat/longs (print floats1, ...
1
vote
1answer
28 views

How to enable “Label every part of multi-features” with pyQGIS?

Regarding the 'Label every part of multi-features' check box located in the 'Labels // Rendering // Feature Options' layer properties UI... Can this be done with pyQGIS? These two commands enable ...
9
votes
2answers
1k views

GeoTIFFs made in GDAL don't have min/max range when loaded in Arc/QGIS

I'm creating some floating point rasters in GDAL with the GeoTIFF driver. When I load the resulting images into QGIS or Arc the default symbology puts the min at -3.40282e38 and max to 3.40282e38, so ...
0
votes
1answer
30 views

How to determine when the map has finished rendering

I have written a few functions to compare QGIS performance to MapInfo. Most of them involve doing some analysis then dumping the results on the map, as such the process would be considered 'finished' ...
0
votes
0answers
15 views

Click to copy Co-ordinates From QGIS

I have a created some point data using CRS ESPG:4326 and added Google basemap from Open-layers plugin. While adding the Google maps imagery i have changed CRS to ESPG:3857 in project properties. ...
1
vote
1answer
29 views

C-based implementation of Djikstra's or Fast Marching for QGIS/Python?

I need an algorithm to find least cost paths between points on a discrete grid, allowing for the direction of transport to affect the cost of transport, allowing for different modes of ...
0
votes
0answers
24 views

Orfeo Toolbox Python scripting problem

I am working with QGIS and the OTB plugin (Orfeo Toolbox). I trained the SVM classifier by "hand" (mouse clicks) and it worked. Then I tried to do it with python scripting, because I have a lot of ...
2
votes
2answers
330 views

Convert DateTime field to Just Date in Label Expression

I have a DateTime field (ex: CreatedDate) and would like to only show the date with the label. How would I setup the label expression to do this using python?
5
votes
2answers
219 views

Problem installing new version of Qgis under windoss 10 64 bits

I installed twice Qgis 2.16 using OSGeo 4w install. First I uninstalled all the previuos version and installed 2.16. Everything worked fine but when I open Qgis I have a warning message `Couldn't ...
0
votes
0answers
9 views

Write correct BandDescriptor expression - calculate the difference between bands in two geospatial products from Python

I need to calculate the difference of the bands stored in two files saved in the NetCDF. Both products used in the calculations describes exactly the same area, i need just the difference between them....
1
vote
1answer
17 views

PyQgis show SVG Symbol on differnet value of specific attribute

I am working on a QGIS plugin. Main feature of this plugin will be changing the icons on a specific layer partly based on a specific attribute (it will be more exciting but you have to start somewhere)...
3
votes
1answer
286 views

How to clip a Oracle query layer directly in a Python script?

I have a query layer directly running from ORACLE database in a MXD. I want to clip this layer with a layer being created in another MXD in a Python based tool. My question is to do this clip ...
0
votes
1answer
475 views

OSGeo4W and GDAL - gdal2tiles.py error

Wondering why gdal2tiles is throwing errors, I've added the gdaldata and gdalplugins environmental variables and my python is at Python27/ArcGIS10.3/, and am wondering if that is messing with the ...
0
votes
0answers
8 views

How to programmatically update data in WFS geoserver layer

I am building an application where the user retrieves all the features of a geoserver layer (store: postgres) and display them on a table. For doing this I use the OWSLib (get_feature). Now I need to ...
2
votes
1answer
56 views

Shapely & RTree vs. PostGIS/PostgreSQL?

I would really like some insight to the pros and cons of one approach versus the other. I recently wrote some python code that inspects two layers of the same test ESRI GDB file using RTree (bounding ...
1
vote
0answers
35 views

Split polygon using points and their directions with python

I`m new for the python but want to split Voronoi polygons using points and their directions as input. Voronoi polygons were created by in-built tool: Vector>Geometry Tools>Voronoi Polygons from layer ...
1
vote
0answers
32 views

What is the easiest way to write C extensions to Python for use in QGIS?

I would like to write some functions in C to call from the Python console in QGIS. What is the easiest way to do this? Does there exist anything comparable to Matlab's MEX?
5
votes
1answer
68 views

Sending a https request from a QGIS plugin using urllib2

I'm developing a QGIS plugin that needs to send https request to an API. I have to use urllib2 (see below if you want to know why I don't just use the requests package) The first request I need to ...
0
votes
2answers
61 views

When buton clicked, open new window - pyqgis

I'm making a plugin which has two windows. What I want to know is how to refer pushButton in one window to method which opens new window. I have dialog *.ui files for both windows and their *.py. ...
0
votes
2answers
37 views

PySal and PostGIS (maybe via Shapely). How can these two interact?

I'm trying to learn the use of PySal and Python. As I'm already regular user of PostGIS, I would like to integrate the database as the storage medium for the data to be analysed. I'm using the test ...
0
votes
1answer
42 views

Import OSM data in postgis with python script

I want to import OSM data (way and nodes) in postgis database with a script pyhton, I found in the internet that I should create a schema but I don't know how and I really don't know what to put on ...
1
vote
1answer
31 views

PyQGIS: How to get field values from a vector layer based on an array of field names

I have a list with the field names and i am getting the values from the vector layer shp = "D:\file.shp" from osgeo import osr,ogr, gdal driver = ogr.GetDriverByName('ESRI Shapefile') dataSource = ...
4
votes
1answer
78 views

point created on a line not precisely on line

In QGIS I wanted to move points to the nearest lines. I checked the solutions here, but there are using tools which I am not familiar to yet(POSTGIS or GRASSGIS). I figured out my own way with using ...
3
votes
1answer
512 views

How do I smooth edges of polygons in QGIS?

Is there a built in function or plugin I can use to achieve smooth lines for my polygons instead of the blocky ones I have now?
2
votes
1answer
988 views

Getting index of active data frame in ArcPy?

I am a little surprised to see that there seems to be no way to get the index of the active data frame in ArcPy, or did I miss something? For example, what if you want to add a tool’s output to the ...
1
vote
0answers
23 views

QGIS Python variable not updating properly after layer data is saved

This problem is a continuation of this one I am running a little script on OpenProject event that sets the feature id automatically after a new feature is digitized. Code: def openProject(): from ...
3
votes
1answer
485 views

How is the Python IDE aware of arcpy?

I'm using PyCharm 4 for some Python scripting. When I type import arcpy I can immediately start using items within the arcpy namespace, like the environment & workspace objects. How does the ...
1
vote
1answer
313 views

How to add mdb geodatabase layer (feature class) to QGIS project using python?

I want to add a feature class of a personal geodatabase mdb to my qgs project by code (a plugin I am working on). I am using a command similar to that used for adding shapefiles, but this is not ...
0
votes
1answer
47 views

Build GEOTiff file using Python GDAL

Is there a way to add data to a GEOTiff file in a loop? I can make one using WriteArray like so: dataset.GetRasterBand(1).WriteArray(array) But whenever I put it in a for loop it just overwrites ...
1
vote
0answers
22 views

Setting default encoding for python in QGIS in Windows

I have a problem that I have been working on for too long now... I am creating a python plugin for QGIS and I have problems with encoding. Characters with accents are displayed funky, but it is fine ...
1
vote
2answers
238 views

QGIS Deployment in Citrix XenApp - How to Remove Pyramids from the image “properties”

I'm working on deploying QGIS 2.4 into a XenApp 6.5 desktop environment. We've tested QGIS to see if it will run in our environment on a test server and have found that building Pyramids with ...
1
vote
1answer
1k views

Import shapefiles into PostGIS using Python with psycopg2

I want to import shapefiles to PostGIS using Python with arcpy & psycopg2 to connect to PostGIS. I don't want to use the existing shapefile loader nor ogr, just write my own import tool. My steps ...
7
votes
1answer
240 views

gdalwarp producing empty rasters when called from python script, but not via command line

I'm trying to aggregate some raster data (all .tif) up to a coarser resolution (from .05 degree to .25 degree) using gdalwarp in python, but the command is not working. Instead of getting an output ...
1
vote
0answers
25 views

Using Postgresql/PostGIS/Pgrouting in PYQGIS Processing Scripts

I have started exploring PYQGIS scripts and learning writing PYQGIS user scripts in python. I want to use pgsql/postgis/postgresql in the script. Please suggest Also Can anyone suggest That the ...
2
votes
2answers
63 views

Save line geometry as points geometry in QGIS (pyqgis)

I have line and polygon layers. I want to make a list of points' coordinates (ends or begginings of lines), which are touching the polygons. The coordinates which I need are selected as yellow. ...