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

learn more… | top users | synonyms

0
votes
0answers
7 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 a easiest way to implement this in python using arcpy module. Or if there exists some freely ...
1
vote
0answers
17 views

Arcpy loops/cursors - faster without background processing?

I am running loops via cursors and raw Python in Arcpy. Within the loop several processes take place, selecting shapefiles and converting to raster, clipping, running euclidean distances, extracting ...
3
votes
1answer
47 views

Pause ArcPy script until feature class lock goes away

My script needs to copy data into a feature class to an SDE geodatabase that might have a lock on it from another application. I shouldn't break the lock (that app has priority over a data update), ...
1
vote
0answers
9 views

Batch Conditional Test - For Loop with a Group of Rasters

How do I ask a “for loop” to operate on groups of three files folder (e.x. files A, B, C), then files B, C, D, and then files C, D, E, and so on? I have a folder full of rasters (.tif): RasterA.tif, ...
0
votes
0answers
8 views

Upload KML/KMZ and view in ArcGIS client application via ArcGIS Server

I am trying to write a tool that will let users upload a KML/KMZ file and then be able to view it in a client application (something like an esri js api or Flex app). I am ok with storing the data in ...
1
vote
0answers
14 views

Mapping from one plane on the other plane despite of masking regions

have a set of data given here, where in the first and second columns there are the sky coordinates (ra,dec) e.g. right ascension and declination, respectively and in the third and forth, the ...
0
votes
1answer
46 views

Cannot load postgis layer from sql string in pyqgis

I'm trying to load a layer using the following code in qgis python console: sql = "(select the_geom, ID from mytable)" uri = QgsDataSourceURI() ...
1
vote
1answer
33 views

What's the reason for this Invalid Layer “Cannot open GDAL dataset …” error

When adding a rasterfile with QGIS python console there appears an error when the first letter of a rasterfile to be added is not written in capital letters. Why this behaviour? Example case1: ...
0
votes
1answer
15 views

D8 algorithm to get the flow direction in ArcGIS

I am using ArcGIS 10 for the get the flow direction from DEM. I wonder about the algorithm they have used while calculating flow direction. It is mentioned there that it is using D8 model. D8 model ...
3
votes
2answers
55 views

Converting huge multipolygon to polygons

I have a shapefile with some huge multipolygons, with 100.000's of parts. What would be the easiest way to split them to singlepart polygons? I'm looking for something like QGIS ”Multipart to ...
1
vote
0answers
40 views

Creating symbology by category in python?

I'm trying to create a python script that creates color-coded symbology by county for multiple maps with different data. I've never created a layer file for the purposes of symbology before, but I ...
1
vote
2answers
26 views

Rename LAS Files - Python

I have a bunch of LAS files that have been delivered with different naming conventions. I want to rename the files to all have the same uniform naming - based on the easting and northing coordinates ...
3
votes
1answer
24 views

How to find the distance between start of line and start of raster with arcpy/python?

I'am creating a python script tool for ArcGIS Desktop 10.1 to extract profiles. I’m using stack profile to extract values to a table but stack profile only outputs values where the line and raster ...
0
votes
1answer
23 views

QGIS Python console - save image from bounding box

I want to save an image from QGIS but the save image functionality feels limited. My question is if it's possible to use the python command line to save an image at a specific zoomed in scale and to ...
1
vote
1answer
23 views

pyQGIS - Data Source is Invalid

Why I am getting Data Source is Invalid in python console of QGIS when running: vlayer = QgsVectorLayer("home/sanjayr/Desktop/india-latest.shp/buildings.shp","sanjay","ogr") I am using QGIS 2.4 on ...
2
votes
1answer
35 views

Unicode Decode Error for shapefile in Python

