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

learn more… | top users | synonyms

6
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 ...
8
votes
6answers
1k views

How to integrate SAGA Python Modules into ArcGIS Desktop?

I have been having a look at SAGA (http://www.saga-gis.org/en/index.html) and it seems to have some nice tools for geoprocessing. I was wondering if anyone out there has had any luck bringing SAGA ...
3
votes
2answers
4k 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, ...
5
votes
2answers
8k views

How to write a script that will automatically draw lines from one point to multiple destination points? (ArcMap 9.3)

I need to create lines from an airport to numerous destination locations. The destinations change often, so drawing them manually becomes tedious. I want to create a script that will draw them ...
1
vote
1answer
648 views

How to create a pop-up box if a condition is true in a table? (ArcMap 10)

I'm creating a script that will grab layout data from a table for the current Building Number of the current building my map series is on. It works fine, but I need it to pop up a window if multiple ...
9
votes
1answer
955 views

How to read/write from/to QGIS project file using Python?

I'd like to save the project-dependent configuration of my Python plugin inside the QGIS project file. Is this possible and what are best practices to do so?
6
votes
1answer
2k 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 ...
15
votes
4answers
10k views

Is it possible to use Arcpy in ArcGIS 10 to zoom to a selected feature?

The answer to this may be a simple yes or no, but I'm hoping that someone is aware of a way to zoom to the extent of a selected feature using the ArcPy modules in ArcGIS 10.
8
votes
3answers
9k views

How to create a button in Arcmap 10 to run a Python program?

I have a script that I want to run within ArcMap when a button in a toolbar is clicked, and so far I have only been able to make the script into a script tool. I need it to run as a command, not as a ...
7
votes
2answers
2k views

How to disable and enable drawing in ArcMap using Python?

The script that I'm writing repositions two data frames and sets their extents. When doing this, it redraws the entire Active View 4 times, slowing the script substantially. Pressing F9 or ...
1
vote
2answers
1k views

unique value symbolize layers from a lookup table

I need to create a large number of Arcmap layer files (v9.3 or 10), perhaps a hundred, from lookup tables. I don't have to set the symbol patch itself, that can be random, but I do need the value and ...
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
4k 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 ...
14
votes
3answers
3k views

Can i use ArcPy to get layer symbology?

Hello all Since ArcGIS 10 comes with ArcPy package, i'm wondering it is possible to use ArcPy functions to get Symbology (i.e color, width...) of a layer? Thanks in advance
12
votes
11answers
30k views

Full list of ISO ALPHA-2 and ISO ALPHA-3 country codes

I'm searching for a full list of countries with their country codes. Like on this page (need full and valid): http://www.nationsonline.org/oneworld/country_code_list.htm Thanks.
13
votes
1answer
3k 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?
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 ...
22
votes
10answers
8k views

How do I develop my GIS programming skills?

I would like to develop my GIS programming skills, where do I start? People say learn C++ or Python but where can I learn this in a geographic context? Tutorials or anything would be very helpful, as ...
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?
2
votes
1answer
360 views

AddMessage issue

I wrote the following code as a wrapper around messages pushed durring the running of the script. Using Python IDLE this works fine, but in eclipse I get the following output: def ESRIP(gp,message): ...
0
votes
2answers
184 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
626 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?
8
votes
3answers
888 views

Are there any training resources in SQL and Python as applied to GIS database management? [duplicate]

I've taken ESRI database courses, which have been helpful to my work. But I also need training in SQL and Python as applied to GIS database management. There are lots of suggestions for Python ...
18
votes
9answers
3k views

Is there a way to code-complete arcpy scripts using an external editor?

I have been scripting in Python for ArcGIS 10, and so far I have just been using Notepad++. I like how the Python command line interface code-completes arcpy functionality for you, showing you your ...
2
votes
1answer
483 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 ...
1
vote
3answers
950 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?
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 ...
6
votes
3answers
4k views

Arcmap: attach python script to a button?

In ArcMap 9.x how can I attach a python script to a button?
21
votes
7answers
8k views

Nearest neighbor between a point layer and a line layer

I've asked this question several times on stackoverflow and irc between #qgis and #postgis and I also tried to code it or implement it my self in postgis with no real answer. Using programming (most ...
1
vote
2answers
551 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 ...
3
votes
3answers
793 views

How to stop ArcGIS Python script printing warnings and other outputs to the console

I've written a Python script using arcgisscripting to do various processing steps on some data. I'm planning to run it from a stand-alone command-line window (ie. not within ArcGIS at all) and, as ...
9
votes
4answers
9k views

How to change feature class and field aliases in bulk?

I have over a hundred FCs, each with 10 or 20 attributes to add or change the aliases for, two or more times a year. Needless to say, this is not something I'm going to grunt my way through. How can I ...
10
votes
7answers
6k views

How to get raster image as array in Python with ArcGIS

When starting to work with Python and ArcGIS 9.3, I assumed there would be a simple way to get a raster image into a Python array so that I can manipulate it before storing it back as another raster ...
9
votes
2answers
729 views

Can ArcGIS and OSGeo4W share the same python install?

I don't like unnecessary duplication. Is it possible to install python only once and have both ArcGIS and OSGeo4W use it?
0
votes
0answers
406 views

IronPython + ArcObjects

Is it possible to access ArcObjects with IronPython?
81
votes
5answers
13k views

How do I access ArcObjects from Python?

I would like to be able to script some things that are not exposed via arcgisscripting or ArcPy. How do I access ArcObjects from Python?
15
votes
6answers
5k views

What tools in Python are available for doing great circle distance + line creation?

I need to use Python to create a great circle distance -- both a number, and preferably some kind of 'curve' that I can use to draw in a client-side map. I don't care about the format of the curve -- ...