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

learn more… | top users | synonyms

7
votes
1answer
2k views

How to convert Shapefile geometries to WKB using OGR?

I got the geometry of a feature of the shapefile, and i want to save that geometry in the postgis (in WKB formats like it happens when we import shapefiles using shp2pgsql and psql commands). How do I ...
3
votes
2answers
1k views

Ensure relative path in Arcgis layer files

I'm looking for the arcgis python equivalent of the VBA How to save a layer file with a relative path. I'm using a script to change the paths in a collection of about 75 layer files before ...
3
votes
2answers
3k views

How to create the custom tool in ArcGIS desktop with using of python script from model bulder?

I created some model builder for some customization to reduce time in our routine process. I exported my model builder to python script by availability of export options. It doesn't work if i bring to ...
3
votes
1answer
832 views

Interpolate undulations for given points using a geoid model

I have two databases, the first one (F.tsj) contains gps points: coordinates and ellipsoid heights and the second one is simply a geoid model where every line stores latitude, longitude, and ...
0
votes
1answer
1k views

Import Error while Importing osgeo package [duplicate]

Possible Duplicate: How to install GDAL with Python on windows? I have downloaded Fwtools for python2.5 from http://fwtools.maptools.org(windows installer) after installing it, it was ...
3
votes
1answer
499 views

Disaggregating multiring polygon for editing, then recombining

BUMP? We have many rows of multi-ring polygons, displayed on a Flex front end. We need to be able to select a polygon (a row), split the rings for editing, edit them, then combine into one polygon ...
3
votes
1answer
974 views

Update layer datasource in multiple map documents using ArcPy?

I would like to update the data source of a specific layer in multiple map documents using ArcPy, however I'm getting a <type 'exceptions.SyntaxError'>: invalid syntax error on this line: if ...
2
votes
2answers
459 views

unable to call shp2pgsql using python

