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

learn more… | top users | synonyms

0
votes
2answers
164 views

How to read Oracle data with PyQGIS? (“identifier is not long” error)

Do you have any idea how load Oracle spatial data to QGIS with using the PyQGIS? Is it possible? I try: uri = QgsDataSourceURI() uri.setConnection("*host*", "1521", "*database*", "*username*", ...
3
votes
1answer
252 views

How to use SAGA ShapesToGrid via Processing in a Python plugin?

I run these lines in my code: vectorlayer_vector = ftools_utils.getVectorLayerByName(inputLayer) Elevation = self.lineAttrib.currentText() cellSize = int(self.linePix.value()) outPath = ...
0
votes
0answers
13 views

Update Spatialite table with Python

I wish to update a column in a Spatialite table from a dictionary object using the pysqlite module in Python 2.7. I am accustomed to executing this operation on ordinary, i.e., non-spatial SQLite ...
0
votes
0answers
22 views

How to write python scripts for attribute tables in ArcGIS

I am practising python scripts and a beginner. I get stuck and hope anyone else here can suggest me what commands/scripts i need to use to query: Classify accident types, % of each type over a total ...
0
votes
4answers
151 views

Extract raster values gdal looping rasters

I have this code, most of them getting from this forum. I need to loop over a folder and sub-folders, or just to run a list (putting previously all the raster inside, I don't mind one way or the ...
-1
votes
2answers
206 views

Connecting to Oracle database on a network in python

There is lots of information out there on how to do this, unfortunately, it all looks like Greek to me. I need a connection to a DB so I can add and use tables and featureclasses contained within ...
2
votes
1answer
16 views

How to load stored composer from project file in standalone QGIS application?

I would like to load a .qgs file and get a composer from it, but I can't figure out how. Is there a way, or do I have to read the xml myself and individually set the appropriate values for the ...
0
votes
1answer
31 views

Point Sampler Python Error in QGIS?

I downloaded the point sampling tool for QGIS and I'm trying to run it. A few days ago it worked fine, but now it gives the following error: An error has occured while executing Python code: ...
2
votes
1answer
33 views

How to launch Processing tool User Interface using PyQGIS?

I am trying to launch the UI of a processing algorithm using Python script but I cannot find a simple way for it (aside double clicking on it in the process toolbox of course). The plugin is a water ...
3
votes
2answers
609 views

How to customize the QGIS GUI using Python?

Is it possible to hide/remove/customize the default UI of QGIS from a Python plugin? I want to add my own menus and toolbars and remove some included by default in QGIS. If it's possible, which ...
2
votes
4answers
770 views

How to find and apply reprojection parameters?

I have a data set in one projection, and a shapefile in another, and I am trying to combine the two. I am using Python. I apologize for posting a "help me transform coordinates" question on this site ...
4
votes
2answers
1k views

How to automatically reload raster layers if source is changed in QGIS?

How to automatically reloaded raster layer if source is changed? (The path is the same but inside source file are changes) I use: qgis.utils.iface.mapCanvas().refresh() but layer not refresh. # ...
1
vote
1answer
497 views

Using GDAL to read dted files

How do I get the elevation at a certain point using gdal to read in a dted file? I don't see much useful information out on the web. I'm sorry I should have been more specific. How would I ...
3
votes
1answer
139 views

DBSCAN gives “AttributeError: NoneType has no attribute issparse”

I am running a Python script invoking the DBSCAN tool to cluster feature points. When I open ArcMap, load the feature layer, and run the script, it works the way I expect it to. But if I run it ...
2
votes
1answer
158 views

How to print 2 maps in the same PDF page using PyQGIS?

I am trying to generate a one-page PDF document containing the following items: 1) On the left half, a full state map (say, New York State). 2) On the top right quadrant, a map that zooms in to one ...
4
votes
3answers
644 views

How to find unique values of an attribute with python in qgis?

i look for solution to get the unique values of an attribute of a vector layer. what is the best way in python qgis to get the unique values of one distinct attribute? I work with qgis 1.8.0.
1
vote
2answers
56 views

