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

learn more… | top users | synonyms

1
vote
1answer
21 views

Is it possible to publish a geoprocessing services that uses another dll?

I have a functional model (Note: not something from ArcGIS Model Builder) that is distributed as a compiled dll that I want to access via ArcGIS. Right now I am writing python wrappers to ...
1
vote
1answer
64 views

-9999 (no data value) becomes 0 when writing array to GDAL memory file

I am trying to reproject and resample (1000m ->> 30m) a raster image (shape 238X406) using gdal.ReprojectImage() function in Python. The input file has -9999 cells as no data value. The result is an ...
0
votes
2answers
52 views

Calculate and Restart Sequential ID for Unique Values in a Field

I need to calculate a sequential ID for unique values in a field. So, for the values in Field1, the sequential ID count should count all occurrences of that value, then restart the count for the next ...
1
vote
2answers
69 views

Python and QGIS multiprocessing documentation?

Where can we find better documention for python QGIS multiprocessing. Especially regarding the multiprocessing of python and QGIS.
1
vote
1answer
40 views

I am using “Hindi and Gujrati” font then I am getting “Black Squre Dots”?

At the time of generating PDF file when I am using “Hindi and Gujrati” font then I am getting “Black Squre Dots”. Below I am using code. Here I am trying to convert in UTF-8 but it’s not converting. ...
3
votes
1answer
49 views

Standard user interface for QGIS plugins

QGIS plugins found in "processing" all have the same user interface. In particular, to open a file, the selector either show the list of already downloaded files, or have a "..." button to browse and ...
1
vote
1answer
166 views

How to enable the snapping options for vector layer using the python programming?

I want to enable the snapping options for the the existing layers using python programming. How can I do this?
2
votes
1answer
63 views

How to add loading bar in QGIS Plugin development?

Every time i use tool or plugin in QuantumGIS, i saw a kind of bar like this for indicating loading progress : The different between that bar and Progress Bar is that progress bar will increase ...
2
votes
1answer
176 views

How can i add a north arrow in QgsComposition?

I'm trying to add an svg image of north arrow in QgsComposition using this code: mapRenderer = iface.mapCanvas().mapRenderer() theComposition = QgsComposition(mapRenderer) ...
49
votes
15answers
16k views

Resources for learning Python programming with generic GIS goals in mind?

In your opinion, what is the best book/site to learn Python with GIS goals in mind? By "best", I mean: not very long (book) easy to understand (book/site) good practical examples (book/site) For ...
2
votes
1answer
70 views

Is it possible to remove parameter values from the Python Window when running a script in ArcGIS?

When I run a python script in ArcGIS Desktop 10.1 the values from the parameters will be written to the Python Window (marked with red in the picture below). Does anybody know if it is possible to ...
6
votes
3answers
1k views

Count number of attributes for unique field values

Running ArcGIS 10.1, I have two feature classes in a geodatabase. One is a point FC for polling stations, the other is a polygon FC for states. The polling station FC contains over 1000 points and ...
2
votes
1answer
412 views

Multiprocessing error in QGIS with Python on Windows?

I have this error when I try to use Manager() from python multiprocessing library. (Just start QGIS open Python console and execute the two following lines) >>> import multiprocessing ...
20
votes
3answers
7k views

How to call gdal_translate from Python code?

Is it possible to use some gdal API to call gdal_translate from Python code? I do not mean simply executing the gdal_translate.py from the file system, but rather call it somehow in code so I do not ...
4
votes
2answers
256 views

Image processing using Python, GDAL and Scikit-Image

I'm new here and I'm sorry if I do something wrong. I am struggling with a processing and hopefully I will be able to solve here. I work with Remote Sensing applied to Forestry, especially working ...
1
vote
3answers
92 views

How to copy entire fields into a python list

I'am trying to find a way to copy entire fields(columns) in a feature class attribute table as lists inside a master list (python). To illustrate it, consider the table below: So the list should ...
4
votes
2answers
92 views

Difference in destination location between pyproj and geopy

I am looking at ways to calculate (in Python) the destination location from a point given bearing and range. Based on the results comparison from the 2 libraries in subject(geopy and pyproj), I ...
0
votes
0answers
26 views

Converting csv files into shapefiles using python [duplicate]

I have a csv file which i want to convert in a shapefile. i have seen many questions being asked on this topic but the main problem is all the polygons were of the same size but in this csv file the ...
2
votes
1answer
141 views

Is it possible to read raster files by block with rasterio?

I find rasterio much easier to use that plain ogr/gdal, so I'd prefer using it. However, I need to process large rasters, so reading rasters by block as explained in the Python GDAL course is ...
0
votes
1answer
452 views

Calculating intersection between points and polygon in shapefile