I am unable to call shp2pgsql using python as I have to pass various options like (-s -a -i) and I am not getting the required output .. Method I am using is p1 = subprocess.Popen(["cmd", "/C", ...
3
votes
1answer
212 views

getsubcurve from multipart polyline ArcGIS

I have code which analyzes multipart polylines (roads) from the beginning towards the end. The algorithm "moves along" the road. My multipart polylines include circular junctions and branches so they ...
3
votes
2answers
377 views

run r.stats as a quiet module in GRASS-Python script

Has anyone else used r.stats as a quiet module in a GRASS-python script? As part of my program I'm using: grass.run_command("r.stats", flags='l', input=<file>, output=<*.csv file>, ...
6
votes
2answers
1k views

calculate average slope along a line

I have a slope layer and I want to calculate the average slope along a line. This line isn't necessarily straight (e.g its a route, I would like to be able to input geographic coordinates along that ...
3
votes
1answer
1k views

How to batch export layers to kml in Arcmap?

Is there a way to export layers to KML by altering the layer to KML tool to have more than one layer input?
2
votes
2answers
2k views

How to find nearest line to point using ArcGIS Desktop (ArcObjects/Python)?

I am new to building custom ArcObjects, and am looking for a custom python script for arcgis version 10 that will loop through a point shapefile to find the nearest line segment of a line shapefile ...
4
votes
2answers
677 views

How to automatically email interim results from model builder?

I want to get model builder to email me the results of processes at certain stages so that if there are issues I can remotely login and deal with them as I do with python scripts. I have a python ...
1
vote
1answer
638 views

arcpy Geometry tools give incorrect results

I'm new to python and arcpy but I've been trying to learn how to run geoprocessing tools using arcpy. I have (for this example) 2 shapefiles, a and b, which are both polygons. From plotting them in ...
3
votes
3answers
1k views

Using Python to combine middle parts of two fields into third field

Below is how I used the Update Cursor in my final script. As you can see getValue was used a few times, perhaps there is a cleaner way to do this? But my concatenated field wouldn't populate properly ...
0
votes
1answer
824 views

I think I have problem with basics about FME and Python

I try to learn from Oliver's corner instruction ftp://ftp.safe.com/fme/pyfme/OliversCorner.zip) . So for example I overwrite his #script 4 to StartupPython Script some below and set input data in ...
0
votes
0answers
102 views

Graphing with matplotlib [duplicate]

Possible Duplicate: Can you use arcpy.RasterToNumPyArray() to Graph a Raster with matplotlib? I ask this question, but didn't get any real bites: Can you use arcpy.RasterToNumPyArray() to ...
6
votes
1answer
354 views

Accessing graph in ArcMap document using ArcPy?

I am trying to access an existing graph in an ArcMap document with arcpy. I know how to create a new graph with arcpy, but I cannot seem to figure out how to access an existing graph in an ArcMap ...
4
votes
1answer
442 views

script for automating insert scale bar, text, north arrow

I've always wanted an automatic process for these tools instead of having to click insert again and again. It seems easy but I can't do it in modelbuilder and I can't seem to find anyone making a ...
4
votes
1answer
914 views

Using Gui tools and arcpy.mapping

For a project I want to create a little program that does simple things like export a map from the python command line, but also users are able to edit said map (without having to open arcmap) e.g ...
7
votes
5answers
754 views

python.multiprocessing and “FATAL ERROR (INFADI) MISSING DIRECTORY”

While trying to do multiprocessing with arcpy, I am occasionally running into this error: FATAL ERROR (INFADI) MISSING DIRECTORY I have no clue what is triggering this error, and it crashes the ...
3
votes
1answer
160 views

What are some lightweight python modules to convert LAS data formats to text formats?

I searched on the net and found pyLAS, but it seems to require quite a few other modules and I couldn't get the install right. Any pointers will be much appreciated. Thanks!
4
votes
1answer
555 views

Can you use arcpy.RasterToNumPyArray() to Graph a Raster with matplotlib?

Can you use arcpy.RasterToNumPyArray() to Graph a Raster with matplotlib? I'm looking to graph a raster with X, Y, and Z values in a 3D bar graph. I just can't seem to translate the numpy array to ...
0
votes
1answer
184 views

Where should I save my external python script to be executed in FME? [closed]

I need a path, because there are so many folders and subfolders :) FME is installed C:\apps\FME\python Tnx,
6
votes
1answer
1k views

How to filter wrong GPS readings?

I have absolutely no experience with GIS, it just so happens that one of the hobby projects I am doing at the local hackerspace includes tracking a model boat with a GPS... I hope this is the right ...
4
votes
1answer
771 views

Find distance and heading from a point to a polygon in lat, lon coordinates

I have counties mapped using polygons in Shapely with latitude/longitude for coordinates. Given a complex polygon x and single point y, how would I find the shortest distance between x and y as well ...
8
votes
4answers
3k views

How to create arcs between two points in Python?

I've been working on an python script automating the visualization of live point data. I have a table with two coordinate pairs. I'd like to connect these two point with an arc of a circle or similar ...
4
votes
1answer
398 views

A count of points within a set distance using updatecursor

I have a script that calculates the average distance between points. What I want is to rewrite it so I can input the point layer, input a distance, and the output field will tell me a count of the ...
1
vote
1answer
751 views

Hotlink vector/raster files to open in current workspace in ArcGIS 10 similar to Mapinfo

I want to add datasets to ArcMap and place them in a particular group layer by simply clicking on hotlinked polygons in a shape file. The same process is easy in MapInfo and I want to implement the ...
2
votes
1answer
376 views

Why does this python function return a value of 0 in field calculator?

I am trying to calculate the percentage of a total which the median value makes. I have a column with the median column labelled (i.e. 1st,2nd,3rd,4th column is median), the columns of values and the ...
2
votes
1answer
339 views

Why does “takes no arguments” error propagate from Arcpy example?

I was attempting to run Setup_Customers_Using_Tabular_Data , I modified the paths to fit my environment but when I run the program I receive SetupCustomersByTable() takes no arguments (6 given) ...
0
votes
0answers
103 views

Is there a better method to fix empty pixels after classification?

empty pixels occurs after classification - in arcmap you can use Generalization tools such as majority filter. However is there a script you could write to better fix it? for example - some of the ...
1
vote
2answers
667 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 ...
5
votes
2answers
562 views

select by attribute on shapefiles with open-source python modules

I usually use ArcGis 9.3.1, but when running a python script that includes Select_by_attribute (from gp), the script runs very very slowly. Is there a way I can perform a select-by-attribute on a ...
5
votes
4answers
2k views

Automate Projection of multiple shp files using ArcPy

I have been trying to create a Python script that will convert all shape files within a folder from GCS WGS 84 to Web Mercator. Below is the code I have so far but what I'm struggling with is how to ...
2
votes
1answer
490 views

Calculating beta-diversity w raster data [renamed]

Using ArcGIS 10, it is not possible to generate a raster attribute table for 32-bit float values. Instead, I have tried the RasterToNumPyArray method, which crashes since the file input raster is so ...
3
votes
1answer
293 views

Create polygon from OGREnvelope

I have a folder full of about 2000 files and I would like to generate a kind of key map for each file so people don't need to just randomly load each one in order to find what is what. I have the ...
2
votes
2answers
644 views

Convert CSV files into OSM with FME

I have a database which i've exported as individual csv files for each table. Below are some of the attributes which exist from two of the csv files: wayPointID linkID order x y z length ...
5
votes
1answer
266 views

Seeing QGIS Python Commands

When learning MapBasic I found the most useful way to learn how to do certain tasks was to do them using the GUI and then watch the MapBasic window in MapInfo to see how they were achieved in code. It ...
0
votes
1answer
1k views

Create HTML report using Python

i want to create Analysis report after createing model for generating cut/fill. Once it will done , basedon this cutfill/table, would be display statics in html formate using python. is it possible. ...
1
vote
2answers
1k views

Getting print statements in Python script to print through a batch file

I'm starting to learn Python and batch files. I have a Python script which selects data by location and exports the selection to a new feature class. The script runs just fine - included in this ...
6
votes
2answers
631 views

Using Python, Batch Project output won't drop in a feature dataset (ArcGIS 9.3 or 10)

When attempting to batch project in ArcGIS (using either arcpy or arcgisscripting), I cannot get my geoprocessing results to drop into the feature dataset that I specify. The results instead are ...
5
votes
2answers
2k views

Efficiency of python script using SAGA and arcpy

=== SUMMARY === I have created a process to import a LAS point cloud, clip it, select the ground points and save the output as an XYZ.txt for clients to use. This uses a python based script (will ...
2
votes
2answers
379 views

how to calculate a field from a shp currently sected in a arcmap session using a Python script in ArcMap 10?

Hi I nedd to create a script in Python for use in ArcMap 10. This script must be able to calculate a field from the shp currently selected in ArcMap. Any ideas?, I'm new to Python so any code example ...
0
votes
1answer
895 views

It is possible to edit selected features with Python?

I'm trying to edit some fields of the selected features in ArcMap. It's possible to do this with Python (ArcPy)?
2
votes
1answer
2k views

Issue with Mosaic to New Raster tool

I am having a major issue with the Mosaic to New Raster tool when importing ASC files. It processes the first few files but not all of them. I thought it was a space issue and tried to split the input ...
6
votes
1answer
129 views

Would it be possible to construct a stand-alone grass.script python package?

I would like to migrate dependency on ArcPy to grass.script without requiring the full installation of Grass. Would it be technically possible to have a portable directory containing grass.script and ...
2
votes
1answer
1k views

Using a geodjango PointField with geography=True, my distance calculations are wrong

Here's my model: class ExchangeArea(models.Model): """ An Exchange Service Area, calculated from a phone exchange and surrounding census tracts. """ coordinates = ...
0
votes
1answer
179 views

How do I assign a variable to a SQL Server ArcSDE database's feature class?

I'm using ArcGIS Desktop 10 and have no experience using Python with a SQL Server ArcSDE database. When using a shp file or file gdb it is very simple to reference a given feature class by simply ...