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

learn more… | top users | synonyms

1
vote
0answers
21 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
17 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
69 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
27 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
22 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
27 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
38 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
0answers
13 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
44 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
39 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
133 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
30 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
28 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
133 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
18 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
65 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
36 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
37 views

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

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
19 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
69 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
23 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
37 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
38 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
15 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
54 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
68 views

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

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
31 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
33 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
70 views

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

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 ...
4
votes
1answer
69 views

How do you set the position of a plugin window when you start the plugin?

I'd like to set the position of a plugin's window or dialog relative to the map canvas frame. For example, if I start a plugin, I want it to appear somewhere in the left upper corner of the map ...
0
votes
1answer
38 views

How to add new columns with attributes in existing Qgis layer?

How to add new columns with attributes in existing Qgis layer? Doing the "same thing" here described
0
votes
1answer
37 views

What is a simple python code to practice with in arcgis? [closed]

I am trying to familiarize myself with python code. Could someone give me a simple code with an explanation of what it does so I can practice? Or a few codes with explanations if you have the time
1
vote
2answers
45 views

Creating shapefile from selection - remove from map

I am iterating over a shapefile and creating a new shape from each row. I will be creating several thousand individual shapes and do not want to inundate my TOC with that many layers (I bet ArcMap ...
4
votes
1answer
34 views

Can QGIS map canvas update while python script is running?

I want to automate a periodic refresh of the QGIS map canvas with updated shapefiles. A Python plugin or console script does not allow the map to update until the script terminates. Is there a way to ...
5
votes
2answers
224 views

Is there a way to calculate closest distances to a point without using Near Analysis?

I frequently get asked to calculate distances from a specific point (A drilling well in the middle of the sea for example) to a number of Environmental layers (Protected Areas, Pipelines, Other wells ...
2
votes
1answer
58 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 ...
4
votes
1answer
46 views

How to extract certain values from a table using the SearchCursor Tool

I am trying to write a python script to extract certain values from a table: the table I am referring to is a big collection of nitrate values for different water depths, which are deposited in the ...
2
votes
1answer
24 views

Open a .osm.pbf file with fiona in python

I would like to open a .osm.pbf using fiona in Python. I can't find much documentation on this. How can I does one do this? I have done it using ogr2ogr.
1
vote
2answers
77 views

Concatenating fields with label expressions using Python

I am trying to combine three numeric fields together for a feature's label. I only want to label the feature if it is over 0. The labeled numbers need to be separated a dash ("-"). This is what I ...
3
votes
0answers
34 views

ArcPy: Initialize zero valued grid Raster and iteratively increment

I'm jumping right into ArcPy to help out a friend who needs to automate some ArcGIS work. The problem at hand can be reduced to the following pseudocode: accumulationRaster = SomeZeroedRaster for ...
2
votes
1answer
31 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 ...
1
vote
2answers
51 views

Arithmetic on rasters with variable names in Map Algebra/Spatial Analyst?

I'm a Python (and StackExchange) novice trying to figure out how to perform calculations on temporary rasters with variable names. My attempt at a minimum working example is below, but I would ...
-1
votes
1answer
36 views

Displaying Shapefiles using Python? [closed]

I have some shapefiles, which I want to display in Python. Is there any code for that?
3
votes
2answers
53 views

GDAL (Python) Aggregate Raster Into Lower Resolution

I have a (continent-scale) raster with 30m resolution in an Albers equal area projection. Each 30m cell has a value 1-34. I would like to aggregate information from this raster into a 1km grid such ...
2
votes
1answer
30 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 ...
4
votes
0answers
37 views

Rules of Nodata value?

What are the arithmetic rules that govern Nodata values? Regardless of how these null values are defined? I am using ArcMap Raster Calculator. I am thinking specifically of operations like 1*Nodata ...
2
votes
1answer
52 views

arcpy.AsShape function returning RecordSet not Geometry

I have the following code: feature_geometry = arcpy.AsShape(json_string, esri_json=True) print feature_geometry print type(feature_geometry) >>><geoprocessing record set object object at ...
4
votes
3answers
58 views

Install gdal in CentOS without Root

I have been struggling to get python setup to do some image processing, so I really need the http://www.gdal.org/ GDAL libraries installed on CentOS 6.5. I want to install the package in a local ...
2
votes
1answer
69 views

Naming directories in python?

Why is it that when I label my directories this way: arcpy.env.overwriteOutput = True arcpy.env.workspace = "C:\\Users\\Documents\\ArcGIS\\Testing" arcpy.env.scratchWorkspace = ...