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

learn more… | top users | synonyms

0
votes
0answers
23 views

How do I set up a PostgreSQL database for use with PostGIS and GeoDjango?

The Django docs say to use createdb -T template_postgis geodjango but I already have a database set up. While trying to find out what this actually does and a way to apply it to an existing ...
0
votes
0answers
15 views

Solving OD Cost Matrix gets slower and slower in the iteration process

I have 7000 points, and for each point I want to create a OD cost matrix of that point to all other points and write the result in separate tables - that is 7000 tables with 6999 records each. ...
1
vote
0answers
53 views

How to integrate QT User Interface with QGIS Python Plugin?

I created a very simple python program using GDAL to calculate the summary and reduction between two raster value like this : import os from osgeo import ogr, gdal from gdalconst import * ...
6
votes
1answer
137 views

Extracting the pixelwise proportion of classes of a finer raster in a coarser one

I have two rasters, one has a 1 km resolution. The other has a spatial resolution of 30 m. This latter pixelwise is a classification. I want to overlay the 1 km raster on the classification raster and ...
-1
votes
3answers
93 views

Getting error while opening excel file in Python [closed]

Hi I am very new to python, here i m trying to open a xls file in python code but it is showing me some error as below. Code: from xlrd import open_workbook import os.path wb = ...
1
vote
1answer
23 views

QGIS is not starting because of deleted file libgeos_c.so.1,How can I fix it

QGIS is not starting because of deleted file libgeos_c.so.1,How can I fix it It was originally running but some how I have deleted this file for some porpose installation of postgis for postgress but ...
3
votes
1answer
58 views

How can i generate PDF file in python on QGIS?

I am following these instructions: https://bitbucket.org/rptlab/reportlab but i am getting this error: Couldn't load plugin Importtool due to an error when calling its classFactory() method ...
1
vote
1answer
32 views

How do I keep my python loop going if there is an error with an SDE workspace?

I have a folder with several .SDE connections. I want my Python code to execute various SDE maintenance procedures (such as compress) on each of these databases. If there is a bad/corrupt/not ...
0
votes
3answers
56 views

How to export multiple MXD's using python?

I have several mxd's that use data driven pages to create an updated mapbook every month. 15-18 mapbooks and 163 pages each. This usually takes me two days and I'd like to automate this. I can export ...
2
votes
1answer
28 views

ERROR 000271: Cannot open the input datasets Failed to execute (CompositeBands) (arcpy)

I am trying to stack bands 3 and 4 together for numerous landsat scenes, and I am trying to do it using a loop and arcpy.CompositeBands_management. The code I am using is: import arcpy #set ...
1
vote
0answers
21 views

Python-gdal create geotiff from array with colormapping

I am creating grayscale, single channel geotiff files from numpy arrays with the below module, but I would like to apply a fairly standard colormap to the data. I've tried three channels of R,B and G ...
2
votes
2answers
38 views

How to successfully do “nested” looping over a Fiona collection

I wrote some code that basically loops over all features in a shapefile with Fiona in Python, doing some things, calculating some things, etc. I found that it would exit the for loop prematurely, ...
2
votes
1answer
34 views

QGIS Contour Plugin Says No Shapely; can import shapely in QGIS console

I'm keen to create some contours (isochrones for a pedestrian 'ped-shed' catchment) from a point dataset in QGIS, using the contour plugin from the Plugins repository. I installed the plugin, but ...
2
votes
1answer
33 views

QGIS Python Identify Locations within a Polygon

I have a series of locations stored within a Vector layer and want to write a query to understand which of these locations fall within the polygons from another layer using the QGIS Python console. ...
2
votes
1answer
32 views

How to use spatial filter in PyQGIS?

I have a buffer and need to filter a multipoint layer (QGSVectorLayer) so that I would get only features intersecting the buffer. What I've found: a) setFilterRect() This doesn't accept polygon ...
0
votes
0answers
37 views

Parsing geocoded data using python

I am trying to create a .csv file of parsed information of geocoded data from the google API geocoding service. I want to parse out the address information to be in separate columns. My script runs ...
0
votes
2answers
26 views

Selecting files with matching names and then executing a process

