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

learn more… | top users | synonyms

1
vote
1answer
2k views

ArcGIS 10.0 \ arcpy - CalculateField_management : help with syntax for updating text in attribute table of feature classes

I am trying to add (ie "Author", "LastUpdated") to feature classes within a gdb and then populate each of those fields. I have been able to get my code to run properly for the numerical field but I ...
1
vote
2answers
82 views

Automating attribute completion of new polygons

Good Afternoon I am currently outlining property boundaries and then copying and pasting in the necessary attributes on a daily basis. I would like to speed up this process and remove the chance of ...
1
vote
1answer
571 views

how to get the projection from a vectorlayer in qgis?

Hi I am trying to set the projection on a raster to match that of a vector point layer. Thus I need to findout what is the projection of a give layer, to use it in the GDAL.Dataset.SetProjection() so ...
1
vote
1answer
1k views

Setting a query loop

I am looking to apply a Select By Location protocol to my data, but need to first query individual IDs in my target and source layer (the same ID in each table, one at a time). How do I loop through a ...
1
vote
1answer
128 views

ArcServer Geoprocessing Service

I originally posted this in the ArcGIS forums, but I haven't been getting any bites. I've developed a set of ArcToolbox Python scripts, which I've been using on certain projects for clients. The ...
1
vote
2answers
808 views

How to batch convert Shapefiles to GMLs?

I know how to do this within Quantum GIS but I have 30+ shapefiles that need to be converted to GML. Is there a Python script sample or plugin for Quantum GIS that I can use to convert my shapefiles ...
1
vote
3answers
735 views

Update shapefile data source with wildcard using python

I am attempting to update a layer's data source in Arcmap using python for lyr in arcpy.mapping.ListLayers(mxd, "*", df): if lyr.name == "project_whl": ...
1
vote
2answers
386 views

FieldPyculator Plugin - How to Classify Fields?

Could someone tell me how to classify/populate fields with QGIS FieldPyculator Plugin? In the Attribute Table, I have a field named POPULACAO with population data: I want to apply a weight to ...
1
vote
1answer
224 views

ArcPy: Creating weekly-sum layers by summing field values from seven consecutive daily .dbf's

So I have 490 consecutive daily rainfall shapefiles/.dbf files in a single directory. Each consists of a uniform even-spaced grid of 220 points having uniform pointIDs, number of records, field names ...
1
vote
1answer
962 views

How To Add Values to an Attribute Field Based on a Selection - Python

Alright another problem that I have. I am trying to give a priority ranking to lots based on various criteria. Basically I have 7 areas that are criteria, if lots overlap each other the criteria is ...
1
vote
1answer
224 views

Small issue with field calculator

What am I doing wrong in this field calculator logic? Pre-logic def re_score(elev_t,f2, contour): f2=contour if elev_t.endswith('.5'): f2 = "Midi" return f2 Expression for field "Contourtyp" ...
1
vote
1answer
3k views

ArcGIS Iterate Files tool in Model Builder

I want to use a "simple" iterator to process all the text files in a directory using my model but model builder won't let me connect the file to the first step of the model. Once I run the Iterate ...
1
vote
2answers
696 views

Resources for python scripting [duplicate]

Possible Duplicate: QGIS tutorials and resources I would like to know regarding the available resources for starting to learn about python scripting for QGIS.
1
vote
1answer
389 views

Gdal tiling error for EPSG: 3857

i have lots of data which was coordinated with gdal some programatic way at below: gdal_translate -of GTiff -a_ullr %s %s %s %s -a_srs EPSG:3857 %s/%s %s/%s.tif then for tiling them all i am ...
1
vote
2answers
1k views

Python script has execution error first time through on a JoinField, but not the second time

I have some Python code that takes a shapefile, creates its centroids via FeatureToPoint, joins an auxillary field from the shapefile to the centroid via JoinField, and then goes on to do some more ...
1
vote
1answer
2k views

Using the arcpy.UpdateCursor to delete rows doesn't delete based on counter

I am trying to delete rows from a shapefile using arcpy.UpdateCursor. The first thing I did was get a unique list of values from the key field "PolyGUID", then I iterate that list doing a ...
1
vote
2answers
622 views

arcpy.sa.Viewshed with OFFSETA

