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

learn more… | top users | synonyms

2
votes
1answer
2k views

How to update feature class by iterating through values with branching?

I'm really struggling with getting this to work. Basically, I want my script to get the "newID" value and use that as a look up value. If the "newID" is found in the OldID list then do one thing, ...
1
vote
2answers
809 views

Help with a Simple Code to Read a Metadata from a Raster File

Please help me with a python code to read metadata from a Raster file. Thanks
1
vote
2answers
2k views

How do I programmatically update/recreate an ArcSDE feature class from external sql data?

I have an ArcSDE feature class that contains project points based on xy data from an external SQL databaes. (Not a geodb). I am looking for the best way to "recreate" the ArcSDE feature class from the ...
4
votes
4answers
604 views

Compressing map algebra outputs from ArcPy

When creating a raster map algebra output, is it possible to set its compression? I'm creating a model which generates many hundreds of rasters, and currently each is being stored without any ...
8
votes
5answers
5k views

update one shapefile attribute table with values from another dbf table

I try to explain here what I am trying to do: I have one shapefile and one independent dbf table with the same fields. In the dbf table all the fields are populated but in the shapefile attribute ...
2
votes
3answers
524 views

Why is this polygon “self intersected” and invalid?

I have a polygon defined as follows: segment from 43:29:02 N 003:50:39 E to 43:34:12 N 003:43:04 E arc(CW): center (43:34:49 N 003:58:16 E) from 43:34:12 N 003:43:04 E to 43:45:45 N 003:59:56 E ...
5
votes
2answers
1k views

Call FWTools (ogr2ogr) from ArcGIS python script

In ArcGIS, I want to use a Python script (and a standard ArcGIS script tool UI) to call functionality from FWTools. How would I make the call to FWTools? I tried using ...
0
votes
1answer
294 views

Eliminating a column from a copied feature class via a fieldmap object in ArcGIS Python