I have two lists and I would like to find a way to select them based on names. In list one I have a series of tif files: list1=['LT50300281984137PAC00_sr_band1.tif', ...
1
vote
2answers
34 views

library to create static maps (an image) with custom map features

Do you know if there is a small library (preferably in python or java) around that allows the creation of static map. Something where you can specific the URL of your TMS server, width and height in ...
0
votes
0answers
30 views

Top fixed position with two lines

I am trying to place 3 labels on a polygon one at the top, middle and bottom. Everything works wells unto the top label requires a new line "\n", then the label drops a little from the top of the ...
3
votes
1answer
59 views

How to toggle Map Tips with PyQGIS?

I want to display "map tips" in QGIS with python for my custom map canvas QgsMapCanvas(). How can I do this? I can switch manually with View/Map Tips but it won't work with my custom canvas in my ...
3
votes
2answers
215 views

Using PyQGIS, ArcPy, NumPy, SciPy Together in Windows Command Prompt

I ran across this slight issue when I was looking to access python installations from ArcGIS, QGIS, Anaconda (cited because SciPy & NumPy come with it), and version 2.7 vs 3. Sometimes, I find it ...
0
votes
0answers
31 views

How to solve UnicodeDecodeError in Python when executing Make Valid LWGEOM algorithm in QGIS?

I'm trying to fix some invalid geometries using the Make Valid LWGEOM algorithm in QGIS 2.8.3 processing toolbox but a Python error occurs: Errore durante l'esecuzione di codice Python: Traceback ...
0
votes
1answer
14 views

Creating polygons or map book from DBF file through ArcPy?

I have a dbf file, which contained a list of coordinate information as shown in below. It also could be thought as a catalog file. Example: ID XMIN YMIN XMAX YMAX 1 -52800.0 ...
1
vote
1answer
24 views

Unable to open datasource with ogr2ogr.main() [closed]

I try to make ogr2ogr work in Python the way suggested by Elevine's answer elsewhere, but I'm facing bugs. Most notable error is that while I try to reproject shapefiles, I get the following error: ...
2
votes
1answer
85 views

Converting a CSV with a WKT column to a Shapefile

Using ogr2ogr in Python, I am trying to convert a CSV to a shapefile. One column in the CSV, named "Polygon", contains WKT like this: POLYGON((long lat, long lat, long lat, etc.)) Currently, I can ...
1
vote
0answers
29 views

Run a exe file from QGIS

I am trying to run an exe file from the python console in QGIS. my_aplication.exe is a script made in Python3.4 and 'compiled' to windows exe file import os ...
0
votes
1answer
36 views

How add a text field and then reproject all shapefiles which are in sub folders

I have a folder and inside of that folder, I have about 500 sub folders which contain on average about 5 shapefiles each. What I want to do is: to check if there is a field, lets say field_1, and ...
0
votes
1answer
47 views

Is there any packages to download landsat image by shapefile boundary in R or python? [on hold]

I want to find a package which can automatically download images within a predefined administration boundary (shapefile format). Does anyone know a package can conduct or simplify the process?
-2
votes
1answer
47 views

Very Large Coordinates when Reading Shapefile using Python

When using Python anad fiona package to read a shapefile of Boston, I am getting very large values in the tens of thousands. Why is this? # Import Boston shapefile shapefilename = 'ZIPCODES_NT_POLY' ...
0
votes
1answer
31 views

ArcGIS desktop won't import arcpy

I have arcgis 10.3 and I am trying to run a task using python but the python window within arcmap won't import arcpy. This never happened to me with 10.2.2. The error returned is: Runtime error ...
0
votes
2answers
55 views

Batch Extract by Mask, but customize individual output names

I want to extract by mask (the same mask everytime) on about 500 raster's, but I want to just append the name of every input raster. So if a raster is titled Landsat_010182 I just want to add _clip ...
0
votes
1answer
34 views

Getting GeoJSON formatted properly for Leaflet?

I am trying to get data put on a leaflet map that I have set up. I am following this tutorial: https://www.youtube.com/watch?v=fDfkjx-VhLI I have all of the html, css and js scripts up and running, ...
2
votes
1answer
50 views

python crashes with returned gdal band object from a function

I wrote these two functions in a module when I want to read the band in NetCDF or HDF files and return the band outside the function. Each HDF and NetCDF has many subdatasets. Each subdataset in a ...
1
vote
0answers
54 views

QGIS 2.8 Python Plugin Unittest Segmentation Fault 11

UPDATE: This issue may be isolated to my MacBook. The seg fault did not occur in testing on Windows. I have put together a sample unit test for a QGIS python plugin. It is causing a Segmentation ...
0
votes
0answers
24 views

Python crashes when I try to import GDAL after re-installing it

A while back I went through the installation process for GDAL by installing the core components and then the Python/GDAL bindings. Everything was fine when I would type in from osgeo import gdal. ...
1
vote
0answers
15 views

QgsPalLayerSettings is not defined

So I'm writing some script for QGIS 1.8 and I'm unable to resolve this error. from qgis.core import * pallyr = QgsPalLayerSettings() The second line gives me error that QgsPalLayerSettings is not ...
-5
votes
1answer
50 views

Can somebody help with me with my if statement code on the bottom [closed]

try: # Import the modules import arcpy from arcpy import env # Set up the environment env.workspace = r"C:\Users\Neng\Desktop\Fire_Files_For Oct_2010.gdb" env.overwriteOutput ...
1
vote
2answers
77 views

Changing field values with ArcPy update cursor?

I want to figure out how to be able to change values in fields for use in further projects. Right now , I would like to be able to add '-WA' to the existing field value 53. (ie 53-WA). This is a test ...
0
votes
2answers
60 views

Request for feedback on python script to increase efficiency with cursors

I’m new to python and would love some suggestions on improving the efficiency of my script. Background: My script is intended to create a report of the dominant and limiting soil types for ...
1
vote
1answer
39 views

Regarding the Python package PyGeoprocessing, does that need to be installed?

I have not found much documentation on PyGeoprocessing, but from what I have read, I would like to try it out. I downloaded the package from here . . . https://pypi.python.org/pypi/pygeoprocessing. ...
0
votes
0answers
32 views

How can i create a table in pgAdmin using python?

i am using below SQl query in python cur.execute('''CREATE TABLE Ambhara_Survey (id SERIAL PRIMARY KEY, geom geometry, chalta_no TEXT, ror_area TEXT, ...
1
vote
1answer
33 views

Event programming in QGIS

I have identified a need to change VRTs raster order through its order of appearance in it's respective XML file. Unfortunately this seems to not be possible to do dynamically using QGIS commands or ...
0
votes
0answers
20 views

layer name and longName are identical when they shouldn't be

I am attempting to use a script to re-source a bunch of layer files in a folder (adapted from Unable to change data source path for group layer file): import arcpy, datetime, os, io, sys def ...
1
vote
0answers
32 views

Make “qgis:delaunaytriangulation” and “qgis:dissolve” save their outputs on a specific predefined layer

I'm new to python and QGIS. I'm working on modifying a plugin which runs algorithms "qgis:delaunaytriangulation" and "qgis:dissolve" like so delone_triangles = ...
0
votes
0answers
13 views

List of default attribute of a feature?

I am working with c++/!qt with the c++ api qgis 2.8.2 for a stand alone project application I had to change and add attribute for feature Does anyone know where i can find the default attribute of a ...
1
vote
1answer
36 views

QGIS script doesn't commit attribute changes

I have a script to generate random points within a polygon, and to give the points the attributes of their host polygon. It generates points, but for some reason it won't commit the changes to the ...
1
vote
1answer
31 views

ST_MakeValid is not working?

I have a polyline spatialite database, tried to perform repair geometry in QGIS using python with the following code: from pyspatialite import dbapi2 as db conn = db.connect(r'D:\db.sqlite') cur = ...
0
votes
1answer
29 views

Problem with arcpy.ValidateFieldName and unicode characters?

I am having problems with the arcpy.ValidateFieldName function in combination with unicode characters. I want to add a field to a shape field. The field name is not allowed to be bigger than 10 bytes ...
0
votes
1answer
19 views

Add event listener on QGraphicsEllipseItem

I'm creating a QGis Plugin in python which has a QGraphicsView in which I draw and ellipse on which I want to detect if the user clicks. I know the ellipse inherits QGraphicsItem which has a ...
0
votes
1answer
36 views

Import shapfile to Postgis using Python and ogr?

Iam not able to import a shapfile to PostGIS using the same library(ogr). I am using below link but it give me error. Import shp to Postgis using Python and ogr Error : Traceback (most recent call ...