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

learn more… | top users | synonyms

2
votes
1answer
139 views

Adding QGIS-specific Python interpreter to Eclipse?

I was following the steps from QGIS Python Programming CookBook to add qgis interpreter to eclipse, however I went into the following error in step 8: "See error log for details. No output was in the ...
2
votes
3answers
103 views

Can not Run function when item selected in comboBox. Pyqgis. QGIS

I'm writing a plugin, I want to change the content of a comboBox (fields) depending of the content of another comboBox (layers). My plugin is a dockwidget. I can populate the fields comboBox just ...
2
votes
1answer
70 views

pyQGIS segfault

I am trying to get started with pyQGIS but failing pretty hard. Trying to follow http://docs.qgis.org/testing/en/docs/pyqgis_developer_cookbook/intro.html A lot of it seems incomplete for Windows ...
6
votes
4answers
138 views

PostGIS query for selecting features not connected to rest of road network?

I have a dataset of roads in a city stored in a PostGIS enabled database. I would like to identify and remove any feature which is not connected to the rest of the road network. This behavior is ...
3
votes
0answers
141 views

QGIS 2.14 Processing plugin crashes - TypeError: must be string, not None

I've recently installed 2.14, and it worked fine for the first couple of days (Appart from Grass tools), including several program and computer reboots. Today I had this error show up Couldn't load ...
6
votes
0answers
98 views

Can a memory layer be used as an input and/or output with runalg?

Can a memory layer be used as an input and/or output with runalg? With runandload I get this to work: processing.runandload("qgis:mergevectorlayers","memory:bufferOne", "memory:bufferTwo", ...
0
votes
0answers
22 views

Fetching the table data from SQlite db in QGIS throws an error

I have exam.sqlite db and it contains 4 tables as t1,t2,t3,t4. from pyspatialite import dbapi2 as db sqlite_file = r'D:\Folder\exam.sqlite' conn = db.connect(sqlite_file) ...
3
votes
2answers
63 views

QGIS pyqgis: Trouble loading non-spatial data via .csv using python for standalone script

I cannot for the life of me figure this out. I am trying to load a .shp file, and a non-spatial data table .csv file. Then join the table to the shape file. Both files have a primary key. Here is ...
3
votes
1answer
40 views

While populating table of memory layer one record is missing

I have script that calculates length of lines and adds values to attribute table. It works for vector layer, but for memory layer it skip always one value, as you can see on the pic. I calculated ...
2
votes
1answer
19 views

Trying to get PRECISE vector coordinates using geom.asPolgon

I've got a bit of a problem. A script I've written is trying to get the coordinates of every vector in a layer, which is MAINLY working: output_file = open('c:/myfile.txt', 'w') layer = ...
1
vote
1answer
56 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 ...
0
votes
1answer
21 views

How to remove XML tags within a field of attribute table?

I have this dataset I got it from Wikimapia ,containing bunch of fields . One of fields named "PopupInfo" contains xml tags : and looks like this when in editing mode : I want to remove these ...
0
votes
0answers
74 views

tooltip does not show date in the correct format in Bokeh (flask)

he tool tip does not show the date in the correct format in the line chart.( the image below). However the data was displayed in the correct format in the table below. def ...
2
votes
1answer
77 views

QGIS corrupted processing tool

I've been dealing with various problems after re-installing QGIS and other GIS-related software (see QGIS corrupted plugins upon reinstallation). The solution worked for a bout a day and now I lost ...
1
vote
0answers
29 views

How can I connect qt ui with qgis, which browse the data file? [closed]

I have created a form in qt designer which is basically a dialog box with line edit and a browse button to browse .csv files. I am trying to connect this with QGIS so that as soon as a layer is ...
1
vote
0answers
29 views

Received a python error when I clicked on new catalog in QGIS Geoserver

What shall I do if I Python error message is there when I clicked on new catalog in QGIS Geoserver. I have the same message: Python error: An error has occurred while executing Python code: See ...
2
votes
1answer
22 views

Return several layers from listwidget

I am new to python and I am writing my first plugin that add selected layers from a listwidget to QGIS. So good so far, but it does not allow me to select several layers at once. Am I missing ...
2
votes
1answer
47 views

How to set CRS for a DXF file and prevent any warning on QGIS using pyQGIS?

I am trying to import dxf file with no warnings or popup from Spatial Reference Selector. However, even after modifying QGIS Spatial Reference Selector setting, I still get a qgisMessagebar warning. ...
1
vote
0answers
18 views

Local Maxima (or Pour Point) Pixel Value extract in Raster

I am doing watershed & pourpoint using python GDAL. I have calculated Fill, Flow-Direction & Flow-Accumulation using Python & GDAL. The next is to get Pour Point in certain window ...
2
votes
0answers
32 views

How to run QGIS plugin from python script

I would like to access external QGIS plugins through a python script. I have been able to access the built in QGIS processing and vector toolbox, but have been unsuccessful with external plugins such ...
0
votes
1answer
63 views

How to access members of GeometryCollection - Python

I am using 'intersection' function from Shapely to find junctions of a road network. As i found, intersection returns GeometryCollection. In my case it could be Point, LineString or perhaps ...
0
votes
1answer
56 views

How to remove first character from featureclass in Python?

I have a bunch of feature classes in a geodatabase that start with an underscore and want to remove it, but ONLY the first instance. See below: e.g. _COGCC_W_S --> want it to be COGCC_W_S I have a ...
1
vote
0answers
128 views

Convert PLSS (Section, Township, Range, Meridian) to Latitude and Longitude using R package or Python

I have data in the form of Section, Township, Range and meridian. I have 300,000 data points from all over the USA. Is there any way i can write R or python scripts to batch convert all the points to ...
0
votes
0answers
17 views

mosaic/reprojection/conversion order of operations

I'm writing a python/gdal program that ingests HDF4 files and: 1) Converts subdatasets from HDF4 to GTiff using gdal_translate 2) Mosaic's the new Gtiffs using gdal_merge 3) Defines the ...
0
votes
1answer
46 views

