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

learn more… | top users | synonyms

3
votes
1answer
12 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
21 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 ...
0
votes
0answers
17 views

Python - ASCII Codec - Synthax Question in Field Calculator

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
7 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
55 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
13 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
29 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
36 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 ...
2
votes
1answer
12 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
11 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
46 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
2answers
38 views

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

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
29 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
27 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
67 views

Automated search of misplaced points with Python or Model Builder

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
65 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
0answers
26 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? [on hold]

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
29 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
222 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
75 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
30 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
47 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
35 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
47 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
27 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
36 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
0answers
12 views

Time Epoch split day wise in Python [closed]

I have file with a series of UNIX format Time Epoch and i have to split it into multiple files day wise. Any suggestion in this direction is appreciated.
2
votes
1answer
50 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
52 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
67 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 = ...
1
vote
1answer
43 views

Pyproj: converting WGS84 to Robinson

I have a WGS84 coordinate pair (37.7749295, -122.4194155). I have an image that is a Robinson Map Projection of the world. I'm trying to write a python script to locate my WGS84 coordinate on my ...
1
vote
1answer
20 views

Convert WKT (or geojson) geometry to numpy array of coordinates

I am looking for the fastest way to convert WKT or geojson geometry from string to numpy array of coordinates. Is it possible to do it strictly in Python and without creating geometry object such ...
2
votes
0answers
38 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 ...
3
votes
1answer
36 views

QGIS Processing Progress

I have been developing a python plugin that uses Processing algorithm for raster calculations. I want to support the gui with progress bar. How can i connect Processing job to progress bar? I found ...
2
votes
1answer
25 views

Get min-max values of a raster and populate two parameters with the values in tool validation script

I am customizing the script tool behaviour of a custom script and would like to get the min-max values from a raster self.params[0] and populate the next two parameters, self.params[1] and ...
2
votes
1answer
33 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
2answers
36 views

Merge classes using Reclassify in python

When I run the Reclassify tool from arcmap 10.1 and assign a 1 to each of the crop types it combines them into one class. However, when I try to recreate this in python it does not merge the crop ...
1
vote
1answer
34 views

Unable to use kartograph.py

This is probably a very simple fix. I was able to download and install the Kartograph.py library. When I call it from the command line I am getting: kartograph is not an external command Usually ...
3
votes
2answers
47 views

Using ModelBuilder, how to define directory while using a Python script?

I have a model (shown below) in which at the very end of it I run a Python script ('SumFieldInsertNew'). One issue I'm having is that I'm creating this model for an end-user that will have little to ...
1
vote
1answer
41 views

Programmatically export a Qgis project

I have a QGis project that I programmatically modify using the Python xml.etree library. Now, I would like to know if it is possible to add few lines to my script in order to export the modified ...
1
vote
1answer
31 views

trouble with code block execution in python script

I am trying to calculate values for a field in a python script, but keep getting an error that I don't understand: ExecuteError: ERROR 000539: Error running expression: Fron000000F1 Traceback (most ...
1
vote
1answer
87 views

Installing pandas with Esri's python?

Trying to get pandas to import, but I'm getting what looks like an error caused by a failed dependency of the version of my Esri-provided numpy's compile, based on this stackoverflow posting. Here's ...
4
votes
1answer
97 views

Can ArcGIS ModelBuilder be exported to Python and run in QGIS?

Is it possible to construct a geoalgorithm on the ArcMap modelbuilder, export this entire algorithm to python syntax (without having ANY knowledge of python) and then import this algorithm to QGIS and ...
3
votes
1answer
144 views

How to use outdated arcscripts

I need to use the Vector ruggedness measure (VRM) tool available from http://arcscripts.esri.com/details.asp?dbid=15423. However, I am using the latest version of Arcgis and these tools are made for ...