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

learn more… | top users | synonyms

2
votes
1answer
347 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 = ...
3
votes
3answers
179 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
1k 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
218 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
4k 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
278 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
823 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
257 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
8k 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 ...
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
266 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
322 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 ...
9
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
579 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
964 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
1k 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
570 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 = ...
3
votes
1answer
508 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
727 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
629 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
3k 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
942 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? ...
5
votes
1answer
676 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, ...
6
votes
1answer
1k views

How to toggle layer visibility in QGIS using Python?

How can I toggle layer visibility in QGIS via Python API?
4
votes
1answer
2k views

How to change a text element's font size using python? (ArcMap 10)

I need my script to change the font size of a text element if the string is too long to fit in the title section of the map. I've looked into it using Arcpy, but haven't had any luck. Does anyone know ...
4
votes
2answers
1k views

How does one build a Python script that exports to several output files?

I'm trying to build a Python Script that will receive one feature layer that will be clipped by several adjacent grid squares (each in a different shapefile) and output several shapefiles. Now, I've ...
3
votes
2answers
3k views

How to change the page layout from portrait to landscape using Python? (ArcMap 10)

I need my script to access the Page Orientation property of the current MXD, and switch it from portrait to landscape (or back). I've looked through the arcpy and arcpy.mapping documentation, and ...
9
votes
5answers
1k views

How to convert line simple features to topological network?

using Gdal/ OGR is there a way to convert a shp, kml, or PostGIS line layer into a network of nodes and segments so it can be used in packages such as networkx?
13
votes
1answer
2k views

How to have a python script self terminate in ArcMap10?

I have tried sys.exit, but it doesn't seem to work in ArcMap. Anyone know how to do it?
2
votes
1answer
475 views

How do I access MPS Atlas from python in ArcGIS 10?

I'm having trouble finding documentation on accessing MPS Atlas features using python in ArcGIS 10. I need to be able to modify dataframe manager properties, swap map sheets, etc. Is it part of ...
0
votes
2answers
183 views

APDM - error exporting database from Oracle

I have a farily large database on a slow network and I am using a thrid party tool to update data which calculates other fields and so on. I have a guid string with an empty box (weird glyph - seen ...
2
votes
1answer
621 views

How do I use python to access the attributes of features within the current extent? (ArcGIS 10)

The script I'm writing requires a specific attribute of the building polygon that the data frame extent is currently focused on. Is there a way to grab this data?
1
vote
3answers
937 views

an arcgisscripting method for sanitizing a filename?

Is there an arcgisscripting method for sanitizing a filename to get rid of characters which Arcgis barfs on, the meek hyphen - for example?
0
votes
0answers
396 views

IronPython + ArcObjects

Is it possible to access ArcObjects with IronPython?
1
vote
2answers
542 views

ArcObjects table views or sqlite3 in Python?

Given a larger csv (1000+ points) with attributes, I need to do both attrbute and spatial queries on the data. Would it be faster to read the points into an xy feature class, and do the spatial and ...