Applying Attribute Filter and Spatial Filter simultaneously (GDAL - Python)

quick question on something that has to be simple, but I'm getting stuck on. I want to use an Attribute Filter and a Spatial Filter simultaneously. I have two vector files (an overlaying grid and a ...
0
votes
1answer
38 views

Looping through multiple rasters, and adding them together

I have 5 folders, each with 80 .tif files. These 80 files represent one landsat image taken on a different date. Each folder represents a vegetative indice (NDVI, NDII etc.) Each file in each folder ...
0
votes
0answers
87 views

GeoDjango: Insert geography coordinates and filter the nearest points, step by step

I would like to: Save pairs of srid 4326 (latitude, longitude) points in a PostGIS Geodjango 1.8 Database. (Maximum distance between the edge points: 2.000km) Given a srid 4326 (latitude, longitude) ...
1
vote
1answer
127 views

How to geocode location using twittersearch for leaflet map of tweets

I'm using twittersearch to iterate over user input topics and location of interest that will then be visualized in a leaflet map. So using 'place' I can get a map, no problem. I'm trying to increase ...
1
vote
0answers
52 views

Python MapServer MapScript & Mongo - Use GeoJSON String Vs File

I have been using Python MapScript bindings for MapServer - and they work great. A new datasource for the application I am working on is MongoDB. I have seen mentions of a MongoDB Driver for ...
0
votes
0answers
14 views

Installing fiona on windows 7 [duplicate]

I'm trying to install/use fiona with python 2.7 under windows 7. On import I get the error shown in the following screenshot. Has anyone seen this before? Apologies if this is the wrong forum for ...
2
votes
1answer
70 views

Bulk loading into pyrtree index

I'm using pyrtree to create an index for a point in polygon operation. I am currently trying to insert 1.8 million rows into the index and it takes more than an hour to do so. I am unable to use rtree ...
3
votes
1answer
65 views

Subsetting a shapefile and saving it using PyQgis

I am very new to PyQgis. I have a shapefile containing a lot of information for each place, it looks like this id stat_1 stat_2 ... stat_n i1 0 0 2 i2 1 1 ...
0
votes
1answer
69 views

Enabling or disabling WMS capabilities with python

I am trying to enable Feature Access for all of my services on an ArcGISServer with python. Below is my code. The variablejson is the Feature Access dictionary. How do I make the post targeting ...
2
votes
1answer
53 views