How to show variable values in message bar in QGIS?

I know that I can write custom text to message bar with the QgsMessageBar.pushMessage() method. But if I understand the documentation right, there's no room for variables added to a string where they ...
2
votes
2answers
568 views

'QgsVectorDataProvider' object has no attribute 'select'

I want to create a tool layer in QGIS 2.4 that will select any vector features that intersect with that point. In my script I tried the following function: def selectFeature(self, point, button): ...
0
votes
0answers
8 views

Element retrieval in owl file format using python

I just created my ontology file for semantic relation using protege.My ontology file is in the foram of owl.I need to compare two relations doamin and range.But i dont know how to do it.
1
vote
1answer
16 views

How to register a broadcast on QGIS to start my plugin on start after loading plugins

I want to perform a default task when user opens QGIS but here I am building it as a python plugin so I want a signal or broadcast to call my plugin. I didn't build QGIS from source my plugin should ...
3
votes
3answers
1k views

How to extract X Y coordinates and RGB from pixels using python in QGIS?

I'm trying to white a Python plugin in QGIS (2.2) to get, for each pixel of a raster image, its X Y coordinates, as well as, its RGB (3 bands) values. At first I opened the raster file using: rlayer ...
3
votes
2answers
245 views

Issue while running grass from subprocess

I have a map based web application using geodjango. I needed to display the crime hotspots within a selected polygon area. I found that v.kernel is very good for generating heatmaps/hotspots. So in my ...
1
vote
0answers
35 views

Multiprocessing in python qgis?

When i try to do mutliprocessing in python Qgis it doesn't work from multiprocessing import Process,Lock import multiprocessing def name1(l,i): print i if __name__=='__main__': lock=Lock() ...
2
votes
3answers
364 views

Geodjango read raster files

I am developing a web app in geodjango (django) framework but I need to import raster files. Is it possible a geodjango app read raster files from a directory? Thanks
0
votes
0answers
15 views

show polygon from database in browser in geodjango

I tried to retrieve the polygon which I saved into postgis database. (all polygons) Here is my code: models.py from django.contrib.gis.db import models class MyMap(models.Model): name = ...
0
votes
0answers
13 views

how to rotate a symbol

I am working in c++/python/QT 4.5 with the api qgis 2.8.2 My application receive data from a communication port that indicate the change of position of an object diplayed on the map and represented ...
2
votes
1answer
55 views

Unable to execute a python script that was exported from ModelBuilder

I have a model that copies a single F.C form SDE geodatabase to a scratch geodatabase then copies it back with a new name to the same SDE geodatabase again. And this works perfectly form the model. ...
37
votes
10answers
11k views

What are some resources for learning ArcPy?

I would like to learn ArcPy, but I do not know quite where to begin. Does anyone have any good advice on where I should start to learn ArcPy?
1
vote
1answer
50 views

Python script to copy first row of certain attributes and paste in the newly digitised rows the copied features

Starting from this question, I need a script to be insterted in the processing graphical modeler that can copy some attributes from the first digitised row in all the newly digitised lines of a ...
0
votes
0answers
9 views

Getting netCDF data into PostGIS database using Python?

I can read the netCDF file data with netCDF-python or with gdalinfo, but I am unsure of the easiest way to get it into a PostGIS database. It would be really easy if I could convert the netCDF file ...
1
vote
1answer
22 views

How do I batch input alias names from a table for a large dataset in ArcMap or ArcCatalog?

I would like to populate the alias names for the fields in the ACS 2014 5 year estimates file geodatabase (all 11439 of them). The ACS fgdb comes with the short_name and long_name in the metadata ...
-5
votes
0answers
29 views

Drawing polygon on PDF in Python? [on hold]

How can I draw a polygon on PDF in python? I am using http://www.blog.pythonlibrary.org/2010/03/08/a-simple-step-by-step-reportlab-tutorial/ for making PDF file.
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 ...
0
votes
0answers
5 views

