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

learn more… | top users | synonyms

-1
votes
1answer
40 views

Python field calculator

I have a point shapefile with the following columns mosaic hypo result condition 2000 1700 1500 1000 980 . . AND i want to write a script that will do the following: ...
2
votes
2answers
178 views

UpdateCursor on two tables with value from SearchCursor

I try to keep myself busy and learn some python. I have two tables test2.shp (for searchcursor) test.shp (needs to be updated) I want to update test.shp with a UpdateCursor. The column which ...
0
votes
0answers
14 views

Importing tif image from PostgreSQL Database to webpage [on hold]

I am trying to import tif images from PostgreSQL Database to my website. In the website, I need to make a button control which will open the images. I think I have to use Pyhton as a server side ...
1
vote
1answer
12 views

why there is no attribute like 'GetNAClassNames' in my arcpy

I want to do a network analysis, when I want to load a layer as a barrier using arcpy.na.GetNAClassNames, the message is like this: AttributeError: 'module' object has no attribute 'GetNAClassNames' ...
0
votes
1answer
32 views

Can't get the correct version of GDAL installed to use ReadAsArray without getting error in Python

Using the instructions here . . . https://pythongisandstuff.wordpress.com/2011/07/07/installing-gdal-and-ogr-for-python-on-windows/ I downloaded the following files: GDAL-1.11.1.win-amd64-py2.7.msi ...
0
votes
1answer
9 views

ERROR 000157: Input and target dataset should have the same number of bands. Failed to execute (MosaicToNewRaster)

This is just a continuation of my former post:Batch Mosaic Rasters: arcpy.MosaicToNewRaster_management (ERROR 000628: Cannot set input into parameter coordinate_system_for_the_raster) --where I batch ...
0
votes
0answers
11 views

Identifying Left and Right Mouse Button Clicks in PyQgis application

I am relatively new to PyQt. I am trying create a custom plugin for Qgis which enables the user to select some features by drawing polygon on the canvas using mouse clicks and then performs ...
0
votes
0answers
17 views

Can I mimic the “open” action with python and manipulate the field content used for the action?

I am using QGIS actions (type: "open") to link ECM searches to objects on the map. The basic syntax is very simple: protocol://searchterm1=[%"field1"%]&searchterm2=[%"field2"%] However, some ...
0
votes
1answer
16 views

Batch Mosaic Rasters: arcpy.MosaicToNewRaster_management (ERROR 000628: Cannot set input into parameter coordinate_system_for_the_raster)

I am trying to batch mosaic rasters using arcpy.MosaicToNewRaster_management in arcpy: #This is for mosaicking a lot of rasters import arcpy from arcpy import env ...
0
votes
0answers
17 views

Quick way to select by attribute and zoom to selection in QGIS

I need to visually control hundreds of points in a layer on top of aerial photographs. Using the attribute table, selecting (with column filter expression) and zooming manually is cumbersome - so I ...
1
vote
1answer
166 views

How to do supervised image classification in saga with the help of R script or Python script

I am using Ubuntu 12.04 and want to do image classification in SAGA. SAGA has numerous classification algorithms which is not present in GRASS and QGIS. I am new to SAGA, but more accustomed to work ...
3
votes
1answer
693 views

How to access all mxd files in a folder?

I'm a beginner to Python and am trying to figure out how I can access several mxds in a folder. For example, when I want to use the AnalyzeforMSD function in ArcGIS: import arcpy mxd = ...
0
votes
1answer
55 views

OSGeo4W and GDAL - gdal2tiles.py error

Wondering why gdal2tiles is throwing errors, I've added the gdaldata and gdalplugins environmental variables and my python is at Python27/ArcGIS10.3/, and am wondering if that is messing with the ...
3
votes
0answers
50 views

Field Calculator convert text to integer then populate new field with sum [on hold]

I have a .dbf with about 50 text fields containing numerals, I would like to convert those to integers and then sum them all in a new double field I created, is there an easy field calculation that ...
2
votes
1answer
55 views

ArcMap 10.3 - Anything Python related causes crash to desktop

Problem: ArcMap crashes to desktop anytime I use a Python related function (Toolboxes, Field Calulator, Etc) How I got to this point: I was trying to gain some familiarity with Python programming ...
1
vote
1answer
24 views