This is using ArcGIS10 arcpy with spatial analyst. I need to call Viewshed, but with an observer height set. I have tried using a Z-aware point feature set, but that only throws an error. I am ...
1
vote
1answer
337 views

How to tranform a column field into a list using Field Calculator

I'm trying to make a simple field calculation with ArcGIS 9.3: New field = Old field - Old field(first value) which in Calculate Field with python code should be Expression: !Old field! - first ...
1
vote
2answers
733 views

What changes will be made to arcpy in ArcGIS 10.1? [closed]

I heard that two big changes to arcpy will be add-ins and new, faster cursors. Also, new features include "the ability to administer your enterprsie geodatabase (ArcSDE) using Python scripting" and ...
1
vote
3answers
748 views

CreateFeatureclass_management doesn't add a layer to the TOC of ArcMap10

I created a python script for a toolbox and I am wondering about the fact that CreateFeatureclass_management doesn't add the feature-class as layer in the actual dataframe. This does not happen in the ...
1
vote
2answers
919 views

Automate creating Rectified files from georeferenced images

A python 2.6.5 / ArcGIS 10 solution is preferred. UPDATE: I found a tool to do this "Create Ortho Corrected Raster Dataset" but the python script for it gives errors when I try. import arcpy import ...
1
vote
3answers
1k views

How do I add a shapefile in ArcGIS via python scripting?

