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

learn more… | top users | synonyms

2
votes
1answer
2k views

How do I select by location based on selected features with Python?

Is there a way with Python to do Select by Location with the Use selected feature option? I'm trying to automate a process and am running into barriers. I need to be able to select the 2 lines ...
3
votes
1answer
767 views

Python: Change SDE data source for mxds in specific folder

I've searched all the forums and help and have made progess but recently got an error that has thrown me for a loop - also some mxds are not being changed at all! What I'd like my code to do: Iterate ...
2
votes
1answer
181 views

Need a Python field calculation that works like the DatePart( ) VB Function

I have a field called Abandoned Year (short integer data type) that I am trying to populate with a four digit year from a column called Decommission Date (Date data type). I have done this in the ...
0
votes
1answer
293 views

AttributeError when I execute a python script

When I execute a python script to assign my database in postgres, I get this Error !! "AttributeError 'psycopg2._psycopg.cursor' object attribute 'execute' is read-only " def ma_fonction(d): # ...
0
votes
1answer
84 views

Anyone recognize this (reference-system related?) pattern of distortion?

I'm new to GIS and was making some progress until getting rather stumped on this one. I've imported what I believe to be lat/lon data based on US FIPS county codes in weather alerts (NOAA SPC). When ...
0
votes
1answer
79 views

Need to teach myself Python, looking for some suggestions [duplicate]

I am a bit behind the curve here but I am going to teach myself Python, for better or worse, and am looking for any suggestions inre: books, blogs, websites etc. I have little to no experience in ...
2
votes
1answer
267 views

ImportError: No module named qgis.core

I am on Ubuntu 13.04. I get the following error message - Traceback (most recent call last): File "analyse.py", line 1, in <module> from log import shelve File ...
2
votes
1answer
327 views

How to perform a cascaded combine from python script in QGIS?

I'm working with a large dataset, and I need to be able to combine up to 400,000 polygons. I have been using the QgsGeometry::combine(QgsGeometry* geometry) function and simply looping over all ...
3
votes
1answer
183 views

How to create a line layer which connects a point layer to a line layer?

In the map shown below, I have manually created the dummy lines (in green). Using python, and without using PostGIS or sextante, I would like to automate the creation of these dummy links between a ...
4
votes
1answer
180 views

Pick random points in an earth circle

All I need is the ability to create random points within a radius of another point. so given self.fence.latitude and self.fence.longitude and self.fence.radius I should be able to generate random ...
2
votes
1answer
63 views

how to differentiate between common parts of the triangle and extract linestring from it

Can you help me break down shape A to different linestrings: lines 2 & 3 AND line 1? The shape contains three different polygons (A, B, C). I wish to determine the start/end point of each part ...
2
votes
0answers
88 views

Rounding error in qgis point sampling tool

I'm not sure if this is a bug or of it is due to the implementation. I am using a raster that has values greater than 1,000,000 and Qgis displays these numbers in a scientific notation. For instance, ...
0
votes
1answer
1k views

While looping with arcpy: ERROR 010240: Could not save raster dataset

Hi I am very new to python coding and have been struggling with this for a while I cannot see the reason for this error! Any help will be greatly appreciated. Here is the code that is causing this ...
0
votes
1answer
597 views

How to append a vector layer using Qgis and Python?

I am working on scripting some data processing using Qgis and Python, but I'm running across issues that I need to debug. Since my data is really large, and run-times can be lengthy, I would like to ...
3
votes
2answers
1k views

use a selection of features in ArcMap in Python script

I am trying to write a python script and am stuck on the first obstacle. I want the user to select features in ArcMap and then use these selected features in a python script. Is that at all possible ...
1
vote
1answer
259 views

Looking for PyQGIS Syntax Examples/Guide

I am a long-time user of arcgis with intermediate experience python scripting for automation of geoprocessing workflows. I am moving towards using QGIS on the regular and I would like to dive into ...
3
votes
1answer
926 views

Iterating through an numpy array and index to a value in another numpy array

I am struggling to get this code to work I want to iterate through an numpy array and based on the result, index to a value in another numpy array and then save that in a new position based on that ...
4
votes
0answers
762 views

