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

learn more… | top users | synonyms

2
votes
2answers
123 views

Problem with accessing the layer legend using pyqgis in QGIS 2.4

I'm trying to clear the layer selection using pyqgis. It appears to me that: lgd = iface.mainWindow().findChild(QtGui.QTreeWidget, "theMapLegend") Doesn't work in QGIS 2.4 to access the layer ...
2
votes
1answer
138 views

How to detetmine county of GPS coordinate?

I have a SHP file that contains all counties in the USA. I also have roughly 100 million GPS locations. I need to tally the number of GPS locations per county. A linear search through the counties ...
2
votes
1answer
116 views

Python and gdalwarp: change resolution of raster

I am new to GDAL and have been having some hard time figuring out how to change a raster's resolution and how to align it to another existing raster. I have come to the point where I have a raster ...
2
votes
1answer
113 views

Basin numbering according to Pfafstetter Method?

I would like to divide my basin into subbasins and numbers according to the Pfafstetter method. Is there an easy way to implement this in Python using ArcPy? Or are there some freely available ...
2
votes
3answers
474 views

How to increase raster extent by filling extent with no data using ArcGIS Desktop without Spatial Analyst?

I am using feature to raster to rasterize water polygons. It only makes a raster the extent of the features in the polygons, whereas I would like it to be the extent of another existing .tif image. ...
2
votes
1answer
204 views

How to batch process near feature distance in ArcGIS

I have 2000+ point shape files. These are all GPS tracks. I want to calculate the distance from each point to the nearest feature (road, train line, restaurant etc) within a 30 meter radius. I am ...
2
votes
1answer
131 views

Python console not working at all

My python console won't work at all. I can't open it. My QGIS version is 2.4. OS is win7 64. I've reinstalled QGIS a few times but I always get the same result. Strange. Something went wrong with the ...
2
votes
1answer
80 views

Use point shape file to spatial query multi polygon shape files with python?

I have an address point layer and would like to spatially query this layer using various polygon shape files to intersect this information so that each address contains the attributes from these ...
2
votes
1answer
82 views

Filtering MSSQL layers in QGIS doesnt work

In my QGIS Plugin I am filtering layers with this Python code: FeatureIterator = layer.getFeatures( QgsFeatureRequest().setFilterExpression ("Fieldname='SomeValue'") ) for feature in FeatureIterator ...
2
votes
1answer
73 views

Convert polyline to presence absence raster in arcpy

I have a polyline that I am converting to a raster in arcpy. This is occuring within a loop and at each iteration I change the processing environment to a different area of interest. In this case it ...
2
votes
1answer
1k views

Conditional Statements in QGIS raster calculator?

What is the equivalent statement of the following expression in the QGIS raster calculator? Con(((Abs("DEM" - "FSMin") > 120) | (Abs("DEM" - "FSMax") > 120)), 1, 0) I have no problem ...
2
votes
1answer
68 views

How can i add script with math functions to model builder?

I am very new to model builder + python. (Sorry for my english too) I am trying to make a model. Don't know if it matters to upload it. If you want i can. I want to calculate variance from a ...
2
votes
1answer
85 views

Error reading large virtual raster with rasterio: “Cannot invert degenerate transform”

I've created a virtual raster using gdalbuildvrt, which covers a large extent (England) at a high resolution. The data is fairly sparse, focused around the coastlines with no files covering inland ...
2
votes
1answer
146 views

SetFeature creates infinite loop when updating sqlite feature using OGR

when using the SQLite driver in python - setting a feature after changing an attribute field value creates an infinite loop on the first record. the same code works fine if i substitute the sqlite ...
2
votes
1answer
206 views

How would I group values in a field based on range of number using python, and then update the attribute table?

An example of what I'm trying to accomplish is described below, however they don't describe how to use the data update cursor to update the attribute column. data - Group values based on range of ...
2
votes
1answer
436 views

QgsMapRenderer to export current extent using PyQGIS

I am trying to accomplish PyQGIS simple map rendering via the QGIS 2.0 Python console, but end up with only a blank image. I've followed instructions of this link. My objective is to export a simple ...
2
votes
1answer
182 views

How to add an interpolation raster from the python console in QGIS?

I'm trying to add an interpolation layer based on an existing vector layer by using the Python Console (initially in the menu Raster/Interpolation), but can't find anything related in the ...
2
votes
1answer
291 views