What is the default mosaic_method value for MakeMosaicLayer_management?

What is the default mosaic_method for MakeMosaicLayer_management (see help here)? Usually, the docs say This is the default after the default value. And that is usually first option listed. Is the ...
3
votes
5answers
67 views

Is there any simple integration for counting points in polygon using python qgis?

Is there any simple integration for calculating count of points in polygon using QGIS-Python integration? In other words, are there any pre-defined functions for points in polygon of QGIS using ...
2
votes
2answers
30 views

Store in a python list the attribute table of a vector in QGIS

I'm stuck with a very simple issue.. I've loaded in QGIS (through the py console) a csv layer (no geometry) made of 4 fields and 3 rows: #load the csv layer = QgsVectorLayer("path/to/the/csv", ...
2
votes
0answers
40 views

Converting large rasters to NumPy

I have a geodatabase that contains a large number of raster datasets - there are two rasters for each country in the world, and they are very large, in some cases up to 3GB per raster dataset. I ...
2
votes
2answers
367 views

Why does “takes no arguments” error propagate from Arcpy example?

I was attempting to run Setup_Customers_Using_Tabular_Data , I modified the paths to fit my environment but when I run the program I receive SetupCustomersByTable() takes no arguments (6 given) ...
0
votes
1answer
25 views

arcpy.da.SearchCursor, cannot read preceding zeros from csv

I'm using arcpy.da.SearchCursor to read a csv that has a column with preceding zeros, e.g.: myCSVColumn 0124578 12598 04589 012568 ... When using the arcpy.da.SearchCursor it returns the value w/o ...
0
votes
1answer
553 views

Transforming between epsg:3857 and Google Maps Tile coordinates

Hio, I used to use a simple python project (https://github.com/hrldcpr/mercator.py) to convert between wgs84 and google maps tile coordinates. This project doesn't have a license, and looks like it ...
0
votes
4answers
112 views

Model Builder Error: Python cannot be found

Building some models in Model Builder for a training session, and it's not working out so well. Model Builder can't seem to find Python. Model Builder Error 000574: Python 2.7 is not installed ...
5
votes
3answers
1k views

Checking for number of shapefiles in directory using Python?

I want to test: to see whether or not ONE AND ONLY ONE shapefile (which will be based on a filename wildcard) exists in a directory. Add these shapefiles to a list Use this list variable as an ...
2
votes
1answer
81 views

Creating subfolders in ArcPy's 'in_memory'

Is there a way to create a subfolder in memory in ArcPy? For example, instead of temporarily saving a dataset under: r'in_memory/bufferOne' I would like to save it under: ...
1
vote
1answer
206 views

40k+ points from Shapefile, clustering them and populating on Google Maps/Webapp

I just started a new Python/Django webapp job related to GIS (and i'm totally new to GIS). Here is my task and what i have found so far, and i am stuck as to finding out what's the best way or the ...
2
votes
0answers
61 views

Can we create buffer analysis using python in qgis?

Can we create a buffer of distance 0.004 using python in qgis. I tried this link, but it isn't working for python in qgis 2.10.1-Pisa. The above is the diagram of buffer I am asking. It's located ...
1
vote
2answers
199 views

Call output files in temporary directory through Processing Toolbox (python)

I need to create temporary files as intermediate output to be used with processing algorithms. So, I implemented this: Processing.runalgorithm("grass:v.to.rast.attribute", ........, None) This line ...
1
vote
2answers
32 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 ...
2
votes
0answers
18 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, ...
5
votes
1answer
93 views

How to exit QGIS after running a python script?

I would like to run a python script via qgis --code myscript.py and then immediately exit. I'm using iface.actionExit().trigger(), which kills QGIS when I run it from the python console, but not when ...
2
votes
1answer
203 views

Extract data from netcdf using a shapefile polygon in python

I need to subset data from a NetCDF using a specific shapefile. The data are sea surface temperature and ocean color at 1/4 degree resolution. I have 4 polygons describing the US. Northeast ...