The use case is exporting a feature class via a Python script (arcgisscripting v9.3x. Only a few of the columns are needed in the result feature class. I commonly use the fieldmappings/fieldmap ...
1
vote
1answer
450 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 ...
10
votes
2answers
3k views

Point (of a linestring) within Polygon using ogr and Python

I'm currently working on a project in which I need to build a topological network out of the geometry features I find in shapefiles. So far using Ben Reilly's open source project I've managed to ...
7
votes
3answers
2k views

How to create a circle in arcpy

Suppose I have a dataset where each record has an x,y and r (the centroid and radius of a circle). How can I create a polygon feature class containing parametric circles? Sorry to those who have a ...
4
votes
2answers
796 views

Calculate spacing of polylines along transects in ArcGIS

I have a shapefile with a number of roughly parallel lines in it, and I want to calculate the spacing between these lines using a number of transects across the map. How should I go about this? I ...
6
votes
2answers
4k views

How does one access a featurelayer in SDE via Python?

I am trying to use Arcpy to run the CopyFeatures_management script so that I can copy a featurelayer in SDE. What do I use for the input (and output, for that matter, since I'll be copying the layer ...
4
votes
1answer
121 views

Is it possible to install 9.3 Desktop Administrator as a standalone program?

I have ArcServer 9.3 installed on a server that I use for running scheduled Python geoprocessing scripts. I have several running, and now I'm trying to schedule one to rec/post, delete and recreate ...
2
votes
1answer
487 views

How do I group layers in Mapnik?

I might be thinking about this all wrong, but right now I'm using Mapnik's OGC Server, and using that WMS with OpenLayers. How would I group multiple layers (say country, water, state borders) into ...
5
votes
1answer
673 views

Altering composer label items in QGIS with Python

I'm only new to QGIS and Python so this may exists already, and hopefully be easy to do. What I'm hoping to do sometime in the future is build a map book generator using QGIS as the base. In order ...
2
votes
1answer
334 views

ArcObjects ITextSymbol.GetTextSize in Python revisited: usage with StartDrawing and FinishDrawing methods

I am using ArcGIS 10.0/ArcObjects and Python 2.6. I am trying to get the usage of the ITextSymbol.GetTextSize method correct. The syntax, as established in an earlier question, is: dblx, dbly = ...
1
vote
1answer
298 views

Can you access ArcScan from a python script?

I'm using a python script with ArcPy in ArcGIS 10, and want to access some ArcScan functions. Is this possible? I can't see anything in the documentation about it, but I can't really find any very ...
3
votes
3answers
175 views

Is there a way to locally add links to an OSM data set

Here's what I'm trying to do: I'm modeling some transportation logistics data I want to test the effects of a "new highway" on existing travel demand The new road will be created from an arbitrary ...
5
votes
3answers
2k views

ArcMap/ArcObjects - Drawing graphics onscreen: Explanation or tutorial for Draw/Refresh/PartialRefresh methods?

I find myself woefully lacking in understanding of when, why, and how (which type) to do screen draw/refresh/partial refresh. For instance, in a standalone Python script outside the application ...
4
votes
1answer
206 views

ArcObjects ITextSymbol.GetTextSize in Python: Why are the out params equal to 0?

This is related to the question I asked earlier about the syntax for this method under Python and comtypes. Now that I know the syntax and am trying to use it, the returned out params are equal to 0. ...
6
votes
2answers
3k views

How should I use GDAL to perform a transformation?

Greetings, I am a student who wishes to use GDAL to transform a series of images from Lambert Conformal Conic (EPSG: 9802) to Google Earth's WGS 84 (EPSG: 4326) for a web mapping project. I know ...
3
votes
2answers
255 views

Segmentation Fault (segfault) when using OGR CreateField() in Python

Receiving a segfault when running this very short script in Ubuntu. from osgeo import ogr, osr shpfile = 'Census_County_TIGER00_IN.shp' def cust_field(field): '''cust_field(shpfile, field) ...
3
votes
1answer
725 views

ArcObjects: How to get from IFeatureClass on annotation feature class to IAnnoClass?

I am working in Python 2.6 and ArcGIS 10.0 through comtypes, so I have full ArcObjects access. (See the answer I tacked onto the related question "How do I access arcobjects from python?") That ...
3
votes
1answer
249 views

ArcObjects ITextSymbol.GetTextSize in Python: How do I define two input variables that get populated by the method?

I am using Python 2.6 and ArcObjects in ArcGIS 10.0 to build and draw, among other things, graphic text on the current display. At one point I need to use the ITextSymbol.GetTextSize method. In a ...
0
votes
4answers
5k views

Python Question - how do I extract a part of a string

I'm building a tool in python and for that I have a question: I have a string such as "Denver.dwg Group Layer\Denver.dwg Annotation". How do I assign to a variable (for later print) only the first ...
5
votes
1answer
1k views

Updating a point's geometry based on geometry of another feature class

I'm looking to update the point geometry of lets say "oldFC" by obtaining the shape geometry of "newFC" and applying that to the "oldFC". I also want it to grab the value in the ID field in ...
8
votes
5answers
1k views

Will there be a Python API for ArcGIS Server?

It seems like an obvious next step given the big push towards Python in ArcGIS Desktop at 10.0. Are there any limitations of Python compared to javascript, flex, etc that would prevent ESRI from ...
6
votes
4answers
1k views

Raster to Polygon Scripting Problems

I am trying to make a script which selects every .png file in a folder beginning with the letters "LG". I then want the scipt create a shapefile, replacing the "LG" with "SH", and then i want the ...
8
votes
1answer
3k views

Problem with setValue() function in ArcGIS 10

I'm trying to add data to an attribute table in ArcGIS 10 using the following code: def make_floor_no( shapefile ): "Makes header for number of Floors (FLO) and calculates value" fieldName = ...
6
votes
1answer
259 views

Does Arcpy work for Engine or Server the same as Desktop?

I am contemplating a project where there is not going to be access to ArcGIS Desktop and wondering if Engine and/or Server install ArcPy and Python? Is this possible? Does anyone have an example?
4
votes
2answers
313 views

Unique Character Generator Help

I am working on a script that will populate 3 letters into a field. I have to use letters due to field limitations and to make sure that I have enough combinations. I'm not really sure where I am ...
8
votes
4answers
2k views

how can i convert a shapefile to lat and lon boundaries?

i have a shapefile of country subdivisions and i would like to extract an array of bounding lat and lon for each division.. is it possible to do?
9
votes
1answer
6k views

How to create a script tool that will create a copy of a feature class and offset it by a given distance? (arcpy)

I want to duplicate a polygon feature class and offset all of the polygons by about 10 feet in both the x and y directions. I asked if there was any way to do this last week, and I was informed that I ...
19
votes
6answers
542 views

Python for GIS on a thumb-drive

I'm looking at putting together a light Python install on a thumb drive that I can take to client offices and do some basic GIS processing. I'm thinking of installing the following: PyScripter ...
1
vote
2answers
894 views

Running ArcGIS 10 Python script on a unix server - is it possible?

I've written some python scrips that use the ArcPy module to do some pretty intensive processing. I'd like to be able to run these on the fast unix server we have in our department so that I don't ...
3
votes
3answers
2k views

Writing a plugin for Qgis using python to access PostGIS and write geometries

Sorry about the strange title didn't really know how to word it. I currently use MapInfo to do most of my GIS work however I have recently installed PostGIS 1.5 and am really liking it so far. A ...
4
votes
1answer
523 views

GDAL Pixel Functions question

I am writing a program in python that converts raster files using gdal, and using VRT as an intermediate format. One of the things that i need to do is convert bands between different formats. I am ...
6
votes
1answer
1k views

Setting units in python using ArcGIS 10

I want to calculate the area of each polygon in a shapefile. How do I control what the units of measurement are? def getArea(shapefile): """Print area of polygons""" Rows = ...
9
votes
2answers
4k views

How to make a button that calls a python script as a command rather than a script tool?(ArcMap 10)

I believe that in Arc9.3, commands could be created using VBA scripts. To add a custom command, you would navigate to Customize > Toolbars > Customize... and click UIControls. However, UIControls is ...
5
votes
5answers
1k views

What Avenue scripts/extensions do you still keep ArcView 3.x around for?

Alternatively, if you've completely moved on, which do you miss the most? Thanks and signed,     Not entirely idly curious. (As a side project, I'm looking into the effort ...
3
votes
1answer
456 views

With CTM how can I get the latitude and longitude bounding box of a geoPDF?

Embedded in a geoPDF is info on the CTM - Coordinate Transformation Matrix. I am unfamiliar with this CTM. I know how to use python-numpy. How (or is it even possible) for me to use the CTM ...
4
votes
2answers
683 views

Maturity of Mapserver mapscript C# bindings?

I've been thinking about possibly porting an internal custom GIS application built on top of Python / PyQt / Mapscript / GDAL-OGR / PostGis to C#. I was wondering about the maturity of the C# ...
1
vote
1answer
616 views

Run a python script every time the page is changed in Data Driven Pages? (ArcGIS 10)

I'm setting up a Data Driven Pages mapbook mxd for a series of parking locations. I have dynamic text that updates according to the current map sheet, but I also have text that needs to update using a ...
0
votes
2answers
2k views

KeyboardInterrupt doesn't work when arcgisscripting module is loaded

The KeyboardInterrupt exception -- thrown when Ctrl-C, or Ctrl-Break on some machines, are pressed in a Python console window -- is commonly used to gracefully break out of long-process loops, ...
5
votes
1answer
801 views

Programmable buffers using GDAL and python

Is there a way to programmatically generate buffer layers for vector layers using GDAL and python?
5
votes
2answers
2k views

Using Qgis API and python, how can I return latitude and longitude of a point?

I have a point layer, that I'd like to return the Longitude, latitude using the qgis api. I assume I need to use QgsPoint
3
votes
2answers
3k views

Can I use python 2.6 with ArcGIS 9.3?

Is it possible to use Python 2.6 (or 2.7?) with ArcGIS 9.3? The official stance is no, not supported. There are a number of reports in the wild though that it can be done. How is this accomplished? ...
4
votes
1answer
546 views

Trip travel matrix on OSM data

Here's my situation: I'm modeling travel logistics I have 1,000 nodes, on my road network I'd like to generate the minimum driving time distance between all these nodes This process will be done 24 ...
3
votes
2answers
3k views

Assertion Error when attempting arcpy.mapping.AddLayer

Whenever I attempt to use AddLayer it gives me: Runtime error <type 'exceptions.AssertionError'> This is what I've been using: arcpy.mapping.AddLayer(MainDF, ...