I have Python script for converting shapefiles to Geojson. My code works well if I use some usa data, but when I want to use some other encoding, it gives me this error: Traceback (most recent ...
0
votes
0answers
39 views

Proxy.cgi for OpenLayers reading from GeoRSS but not from WFS

I'm having trouble with the standard proxy.cgi written in Python for OpenLayers. Here's my code: #!C:/Python27/python.exe -u """This is a blind proxy that we use to get around browser restrictions ...
9
votes
5answers
277 views

Raster diff: how to check if images have identical values?

Is there a means to check to see if any 2 given raster layers have identical content? We have a problem on our corporate shared storage volume: it's now so big that it takes over 3 days to conduct a ...
2
votes
3answers
38 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
0answers
46 views

Where is my Polygon?

I created this script to merge all of the polygons in a shapefile into a single polygon. I am using Python 2.7.5, Shapely 1.3.0, and Fiona 1.1.5. def merge(path_in, path_out): #Import Libraries ...
1
vote
0answers
28 views

Clipping between features within a single vector?

Is it possible (via the Qgis API and friends), to clip polygonal features within a single vector layer? The hope is to accomplish this without having to duplicate the feature into a new layer. ...
2
votes
0answers
32 views

Performing buffering and intersection with script in PyQGIS

I wrote a script that performs the intersection of two layers: The first Layer -> layer1, represents the rivers The second Layer -> layer2, represents a set of circular dots distributed in a ...
2
votes
2answers
84 views

How we can get output for os.system() in python?

I wrote the following command in Geoserver rest-api using curl: cmd=curl -v -u admin:geoserver -XGET -H "Accept: text/xml" ...
1
vote
1answer
34 views

Overwrite option on a standalone ZonalStatisticsAsTable using ArcPy

How can I code an "overwrite option" on a standalone ZonalStatisticsAsTable using ArcPy? I don't see any overwrite option from a Esri example. # Execute ZonalStatisticsAsTable outZSaT = ...
2
votes
0answers
29 views

Any solution to mosaic Modis MOD13Q1 using batch file?

I have a Modis MOD13Q1 product for Pakistan, four tiles cover my complete area and I have data consisting of 14 years, after every 16-day interval. I want to mosaic them using a batch file which ...
1
vote
0answers
36 views

FWTools Python ImportError: DLL load failed:parameter is incorrect [duplicate]

Please, can anyone help me solve this issue? Please find the attached snapshot for your reference. I am working on a Windows 7 Professional, Service Pack 1, 32-bit laptop.
1
vote
2answers
42 views

How to skip over errors created by cursors running through empty tables?

I am trying to automate the creation of many different feature layers were their content is created by a cursor. Sometimes during the automation, a feature layer may be empty, this is okay, but as the ...
0
votes
2answers
26 views

Aggregating rasters with GDAL

I have a set of files that have been mosaiced into a global VRT in a particular projection and resolution. However, I have a need to report statistics on a (say) one degree grid, where the reported ...
2
votes
1answer
52 views

How do I rename rasters in an mxd by using my csv?

I have the following data in a csv: RasterName First name Raster 1 Aaron Raster 1 Paul Raster 2 Bryan Raster 3 Cranston Raster 3 Vince I have added these ...
1
vote
1answer
52 views

UnicodeDecodeError: While installing gdal in a new Python Virtual Environment

I was trying to create a Python Virtual Environment for some initial GIS development. I installed pip and virtualenv and then tried the following commands from the Linux-Terminal to accomplish the ...
2
votes
3answers
143 views

Clipping faster (i.e. in bulk/batch) in ArcGIS for Desktop?

I have 100 different input vector layers and one clip feature vector layer. I have to clip them 100 times but its a large amount of work. Is there any Python script (ArcPy) in ArcGIS for Desktop ...
2
votes
1answer
37 views

QGIS way to import OSM/Google Maps but remove or exclude extraneous areas, limit geographically the use of OSM

GIS Newbie question, perhaps: But I am looking to place an Open Street Maps/Google Maps layer underneath the rest of my shapefiles for referencing purposes. Let's say for instance, that I am looking ...
1
vote
1answer
31 views

Copy Parallel editor tool - python script / modelbuilder [duplicate]

Is it possible to use Copy Parallel tool in a python script or in modelbuilder for ArcGIS 10.2? Does anyone have a workaround or script for a tool that essential does the same thing as Copy Parallel. ...
2
votes
1answer
134 views

Python Syntax Error when running Python Snippet of successful geoprocess

I am having an issue with a simple python snippet. Here's the background: I wanted to include an additional step in a nightly update script that replaces characters in a field that simply do not play ...
0
votes
0answers
22 views

Importing OGR from OSGEO Issues

I am trying to run: from osgeo import ogr and I get: Traceback (most recent call last): File "", line 1, in from osgeo import ogr File ...
4
votes
2answers
66 views

How to access raster NoData value?

I am trying to programmatically access the NoData value in a raster dataset as shown in the screenshot. Two tools that come to mind to describe raster properties do not seem to be able to describe ...
0
votes
1answer
41 views

Field Calculator If/Then in ArcGis 10.1

I've been looking through these threads, i found something similar and thought it could be the answer, but it doen't seem to work for me... I could do this the slow way with Select By Attributes, but ...
1
vote
0answers
40 views

Cause of Field Calculator UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6' in position 5: ordinal not in range(128)? [closed]

def Befahrung(value1,value2): if value1 is ' ': return ' ' else: return "G:\\Example\\" + str(value1) + "\\File_" + str(value2) + ".pdf" I try to create a field with a hyperlink. It works ...
1
vote
0answers
21 views

lat/lon of intersection between line of sight from a given lat/lon and altitude above ground

Given a starting latitude, longitude and altitude, and a line of sight defined by azimuth and elevation, I want to find the latitude and longitude (assuming spherical Earth, WGS84 or other) where the ...
1
vote
1answer
78 views

Why is feature.geometry() None in my user-defined expression function?

I'm trying the user-defined expression functions for QGIS, as listed on Nathans blog: http://nathanw.net/2012/11/10/user-defined-expression-functions-for-qgis/ I always get the feature.geometry() as ...
0
votes
0answers
24 views

gdal_grid performance issue — alternatives?

I use gdal_grid within a Python script, but for my large files the calculation time is enormous. Apparently this is a gdal_grid issue http://trac.osgeo.org/gdal/ticket/2411 Does anyone have an advice ...
1
vote
0answers
39 views

Scaling features based on an attribute

I would like to scale polygon features by a specific factor I have calculated for each feature in a feature class. I know of the Scale tool, however it only allows for manual entry of a scale factor ...
2
votes
2answers
39 views

Performing a Python scripted tool based on whether a field is populated or not

My question is if I'm running the ArcMap Dissolve tool through a Python script, how can I tell it to check for attributes in one field, and if that field is empty, to perform the tool on another ...
1
vote
1answer
20 views

Python version of MAP_2POINTS

I think I may have stumbled onto an IDL function which does not have a python equivalent... :'( I am working with a Whiskbroom imaging radiometer (Terra/Aqua MODIS), with a corresponding bounding box ...
0
votes
0answers
21 views

QGIS plugins - how to use a custom behaviour on right click and actionPan on left click?

I have been struggling with this problem for quite a long time. Here we go : I implemented a maptool that draws a red cross on the point that is being right-clicked on. There are good how-tos, such ...
1
vote
1answer
61 views

How to merge Shapefiles from multiple folders into Geodatabase Featureclass?

I have a question regarding the merge of a lot of folders, which has a lot subfolders, which has the shapefiles stored. I would like to merge all those in one geodatabase. So I thought to use a ...
1
vote
3answers
73 views

How to generate automatically the name of output parameters in a python script tool? [closed]

I have some Python script tools in ArcGIS for Desktop. I need to reproduce what all geoprocessing tools do when the first input parameter is introduced: autogenerate a workspace and basename for the ...
1
vote
0answers
32 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
37 views

Map algebra from files in multiple directories

I'm a rookie in python programming. I want to do map algebra for multiple rasters but these rasters are in different folders. Here's the code ive created so far: #Importing modules import arcpy from ...
2
votes
2answers
72 views

Automated search of misplaced points with Python or Model Builder [closed]

I am using ArcGIS 10.2.2. My work is to find points which are misplaced. I want to know if there's a way to automate this using Python or Model Builder? I wish to place this in the attribute table ...