I want accomplish the following using command line python tools only (shapely + fiona) I was wondering if there was a straightforward way for me to do the following: Read in a shapefile (all ...
13
votes
3answers
5k views

How to find and merge duplicate points?

I have two point shapefiles: Red and Blue. Each point shapefile has a z value which represents a radius (i.e. represented as buffers in the example). A duplicate point is defined as a point that ...
4
votes
2answers
259 views

Is there a function to select a region of a map for further processing with Python?

I would like to select a map's region in QGIS for further processing with python console. Ideally I would like to select the region with a mouse drag (like Gimp crop function) and then e.g. analyze ...
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 ...
2
votes
1answer
218 views

Import error when utilizing QGIS's Python Init function

Based on the answer to Referencing Qt UIs external to plugin with python. I'm trying to utilize the "Layer Properties / Fields / Python Init function" to execute a file (test_file.py) that is located ...
2
votes
2answers
1k views

OSR Python testSR.ImportFromEPSG(4326) returns empty spatial reference

This is empty using Python .ImportFromEPSG(4326): import osr #this fails: testSR = osr.SpatialReference() testSR.ImportFromEPSG(4326) print testSR.ExportToPrettyWkt() #why did the import from EPSG ...
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. ...
0
votes
1answer
338 views

Orthographic reprojection with mapnik

I am trying to create a google earth like wep application. My problem is that I can't get to render a full view of the earth. The zoom_all() function generates the following error : RuntimeError: ...
4
votes
1answer
2k views

gdal ImportError in python on Windows

Trying to import gdal for Python 2.7.3 on Windows XP: >>> import gdal Traceback (most recent call last): File "<stdin>", line 1, in <module> File ...
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 ...
1
vote
0answers
54 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 * ...
0
votes
1answer
372 views

Polygon Neighbors Analysis script (ArcPy 10.1) producing erroneous results?

I'm struggling with a python script that is supposed to calculate a field for a polygon feature class. The calculation is of the average of a field value (P_TOT_DEV) for each of a given polygon's ...
1
vote
1answer
32 views

Ways to reduce buffer if it passes through a certain layer

I am trying to do WiFi analysis on signal strength in ArcGIS Desktop, and one of the big problems that I am running into is how to reduce the signal when it comes in contact with a wall, as it does in ...
7
votes
1answer
309 views

Python toolbox works in ArcToolbox and in Python console, but not in ArcCatalog

I have a set of Python tools in a Python toolbox (.pyt). They are broken into multiple files and modules and have been functioning correctly, but now I'm seeing inconsistent behavior on multiple ...
0
votes
1answer
152 views

Weighted Overlay - passing parameter as text error?

For some reason when hardcoding the save path for the wieghted raster just before runtime it works perfectly. Like such... arcpy.env.cellSize = "90" arcpy.env.workspace = r'G:\Xcel\Route ...
1
vote
1answer
40 views

batch save MXDs to group layer files using ArcPy

Does anyone have / know of a script that converts all the MXD`s in a folder to individual group layer files ? It needs to use the MXD name as the group layer file name.
3
votes
1answer
60 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
24 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 ...
2
votes
1answer
189 views

How to make crs transformation of a QgsVectorLayer?

I need to transform QgsVectorLayers in python from one crs into another crs. By googling I found the following solution ...
2
votes
2answers
2k views

Merging many rasters using Python

I have a list of many many rasters. I want to have a simple and easy to understand script that takes this and merges it into one big mosaic. I found a similar question but the accepted answer adivices ...
0
votes
3answers
57 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 ...
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 ...
2
votes
1answer
226 views

Accessing CRS info with pyqgis in a standalone application

I'm currently having trouble accessing and defining CRS information in a standalone application. I've read the API documentation and have tried it in the python console in QGIS 2.2.0. The python ...
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 ...
3
votes
1answer
235 views

Why is GDALPolygonize so much slower than ArcGIS Raster to Polygon?

I am attempting to polygonize a raster using GDALPolygonize() in a Python script. The script began polygonizing yesterday at 5pm and is still polygonizing now at 9:30 am. I have no clue how far ...
1
vote
0answers
24 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
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 ...
2
votes
1answer
87 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 ...
9
votes
7answers
18k views

How to get X Y coordinates and cell value of each pixel in a raster using Python?

I’m really new to Python and I would like to know whether there is a quick method to get cell values of a raster pixel by pixel and the coordinates (map X Y coordinate of centre of each pixel) using ...
4
votes
1answer
1k views

How to create mask bands in GDAL and Python?

I have small program in Python that uses gdal and numpy to perform a logarithmic scale of some data into the RGB 0-255 range. Now this input data has a nodata value set to mask the valid values, and ...