Tagged Questions

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

learn more… | top users | synonyms

2
votes
2answers
2k views

How to automate point-in-polygon queries in ArcView?

Layer1 = point shapefile (multiple points, geocoded) Layer2 = polygon (1 attribute; (1,2,3...)) I want a non-gis person to be able input a single address and be told the attribute of the polygon ...
5
votes
1answer
379 views

How to restrict or block certain paths in NetworkX graphs?

I am trying to calculate shortest path between 2 points using Dijkstra and A Star algorithms (in a directed NetworkX graph). At the moment it works fine and I can see the calculated path but I would ...
4
votes
1answer
2k views

How to convert state name abbreviations to full names?

I have a data table with columns that includes city names (ex: San Jose) and state name abbreviations (ex: CA). Is there a way to define the state names as their full names (i.e., CA = California) and ...
4
votes
1answer
386 views

How to write code for downloading a file in ArcGIS 10?

I have an offline database which has lat & long coordinates. The functionality I need to provide is to have a (latitude, longitude) point which will have country and city in it. Once the user has ...
6
votes
2answers
4k views

How to calculate a field in ArcGIS using Python?

I'm trying to calculate a field based on the values of others in the same layer in a calculation. I can't work out why its not working. I've even cut everything down to just be based on one field and ...
2
votes
1answer
409 views

IZ.InterpolateZsBetween, how to use it for multiple parts in polyline

I want to interpolate Z values for the vertexes in the polyline. Shape file contains few polylines. Polylines do have certain vertexes with correct Z value, others do not have Z value (set to ie. 0). ...
3
votes
1answer
2k views

update a field based on another field in python

I need to update a field based on another layers field. I could do this in arcmap manually by joining the two layers together and then using field calculator. Is there a way I can do it with a script? ...
6
votes
2answers
226 views

projection tool as standalone script

How would I automate the define projection tool in arcmap so I can just enter my layer each time? I have it as a script in toolbox, but I am unsure how to set it so I can just input my layer as ...
1
vote
1answer
330 views

ctypes: bridge in python for a dll

I have a dll and I'd like to call it in python. The dll needs of parameters. Do you know how to pass a radiobutton parameter and a checkbox parameter? thanks
4
votes
1answer
3k views

How to add field in attribute table by python

I have research on the question (How to add an attribute field to an existing Shapefile via Python) but could not implement it. If you can give me examples on how to add field name in attribute ...
1
vote
2answers
632 views

Join/Relate in ArcGIS 9.3.1 ArcEditor through a python script - is it possible?

I'm working on a ArcGIS 9.3.1 ArcEditor and I want to write a python script that will do a Join or Relate. Problem is, that join table\join field are restricted to ARCINFO (higher license), and relate ...
9
votes
3answers
8k views

How to create a shapefile in ArcGIS 10 using arcpy?

How can I create a shapefile using Python in ArcGIS 10? I have lat & long. From this I need Python code which will create a shapefile and display it in ArcGIS 10. Thanks.
10
votes
5answers
2k views

Determine min and max values in an ASCII raster dataset using Python

I have a raster dataset in ASCII format. Using Python, I need to determine the min and max values inside the dataset. I've been told that the header information is key, which contains things like ...
2
votes
1answer
325 views

How can I remove WMS layers from mxds using arcpy?

I'm trying to remove WMS layers from an mxd using arcpy. I can successfully remove "MapServer" type services using the below code, but not WMS? Here is an example mxd (zipped) with two different WMS ...
5
votes
1answer
598 views

Is there a way to get layers from a .msd using arcpy?

I need the name of each layer in an .msd, but I could not find support using arcpy (ArcGIS 10.0). Is there a method I missed? In the current workflow, since I am publishing the document, I use the ...
1
vote
1answer
491 views

Move Extent Locator Display python error

I am trying to use ESRIs generated python code to move around my Extent Data Frame based on location of my Main Line shapefile, as to not have the Data Frame over top of the main line when developing ...
3
votes
1answer
889 views

Multiline VBScript Label Expressions in Arcpy

I am able to set simple label expressions, but when I try to set multiline expressions (which all VBScript expressions are) it does not get copied into the expression box properly. I have tried using ...
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
2k 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
752 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
439 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
874 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
407 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
203 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
344 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
981 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 I find the nearest line to a point?

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
610 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 ...
0
votes
1answer
579 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
717 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
101 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
338 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
386 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
876 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
664 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
152 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
526 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
174 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
690 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
2k 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
371 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
708 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
359 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
316 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
100 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 ...