Does not show shortest path in networkx (in QGIS)

I used the following commands (in qgis console) to get the shortest path with astar algorithm. But the result shows 'NetworkXNoPath' every time. Why was that? Please help me to find a solution to this ...
2
votes
1answer
306 views

FME - Use Python Caller to Set Search Envelope in Another Workspace

I have an FME workspace which has a number of different workspaceRunner transformers. The first workspaceRunner launches a workspace which buffers a pipeline and outputs the bounding coordinates to a ...
2
votes
2answers
571 views

Union multiple shapefiles with overlapping shapes

I have several shapefiles that overlap and I would like to union their geometries to get rid of those overlaps. I know how to do this with OGR and Python for single geometries. from osgeo import ogr ...
2
votes
1answer
277 views

How do I plot a line on a map, or obtain the latitude and longitude coordinates of such a line, that is 120km north of the US-Canada border?

How do I plot a line on a map, or obtain the latitude and longitude coordinates of such a line, that is 120km north of the US-Canada border, including parts of the border that cross water? (I managed ...
2
votes
1answer
278 views

Can we access the ArcMap Image Analysis tools using Python?

Esri recently added a new Image Analysis window to ArcMap - it's found under > Windows in the main toolbar: The Image Analysis window's Processing section simplifies the experience of applying ...
2
votes
2answers
486 views

Python problem visualization .tif image

I am trying to read a hyperspectral image in Uint16 .tif format and visualize it. I use GDAL in Python to read the data and everything works perfectly when I use matplotlib to show one band of the ...
2
votes
2answers
2k views

Qgis - Couldn't load plugin 'processing' - name 'QsciLexerCustom' is not defined - Manjaro

UPDATED I receive the following error when I start Qgis: Couldn't load plugin 'processing' from ['/usr/share/qgis/python', '/home/v/.qgis2/python', '/home/v/.qgis2/python/plugins', ...
2
votes
1answer
486 views

Hydrology tool dataset in ArcGIS 10.1 for calculating slope?

I am quite new to the hydrology toolset in ArcGIS and thought it may be useful for extracting slope data from a raster. I was wondering if anyone had experience trying to extract slope data upslope ...
2
votes
2answers
257 views

Is there a way to do a python batch script for Analyze and Compress on SDE Databases?

I created and modified python scripts based off of ERSI's example (http://resources.arcgis.com/en/help/main/10.2/index.html#//003n000000v7000000), however, what would be great is to be able to batch ...
2
votes
1answer
76 views

Labeling only the latest feature

I need to label only the latest feature in a particular feature class. I actually would like to automate it, so that when I will add any new feature to this feature class, the label will automatically ...
2
votes
1answer
1k views

How to use PyQGIS ( Python QGIS API ) to open/close Update Drawing Order checkbox in QGIS2's Layers (Legend Interface)

Thanks qgis 2, the Legend Interface (layers dockwidget) now has Update Drawing Order check box on right-click mouse context menu. I think this feature can let user temporally closes rendering, then ...
2
votes
1answer
254 views

How to use Python console under QGIS 2 with gdal module?

I am trying to move my plugin from QGIS 1.8 to QGIS2.0. However, the gdal module cannot use under QGIS2.0. I try to use Python console, typing: import gdal #it's OK gdal.GetDriverByName( ...
2
votes
1answer
306 views

Clustering polygons by sum of values

I would like to group polygons that (1) are contiguous and (2) when the combined values of field X >= Y. Specifically I am grouping zipcodes that are connected. a group is when 1 or more zipcodes ...
2
votes
2answers
196 views

How to create simple select script in ArcPy?

I am new to Python and want to create a script inside the ArcMap Python window. My current workspace is a series of rivers portrayed in the state of Ohio. I have a list of fish and the rivers (from my ...
2
votes
1answer
337 views

Problem with running Python scripts in ArcMap [closed]

I'm having a problem to get my python scripts running in ArcMap. I keep getting this message no matter what script i use. Executing: Script1 Start Time: Thu Dec 05 15:37:50 2013 Running script ...
2
votes
1answer
296 views

GeoDjango - return SRID of geometry in GeoQuerySet

I'm wondering if there is a function in GeoDjango which would allow me to determine the SRID of a geometry column in a GeoQuerySet. I know I could do it with a raw SQL query (I'm using PostGIS) but I ...
2
votes
1answer
112 views

How to determine line numbers within an LAS file?

I am working with mulipulse lidar data that collects points along a number of lines within the flight path. From what it appears there are four scan lines within the data, at different intervals but ...
2
votes
1answer
150 views

Arcpy.GetRasterProperties_management values do not match values found via ArcCatalog or ArcView

I am using Arcpy to extract the mean and standard deviation values of tiff Landsat satellite images and I get very high values. Values in the thousands rather than in the low hundreds! If I look at ...
2
votes
1answer
244 views

How to join USDA SSURGO soil table data to features in QGIS?

I am trying to make a soil map using QGIS. The only problem is that I cannot join table data to features in QGIS. In ArcGIS for Desktop you just open the folder and then join the tabular table ...
2
votes
2answers
583 views

Calling variables within ArcPy functions

I have a defined function (ex. def my_function(x,y)). def my_function(x,y): """algorithm""" my_variable = my_function(filex, filey) How can I call this variable within the code block section of ...
2
votes
1answer
210 views

Does spherical equilateral triangle T contain point P?

I am working on a Python script to: compute the vertex coordinates of a geodesic sphere/icosahedron, project the triangles onto a sphere, then find which spherical triangle contains an arbitrary ...
2
votes
1answer
529 views

How to create a symbol with graduated marker size and line width in pyQGIS?

I am using QGIS + pyQGIS + Python. Layer geometry is line. Each line has a magnitude and a direction (from 1st node to 2nd node). What exactly I want to perform is "graduated width marker symbology ...
2
votes
1answer
250 views

How to smoothly join two rectangles

I am looking for the Math and steps involved not using a tool. We have PostGIS but its an old version so we are working with the data in Python. Given three coordinates: -107.37, 52.46 -103.24, ...
2
votes
2answers
612 views

How to open OSM file in Python with GDAL

I am trying to open a *.osm file in Python with GDAL. But I doesn't work. What am I doing wrong? import ogr driver = ogr.GetDriverByName('OSM') datasource = driver.Open('map.osm') layer = ...
2
votes
1answer
662 views

How to create a QGIS action which copies features between layers?

i tried (i never tried before...) to write a simple python code like action in QGIS on my "XXX" vector layer that: open a layer "YYY" copy the selected feature on my "XXX"layer paste the selected ...
2
votes
1answer
319 views

Python ArcGIS 10.1 Search Cursor

I have a file geodatabase with a polygon feature class named "AOI". The "AOI" feature class currently holds two records. I want to loop through each record and run a geoprocessing task, for example ...
2
votes
1answer
1k views

GDAL loads in Python, but not IPython (Linux)

I am trying my hardest to utilize the work of the good folks at the GeoDa center, but I cannot seem to get all of the components to load. GDAL, in particular, has been giving me some difficulty. The ...
2
votes
2answers
249 views

Change python + ogr2ogr.exe to python + ogr

I have written several complicated python scripts that end up using ogr2ogr to load or translate data. I have been converting these scripts to standalone exe files meaning the team do not require ...
2
votes
1answer
66 views

Multiple Selections from one shapefile

I have two shapfiles, Country and Blocks. I need to run a very basic selection to find out what blocks intersect the country shpe. But, the country shape has 250+ countries and I need to do this for ...
2
votes
1answer
392 views

reclassify vector data from multiple source data fields (ArcGIS) (ModelBuilder)

I am using ArcGIS 10.1 and ModelBuilder. I am not familiar with Python. My question is very similar to ReClassify Vector Data Between Values . However that question is about reclassification using ...
2
votes
1answer
483 views

Only perform Near analysis on selected rows

I am writing a Python script to perform a near analysis on features from two different shapefiles with common attributes. This is happening in a Search Cursor. However, whenever I tried to use the ...
2
votes
1answer
112 views

Is there a quicker way of checking if a feature exists with OGR

I'm writing lot's of features to a FileGDB using OGR. The slow point in my script is checking that the feature isn't already in the Feature Class, based on the ID. Currently I'm using a function ...
2
votes
2answers
615 views

Python Code: “Compare two fields and select missing records”

The code I wrote is not right!! It's selecting more than what is actually missing. I think I'm wrong on the matched code line. I need the script to make a list of the "FLAG" field and a list of the ...