How to multiply a user-defined input parameter with a field value within the graphical modeler?

I have the same Question as asked in this post (How to connect input parameter to the field calculator algorithm within the graphical modeler?) and the answer from Joseph already helped a lot: ...
4
votes
1answer
105 views

GeoPandas GeoDataFrame plot statistics - how?

The plot method of a GeoPandas GeoDataFrame overrides the DataFrame parent method to plot the geometries of the associated GeoSeries. This is very convenient, but I'd also like to use the easy ways ...
1
vote
1answer
58 views

Populate markers in leaflet with tweets and tweet location using python

I am iterating over twitter using python, the user inputs a topic to search for on twitter and then the location to view on the map in leaflet. The leaflet map is created automatically in the browser. ...
9
votes
2answers
288 views

How to reduce the size of shapefiles when features are deleted?

This tiny little script deletes all small features in all layers. This works fine but the size of .shp files are not reduced. Please tell me why... canvas = iface.mapCanvas() expr = ...
0
votes
0answers
73 views

Error installing GDAL for Python on OSX

I'm trying to install GDAL for Python on my mac (OSX 10.9.2). I did: >>> brew install GDAL and got: >>> 🍺 /usr/local/Cellar/gdal/1.11.3_1: 230 files, 33.1M now: ...
1
vote
1answer
68 views

Difference between Crosses & Intersects - Shapely (Python)

I have two questions : I have some lines (eg: road network). I want to find coordinates of each junction. Should i use crosses or intersects function from python's Shapely module? They are giving ...
1
vote
0answers
25 views

unexpected change of area

Selecting a vector layer and running the following script, I expect the total area of my feature-geometries to be the same at the end of execution. from shapely.wkb import loads from shapely.ops ...
1
vote
1answer
70 views

Iterating over Twitter data using TwitterSearch creating array in Arcpy for shapefile

Below is the section of code I'm having trouble with. How do I designate the x and y coordinates from the (lat, lng) variable in the twittersearch for loop in the top part? These coordinates will be ...
3
votes
1answer
109 views

Find rectangle around point with python?

Given a point, latitude and longitude, how would one find the coordinates of a rectangle centered on that point with a known width and height in meters? I tried using the Geodesic stuff from ...
1
vote
1answer
164 views

Installing QGIS using Homebrew

I've been unsuccessfully trying to install QGIS using Homebrew (used Homebrew to install GDAL and GSL) as outlined here My OS is Mac Yosemite, 10.10.5. The installation sort of finishes, but with a ...
2
votes
0answers
122 views

Is it possible to query/download satellite images with Python?

I was wondering if there exists a Python library/API for downloading satellite images. Ideally, I would want to enter the latitude and longitude of a bounding box and get a high resolution image ...
2
votes
0answers
31 views

How can I change the labels in the console output in Google Earth Engine?

This is the second part of my edited two part question (first part here). So I used the following script: // define the var var Catchment = /* color: 98ff00 */geometry; var landcover = ...
3
votes
1answer
69 views

Issue with r.watershed run by QGIS-Python-processing.runalg

I would like to extract flow accumulation and flow direction layers from a DEM calling the grass r.watershed module from a QGIS-python script using the processing class. I obtain just an empty map, ...
4
votes
1answer
68 views

QGIS: Script is being executed successfully in Python console (within QGIS) but not in a standalone python script

I have the following code which I have no problem executing within QGIS (2.8.6) via the python console. What the script does is it adds the two raster layers in my directory via the Raster Calculator: ...
4
votes
0answers
47 views

TypeError: QgsEncodingFileDialog

I am using the latest version of QGIS (Lyon) on MAC and have set the default Python version 2.7. Moreover, I have installed all the required python modules and GDAL. It was working before, but now, ...
6
votes
3answers
128 views

Counting number of vertices of object on vector layer PyQGIS

First of all, I want to say that I know that similar issue was raised before, but it didn't provide satisfying solution. I need to get the number of vertices of every object on vector line layer. ...
2
votes
0answers
35 views

Apply QChainage based on field value

I'm quite new to QGIS and found the great plugin QChainage. Simply put, it allows to create points along lines. There are different modes available. Create points every X meters or Divide the line i ...