Auto-update a feature class with Python + .csv?

I am hoping to find out how to automatically update a feature class. We have semi-regular updates to an ArcGIS Viewer for Flex website. Looks like a Python script may be the way to go about it (and I ...
2
votes
2answers
198 views

Why is arcpy.StackProfile_3d -> arcpy.SaveGraph_management creating empty graph?

In a python script I'm trying to save a graph to a .png file with graph output from arcpy.StackProfile_3d but the .png file shows an empty graph. The table created from arcpy.StackProfile_3d shows ...
4
votes
2answers
99 views

Advanced python labeling in ArcMap - working with null values

I'm trying to label certain features using a specific field (osm_name_58_en). However, when this field is null, I want to label the feature with (som_english_32_name). If both are null then I want ...
0
votes
0answers
31 views

Script in PyQGIS to create a shapefile

I'm having some trouble applying my Python skills to develop some scripts in PyQGIS. For me it's far simpler to write it in ArcPy, but then again I wouldn't get that much satisfaction after finishing ...
2
votes
4answers
164 views

Removing first and third zeros of a fieldname in label expression

The fieldname only has three characters. I dont want to display zeros in the first and third values. example below. 010 = 1 100 = 10 01Y = 1Y 10Y = 10Y I have figured out how to strip out zeros ...
6
votes
2answers
504 views

Histogram Matching Python

I am trying to do histogram matching using Python to improve the mosaicking process of multiple overlapping rasters. I am basing my code on that found at: ...
0
votes
1answer
26 views

QGIS Python Scripting permission denied

I've just started a Python Scripting tutorial on QGIS. The problem arrives right at the end, when I have to use this script: output_file = open('c:/Users/Ujaval/Desktop/airports.txt', 'w') for f in ...
3
votes
1answer
186 views

Dynamic title in ArcMap

How can I have a dynamic title of the map, which changes depending on the layer chosen? Is this doable? It would save a lot of time and iterations since I should be producing several maps. To ...
1
vote
1answer
659 views

Linux Client for OpenGTS server

I've installed an OpenGTS server and successfully linked it with the GPS2OpenGTS_Pro application for android. The buses I'm tracking offer 3G with a wireless AP, however whenever the bus stops, the ...
3
votes
1answer
669 views

Getting unicode encode error in ArcPy/Python script?

When I am running a script (it checks to which database a mxd is connected) I get the following error: return codecs.charmap_encode(input,errors,encoding_table) UnicodeEncodeError: 'charmap' codec ...
2
votes
2answers
65 views

Cutting a polygon out of another polygon with python [duplicate]

Licence: ArcEditor Version: ArcMap 10.0 i have some issues to separat my data with python. To illustrate the problem, i have simplifyed the data with figures. I want to cut the blue polygon ...
1
vote
0answers
25 views

GDAL equivalent to ArcGIS Union?

I have a single shapefile full of overlapping polygons. The ArcGIS Union tool will generate individual, non-overlapping polygons with that geometry. Is there a way to do this with GDAL/OGR or another ...
1
vote
1answer
65 views

QGIS processing script: Move points by specified distance and add segment

I try to move points (they come as WGS84, but I'm not sure if it works with unprojected CRS) by a specified distance and connect original and new point with a line segment with the below script, but ...
1
vote
0answers
11 views

Cloud and cloud shadow identification with MERIS

I am looking at MERIS images to use for marine applications (Chl-a. SPM) and would like to confidently remove cloud and cloud shadow pixels from the data. I have a few ideas: Using the blue band ...
0
votes
0answers
13 views

Create a list of affected tiles from polygon / Gridding a polygon

Given a projection, a zoom level, a grid definition and a coverage polygon - what is the easiest/fastest way to obtain a list of map tile indexes touched by the polygon? Are there any existing tools, ...
1
vote
1answer
123 views

Esri Python Toolbox(pyt) corruption in ArcToolbox.dat

Symptoms: Open ArcCatalog and all tools within Python Toolbox(pyt) have a red-x error next to them claiming that "Arcpy module has no attribute Parameter" Close ArcCatalog Delete ArcToolbox.dat file ...
3
votes
2answers
102 views

Python labeling expression using numeric field not working

I'm trying to label parcels from a shapefile in the Python expression below in ArcGIS 10.2. All parcels should be labeled with the last 8 characters of their [PARCEL_NUM], and parcels 10 acres or ...
0
votes
1answer
41 views

Problem with scripts and tools in ArcGIS 10.X

I'm trying to figure out what is going on with my ArcGIS and how to fix it. What has happened: everything was ok, I had 10.3 prerelease installed and I was warking with it. I was writting my srcipt ...
0
votes
1answer
32 views

gdal_array.SaveArray() leaves dataset open in Python

When I use gdal_array.SaveArray() to create a raster, the newly created dataset appears to stay open in Python, preventing other processes from working with it. For instance, consider the following ...
1
vote
1answer
19 views

Multiply two lists of raster from two subfolder

I have two subfolders, which contains rasters for each country but which express different variables. I am trying to figure out a way to Loop a multiplication of each raster into a folder with its ...
0
votes
2answers
61 views

Create a script to add delimited text layer in QGIS

I'm trying to use QgsVectorLayer() function to add delimited text layer in QGIS. So I have a txt file (T_1999_1_2.txt) in path: "D:\PATRICIA\DOCUMENTOS\ESTACOES METEOROLOGICAS\DADOS METEOROLOGICOS\T" ...
2
votes
1answer
33 views

Qgis docking plugin - python

I need to create a dock plugin for QGIS using QT designer and Python. I've created a basic plugin in "plugin builder". Then I've changed the .ui so now I dont have standard QDialog box but a ...
6
votes
1answer
111 views

PostGIS polygon edge analysis (orientation, edge length)

I am rather new to the world of GIS and especially PostGIS, so please excuse me if the answer seems evident... I would like to do analysis on a number of buildings. One thing I am interested in is ...
0
votes
1answer
217 views

Cause of ArcGIS Raster Calculator Parsing error <type 'exceptions.SyntaxError'>: invalid syntax?

This is my first attempt at much code in the raster calculator of ArcMap 10.0, but I think I'm close. I have nine rasters (A-I below) and want a new raster with value = 1 where any of the rasters ...
0
votes
1answer
13 views

vector clip based on chronological value

I would like to know if there is any algorithm in python that can clip vector features according to the "date" value? To be more specific the newest date is the dominant value and clipping will start ...
0
votes
1answer
32 views

Convert DOY to mm-dd format [on hold]

I have a problem with my date format. how can I convert day of year values to mm-dd format? For instance if my doy have a value of 161 this will be converted to 06-10 (June 10 for instance). And this ...
0
votes
0answers
13 views

Set polygon boarders to transparent in python

I am creating automated maps in ArcGIS with a similair Python Code which can be found here: Map automation to iterate through attribute table using ArcPy? I cannot find out on how to set the ...
2
votes
1answer
137 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 ...
1
vote
1answer
70 views

Map automation to iterate through attribute table using ArcPy?

I have a python code which iterates through all attribute fields and creates a map for each field automatically. However, in the code I have to specify each attribute manually which was fine so far. ...
3
votes
2answers
83 views

Field Calculator Script

I am looking to check how up-to-date a feature class is by using our latest parcel update. I am wanting to check "owner" field with "Owner_1"...I am using field calculator to grab the last name in ...
1
vote
2answers
136 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 ...
0
votes
0answers
25 views

Converting lat,lon & solar data in CSV to raster using Python?

I have a csv file with lat,lon and solar radiation data. I am trying to convert it to a grid/raster format so that it can be used with a raster population data set that is in ascii format. How can ...
1
vote
0answers
55 views

Connect to PostGIS database from Q GIS

I am having trouble connecting to a postgresql database hosed on my local host. I have gotten a python script to connect and connected through the command line, but for the life of me cant connect to ...
0
votes
2answers
32 views

How do I change the color and trasnparency of a layer using arcpy?

I would like to create an arcpy script to change the color and transparency of a collection of layers. The color and transparency would be based on wildcards such as "_dog" or "_chicken". The layer ...
0
votes
0answers
24 views

Convert YYYYMMDD to YYYYJD in Python 2.7.5 [on hold]

I'm trying to write a python script to convert a folder of .asc files (365 files for every year in different folders organized by year) that have the yearmonthdate in their filename to have the ...