I am trying to automate various tasks in ArcGIS Desktop (using ArcMap generally) with Python, and I keep needing a way to add a shape file to the current map. (And then do stuff to it, but that's ...
1
vote
1answer
688 views

How to Convert Code from VB to Python in Map Algebra?

I have a problem with Map Algebra in ArcMap 10 to convert some codes made by VB, so i need to convert it to python to work in arcmap 10 without problem. and can any one help me how do i deal with map ...
1
vote
1answer
447 views

How to create GRASS scripts in C# in Windows

Most of the tutorials that I have seen are under Python and Linux. Is it Possible to create GRASS scripts in C# or atleast in Windows. I can create scripts using a different language as a compromise ...
1
vote
1answer
39 views

Controlling Python Version from ArcGIS?

I am writing a VB.net console application that calls ArcGIS Desktop 10.1 ArcToolbox geoprocessing tools from my code. Some of these tools use Python syntax and I am encountering a problem that I ...
1
vote
2answers
75 views

How to merge dbf files(zonal statistics as a table) in GIS environment.?

I am not very savvy at using Python. Actually I have around 1000 output files from using the tool zonal statistics as table in ArcGIS. The names of the files are jan_60, feb_60......dec_13. These all ...
1
vote
1answer
28 views

How to create an Erdas batch list file (.bls) using Python?

How can I generate the Erdas batch list file (.blf) using Python? For example, I want to run a 5x5 median filter in the Batch Command Editor using a subset of images within a folder. Erdas provides ...
1
vote
1answer
41 views

How to get a Layer as ILayer (ArcObjects)

I had asked this question previously which I think will work. But as I am new to this, I can't figure out how to get a Layer as an ILayer object to pass to the method that's in my previous questions ...
1
vote
1answer
57 views

How to use Fields in the Field Calculator? [duplicate]

I'm using the Field Calculator in ArcMap and I need to create a unique ID for every storm drain in my county. An ID Should look something like this: 16-I-003 The first number is the municipal number ...
1
vote
2answers
44 views

Set parameter of field from number to string with python

since I realised python is a very useful tool in ArcMap I dont want to do any workarounds anymore. I have a field with is numeric, but I want to perform this calculation in the field calculator on it ...
1
vote
3answers
81 views

Merging many to one data rows in arcpy [duplicate]

The dataset 'left_right_merge' at the bottom of my screen shot shows the dataset that I'm currently working with. The NODE values indicate a single point feature, but is duplicated with many ...
1
vote
2answers
72 views

csv to shp python and formating a row

I´m doing a script to convert csv to shp, but I want to format one of the columns. It´s a string then I´d like to format like this a[8:10]+' / '+a[11:16]+' UTC' being a the value in the column. ...
1
vote
1answer
85 views

Creating a Simple Join Script in Python

I'm trying to create a simple join script in python from an arcgis model, where the only steps are joining a map to a table to produce a map with the table's properties. The attributes joined ...
1
vote
1answer
101 views

How to make a Python script that does a task in QGIS?

When I run this code in QGIS Python console it works fine, but I want want to run it from an external Python script. What I want the script to do is: 1- Open QGIS 2- Run this code 3- Close QGIS from ...
1
vote
2answers
74 views

Open source, Python option for Arcpy's Con tool?

I'm wondering if there is a method to perform a function similar to Arc's Con tool, using open source options in python. I have two rasters, one that shows locations of clouds and the other is just a ...
1
vote
1answer
52 views

Locating 0-points multipart polygons using arcpy

By Running this piece of code: import arcpy arcpy.env.workspace = "C:\working\GEODATABASES\\tests.gdb" fcList = arcpy.ListFeatureClasses() for fc in fcList: with arcpy.da.SearchCursor(fc, ...
1
vote
1answer
59 views

Iterating over selected features in QGIS Processing

I used to be able to iterate over selected features using the following script in v2.0. import processing features = processing.getfeatures(layer) for feature in features: #Do whatever you need ...
1
vote
1answer
39 views

How to count the number of entries a user has selected in a multivalue field of a tool dialogue using Python and ArcGIS 10.2.1

I am currently creating a script that will read data in one (to many) Excel spreadsheet(s) and would like to know how to get a count of the number of spreadsheets entered by the user. The script will ...
1
vote
1answer
65 views

Raster calculation in for loop returning exit code -1

I've put together a python script that does some calculations on rasters by converting them to NumPy arrays, doing the math, then converting them back to Raster and applying all the same spatial ...
1
vote
2answers
107 views

How to create a Shapely LineString from two Points

If have two points, from which I want to create a straight LineString object: from shapely.geometry import Point, LineString A = Point(0,0) B = Point(1,1) The Shapely manual for LineString states: ...
1
vote
1answer
86 views

syntax error when using gdal in python console QGIS

When I run the following code in the python console in QGIS I get a syntax error: import osgeo.gdal gdal_rasterize [-b 1] [-burn 255] [-a Pixelkost] [-te 170000.2 168000.27 177999.8 177999.8] ...
1
vote
1answer
219 views

How to open a shapefile using Python in QGIS?

I have tried to open my shape files with the help of a tutorial (http://spatialgalaxy.net/2012/01/27/qgis-running-scripts-in-the-python-console/) but unfortunately I couldn't open my shapefiles for my ...
1
vote
1answer
50 views

Updating a Tool Validator Class from a CSV File

I have a CSV file which contains a list of clients and different project numbers and project names. This list is generated periodically. The list can contain multiple values for client name but ...
1
vote
1answer
61 views

pyshp problem with naturalearthdata-shapefile

trying to follow this example: https://code.google.com/p/pyshp/wiki/ShapeRecords entering the following code: import shapefile r = shapefile.Reader("ne_110m_admin_0_countries") sr = r.shapeRecords() ...
1
vote
1answer
56 views

Shapely WKT precision/rounding

I'm using Shapely's wkt.dumps function to get WKT from geometry objects. I can't seem to find a way to limit the precision of the coordinates. Any help is appreciated.
1
vote
1answer
76 views

Parsing metadata text files with Python

I am trying to use python to parse the .pvl metadata file from some GeoEye imagery. I would like to write a script that locates the productCloudCover and countryCode tags found within the .pvl. Does ...
1
vote
1answer
69 views

How do you set up XY Event Layer Parameters on ArcGIS Script Tool? (asking for user input)

I've made the XY Event Layer work through python script, but can't get it to work correctly as a python script tool on arc, asking for user input. Does anyone have any suggestions? This is the script ...
1
vote
1answer
66 views

My class using ogr to calculate distance is returning incorrect results away from the equator

In an answer to this question ustroetz kindly provided some sample code for use of ogr to do lat/lon distance and point in polygon calculations. I've created a Python class based on his example to do ...
1
vote
1answer
111 views

How to add the attributes of selected features to my new layer in pyqgis

I am trying to create a layer from the selected points coordinates. I am drawing a circle to the coordinate of selected points. I also need to add initial attributes of my selected features to my new ...
1
vote
1answer
97 views

Finding closest Intersection between line strings (PostGIS)

I want to find the distance between one point (excavation sites) and a line (rivers) for the cardinal directions. What I thought would be the easiest way is to draw lines between the excavation site ...