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

learn more… | top users | synonyms

1
vote
0answers
37 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
63 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
58 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
67 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
51 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
83 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
44 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
275 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
54 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
62 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
64 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
94 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
117 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
94 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
26 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
63 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
67 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
46 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
108 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
31 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 ...
2
votes
1answer
86 views

Selecting features based on similar name

I am building a script to integrate into a model that iterates through data. I've been able to get two submodels to iterate through the original data and create large numbers of features in file ...
2
votes
1answer
70 views

How can I have the percentage instead of the Frequency in Google Earth Engine? (Edited question)

EDIT : Since I had 2 questions in one, I edited it to only have one (second part here.) EDIT 2 : I got a partial answer on another forum and made my script more universal I have yet another question ...
4
votes
0answers
44 views

How do I implement PyQGIS multithreading to update a progress bar

I am developing a PyQGIS plugin using python. I facing a problem during the implementation of threading in my plugin. I have written a python script which contains a class wrapping all geo-processing ...
0
votes
0answers
21 views

gdal.SaveArray returns Received a NULL pointer

I am saving my 2D array into a raster data using GDAL but could not get it to work properly. I am using the gdal.SaveArray option and it returns ValueError: Received a NULL pointer. I think I used it ...
3
votes
2answers
56 views

Making a simple line- complex

I am trying to make my own version of code to generate elevation profile for a line drawn over a DEM and I got stuck very early on. As a simple use case: I have a line that consists of just two ...
3
votes
1answer
59 views

Build a table with columns of raster values from multiple raster datasets, using Python, GDAL, or PyQGIS?

I have a series of raster datasets, clipped to the same extent, with matching cell resolutions, each of which represent land surface temperatures (LST) captured by the MODIS sensor. Each raster ...
4
votes
2answers
224 views

Correct SQL expression when looping different fields

I'm having trouble with the follow lines of code. Practically what I am doing is a 10 shapefile loop in which field represents the name of the field that I want to be calculated( the name differs by ...
2
votes
1answer
75 views

aggregating using 'gdalwarp -average' resulting in incorrect values

I'm trying to aggregate data up from 0.05 to a coarser 0.25 resolution and am having trouble getting gdalwarp to work correctly. From comparing the original input data with the aggregated data and ...
0
votes
2answers
67 views

Open source option to ArcGIS tool MosaicToNewRaster_management in python?

Is there any open source option in python to mosaic rasters to one raster? The equivalent of the MosaicToNewRaster_management in ArcGIS.
0
votes
1answer
89 views

How to use Python and ArcGIS? [closed]

Is it possible to open a Python file on ArcGIS and use ArcGIS information (from attribute tables) in routines of this Python file? If it´s possible, how can I do?
3
votes
2answers
141 views

ArcGIS python “add field” and “calculate field” workflow

I am new in Python and I am creating a Script. I've crafted a functional code, but I'd like to know if there is an easier way to do it, just for curiosity (And learning new ways!). The purpose of ...
2
votes
1answer
99 views

Installing python xlw and xlrd libraries for QGIS on Mac OSX with Python 2.6

I am trying to use the XYtools plugin for QGIS (because copy-paste is not working with just one of my files?!), and I'm concerned that I actually just need to update my Python but not sure if doing so ...
1
vote
1answer
96 views

AttributeError: 'NoneType' object has no attribute 'dataProvider'

I want to add new column to attribute table of vector layer via Python console. I'm trying to do this following instructions from ...
1
vote
1answer
62 views

How can I download data from an FTP server using python? [closed]

I am trying to download precipitation data from an ftp server. The code that I am using is this, but am still getting errors. import urllib2 ...
6
votes
1answer
49 views

How to recursively get all lyr file properties from a group layer on disk

I'm writing a python script tool that will recursively search through a folder and all subfolders and find all .lyr files. Ultimately, I'm writing a CSV file which contains the path of the .lyr file, ...
3
votes
3answers
72 views

How to generate a list of unique years from date field?

I have data that was collected over many years and I'd like to be able to run a python script tool in ArcToolbox (ArcGIS 10.1) to get a list of unique years from the date field. I found an example of ...
1
vote
1answer
37 views

Loop through a list and concatenate a string in Arcpy

I'm making a program where the user enters some codes (GetParameterAsText) that are going to be used in a SQL expression to select by atributes. I tried to find similar topics but didn't find a ...
1
vote
1answer
33 views

gdal_merge not working in GDAL 201 windows install

I realise this looks like a duplicate of http://stackoverflow.com/questions/31174320/gdal-merge-py-not-working-after-gdal-and-it-python-bindings-have-been-installed, but I think the problem is a bit ...
1
vote
1answer
78 views

Getting inaccurate results converting from New York State projection to NAD83 with Python's pyproj

I've been trying to do a standard coordinate translation between New York State Long Island (ESRI:102718) and latitude/longitude (EPSG:4269)...but I keep getting the wrong lat/lng results. I don't ...
1
vote
0answers
39 views

Correcting for offset

I have a shape file with RTK measurements as a line feature, which more or less corresponds with visible features in a raster layer (shaped as lines). These measurements however are not accurate ...
6
votes
1answer
81 views

Why do I need to use labelling when setting fill colour with a python expression in QGIS?

I'm having problems using a Python function in the expression editor to style a polygon fill in QGIS. I'm trying to use a random colour scheme. However, I need to do this over a series of different ...
0
votes
0answers
48 views

Creating a new shapefile from extracted points using PyWPS

I'd like to know how I can create a new shapefile with PyWPS using the OGR binding. For me it's clear how PyWPS handles inputs and outputs but I don't understand how I can create a new shapefile using ...
1
vote
0answers
26 views

Flipped (Y-axis) Raster from point cloud

I have been working on a project where I need to create rasters from irregularly spaced point clouds. I am resampling my point clouds to a regular 0.25 cm grid using a nearest neighbor method ...
7
votes
2answers
91 views

Polygons across international dateline [-180..+180 longitude]

I'm trying to generate polygons for satellite orbital swaths. So far I have a method to generate two lines which represent the edge of each swath in [lat,long]. Some of the swath's cross the ...
3
votes
2answers
124 views

Deleting polygons with certain height and width in Python script with QGIS?

I have a polygon layer with bounding boxes (boundingLayer). This layer has attribute columns "HEIGHT" and "WIDTH". I want to delete all bounding boxes which have HEIGHT and WIDTH less than 200m. How ...
2
votes
1answer
31 views

QGIS - how to retrieve information on features during editing [duplicate]

I am developing a QGIS plugin that allows me to draw QgsPoints on a vector layer. When drawing, I toggle QGIS's edit mode. In some cases, the last drawn point needs to be deleted. In order to do this, ...
1
vote
1answer
59 views

QGIS docutils install (path,pythonpath,pythonhome)

New to QGIS and Python. Have QGIS installed and working great on Windows, want to install and use Docutils -- Python Documentation Utilities (presumably all simple and small .py programs). I see ...
1
vote
1answer
42 views

Using Leave one out method on kriged data

I am looking for a function to do the following. Given a boundary file, and soil sample points within the boundary I am wanting to use the Leave one out validation technique. What I mean is create a ...