Finding the “center of gravity” of multiple points where points have unequal weights [closed]

I'm trying to reduce a set of lat/lons (each with it's own weight) into one lat/lon that is the center of mass of all of the points. however when I map the results the average point falls no where ...
2
votes
2answers
64 views

How to travers fields of records without introducing them all in the function?

In my previous question I wanted to reach a field in the field calculation; however, it was pretty easy to introduce a few more inputs for that function. Now, I am facing a problem which needs around ...
3
votes
2answers
727 views

Move the cursor backward - opposite of row = rows.next()

I'd appreciate if anyone could please tell me if there is a way to go up one row in python cursor. opposite of row = rows.next() Thank you!
4
votes
1answer
582 views

arcpy “The table name is invalid”

I wrote a script that, ideally, loads raw .las (LiDAR data) files into a geodatabase, then creates a terrain from the multipoint files that are created. When I run the script though I get: ...
5
votes
4answers
394 views

Migrate in a new programming GIS language

The last five years I have been working with VBA and ArcObjects for developing a specific application within ArcGIS. That project that began around 2008-2009 carried out with VBA and ArcObjects which ...
3
votes
2answers
423 views

Copying netCDF coordinate system

UPDATE: 7/26/2013 The issue I'm encountering is a known bug with the netCDF-Java API described in ticket TDS-391: A user would like to convert radar data to netCDF format. Unfortunately, the data ...
6
votes
1answer
165 views

Python in ArcGIS: How to add a space between upper and lowercase letters in TOC

I'd like to use python to update the TOC by adding a space (white space) for layer names that are like this: "BoundaryBuffer" or "WaterEdge" and replace them with "Boundary Buffer" or "Water Edge". ...
-1
votes
1answer
64 views

Is it possible to import/run AML script into GRASS?

I have an AML script that has instructions to import tmp files of (grid, network, basin...) is there any way to run the script in GRASS? I tried to converted to Python but I couldn't do it for the ...
4
votes
4answers
435 views

How to rename a file in the output (ArcGIS python)?

raslist=arcpy.ListRasters() for ras in raslist: arcpy.ProjectRaster_management(ras,outfolder2+ras+'_Albers',spatialref2) print ras+' has been reprojected' I was using the above code for ...
6
votes
3answers
334 views

Using PROJ.4 library to transform from local coordinate system coordinates to global coordinate system using ground control points?

I have a point cloud whose coordinates are with respect to a local coordinate system. I also have ground control points with GPS values. Can I convert these local coordinates to a global coordinate ...
3
votes
1answer
192 views

How to sort features in a layer using OGR/Python?

How can I sort the features of an ogr layer by the values of a field? I tried naive variations of def sortlayer(ds, layer, field): lname = layer.GetName() lsort = ds.ExecuteSQL(b'select * ...
1
vote
0answers
293 views

Why does XYToLine_management give ExecuteError ERROR 999999 The table was not found?

I've written this script to import a csv file using ArcGIS' flavor of python.. ArcPy.. It seems to run fine up until the XYtoLine tool runs and then it fails.. This is the error message... Traceback ...
2
votes
2answers
280 views

Can anyone tell me why my field calculator is returning this error?

All I am trying to do is pull into a text field, a section of another text field via: fieldB = !fieldA![some_index:other_index] However I keep receiving the error below and I can't figure out why. ...
1
vote
2answers
296 views

Why is Shapely not installing correctly?

I am trying to run Shapely on a new machine, and tried both installing it from source, using the installer on its webpage, and using pip install shapely. Every reference I try to make from the library ...
0
votes
1answer
462 views

OSRM API - nearest point fed into routing

I am using the OSRM API to (1) determine the nearest point on a road segment from a give random point with http://server:5000/nearest?loc=_lat_,_lon_ The returned coordinates are used then as an ...
2
votes
1answer
1k views

How to add feature class to MXD with ArcPy (Python)?

I am using ArcGIS 10.1 and I am trying to add a feature class that I create to an MXD, so that I can join to it. This all needs to be done using Python. Is this possible?
1
vote
1answer
91 views

Create a plugin in QGIS-

i want to develop a plugin in QGIS to access to my database in postgres : i want to import a file.sql that contains my SQL Code in a textbox , and execute this code to assign myd database. Any ...
0
votes
0answers
44 views

( how to use Field Calculator to count number of duplicated recordes at another field? [duplicate]

How To Use the Field Calculator python script to count the number of duplicated records of a field "A" and get the count at another field "B"
0
votes
2answers
611 views

How to install Shapely, but got stuck into Python language

I have a MAC OSX 10.7.5 and am trying to learn how to use QGIS. Following a couple of tutorials I came to know I have to install shapely. I followed the instructions by the multi-cited ...
10
votes
2answers
612 views

Is there a compelling case to learn/use Python Toolboxes (new at ArcGIS 10.1) over Python Script Tools?

I've written a few Python Toolboxes (which are new at ArcGIS 10.1), but am yet to decide whether/when I should write them rather than Python Script Tools in a standard toolbox. I thought the Online ...
2
votes
0answers
127 views

returning exceptions to user via AGS REST

I've got a python script that I run as a standalone and as a gp service in AGS (moving to 10.1 now...). For the standalone execution, I'm throwing a custom exception if there is no data found based on ...
2
votes
0answers
57 views

Is there any way to symbolize a user-supplied input parameter in ModelBuilder?

I have a model built in ESRI ModelBuilder that is run from its tool dialog, where the user supplies the input feature layer that then gets processed in the model. I need the input feature layer to ...
0
votes
1answer
253 views

r.basin.py GRASS addon

I have added this add on with g.extension on my grass 6.4.3RC3. But it doesnt work... this is the error I can see: Traceback (most recent call last): File "C:\Program Files (x86)\GRASS GIS ...
2
votes
0answers
304 views

ogr.GetDriverByName('FileGDB') returns None

I installed: gdal-110-1600-x64-core.msi GDAL-1.10.0.win-amd64-py2.7.msi gdal-110-1600-x64-filegdb.msi from www.gisinternals.com I can open my gdb on the command line: C:\data>ogrinfo ...
0
votes
1answer
198 views

Save longitude and latitude in Django

I had plotted a Javascript gMap.Using the marker,the values of latitude and longitude are displayed.I need to get that values and save it to database.What is the best way to do this and ,How to ...
3
votes
1answer
187 views

How to get default parameter value for script tool from csv file?

I am fairly new to python scripting. I have just figured out how to read and write input parameters for a python script from a csv file. Now I am being asked to pre-populate the script tool dialog in ...
1
vote
2answers
133 views

Python select by attribute using a variable counter

I am brand new to python and trying to learn how to do some simple loops but I have hit a snag. Below is what I am working with, I am trying to select the polygon row by row, but I keep getting EOL ...
5
votes
3answers
1k views

calculating a field in which null values may be present

I would like to calculate a field (short integer) using other fields (short integer) present in the table. In some cases these fields may have null values for one or more of the fields. For example, ...
2
votes
1answer
440 views

Error when using gdal/ogr and python to clip a “shp” file by a “shp”

I am new to the gdal/ogr library for python and I was wondering how to clip a shp file by another shp file. I think I am having trouble with the syntax. Thanks - Stefan I keep getting a windows error ...
0
votes
0answers
20 views

Drillhole Plan Trace in Arc [duplicate]

I'm struggling to find the math to do what I want. I want to plot a top down view of a drillhole in ArcMAP 10.0. I have the beginning UTM coordinate and then for every place in the hole that was ...
1
vote
1answer
100 views

How to reach a field value of a record in field calculator in ArcGIS 10.1

I have two fields showing number of people in two age groups "young" and "old". these people also live in a cell (point) whose distance to a specific facility is calculated. then I categorized these ...
1
vote
1answer
670 views

Trigger a python script to run after a row is added to the feature class

I have a Python script which runs on a SDE feature class daily (as a scheduled task). I would actually like this script to run whenever a new row is added to the feature class (data is captured in the ...
13
votes
1answer
469 views

Creating nanoscale DEM with GDAL

A bit of a strange question perhaps, but let me give you a breif explanation of the background before my actual questions: Atomic force microscopy (AFM) is a method that, in short (and to my limited ...