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

learn more… | top users | synonyms

8
votes
6answers
5k views

How can I calculate the orientation of each side of a polygon in ArcGIS 10?

I want to examine the orientation of each line in a polygon so that I can calculate their solar exposure. Each polygon represents a building, and has an associated height. For the moment, I just want ...
9
votes
3answers
1k views

How to populate an undirected graph from PostGIS?

This question is more related to resources that I might not have identified yet, although I've been searching the web for a while. In the project I'm working at the moment I need to run a ...
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 = ...
7
votes
3answers
3k views

Problems setting up eclipse (with PyDev) for ArcGIS 10

I'm trying to use eclipse with PyDev to program in python. In Windows 7 x64, I've added a PATH environmental variable (PATH C:\Python26\ArcGIS10.0\python.exe;) and what I thought were the relevant ...
2
votes
3answers
1k views

Adding shapefile as layer in ArcMap via Python scripting?

I am trying to automate various tasks in ArcGIS Desktop (using ArcMap generally) with Python, and I keep needing a way to add a shapefile to the current map. (And then do stuff to it, but that's ...
49
votes
15answers
16k views

Resources for learning Python programming with generic GIS goals in mind?

In your opinion, what is the best book/site to learn Python with GIS goals in mind? By "best", I mean: not very long (book) easy to understand (book/site) good practical examples (book/site) For ...
4
votes
1answer
587 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 ...
11
votes
7answers
1k views

How to implement value-by-alpha map in GIS?

I've been doing some background reading about cartograms recently and stumbled upon interesting alternative - value-by-alpha maps. Concept is described in more details here and full paper is ...
4
votes
2answers
746 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# ...
3
votes
1answer
528 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 ...
6
votes
1answer
865 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 ...
1
vote
1answer
634 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 ...
2
votes
2answers
809 views

Any python script to convert a geoPDF to a KML embedded with a jpg link?

I have many geoPDFs. I want to turn them into KMZ or KML+JPEG using a python script. Any suggestions? SEE CODE BELOW
5
votes
5answers
5k views

How do I build a form within ArcMap?

I am building a file geodatabase using ArcGIS. The gdb is going to be distributed to dozens of 'stand alone' machines. End users are expected to populate the gdb with data. End users do have ArcGIS ...
1
vote
2answers
983 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 ...
5
votes
2answers
9k views

'Select by attribute' using python in ArcMap 10

I need to select a feature using SQL before zooming to it in python. What I'm looking for are replacements for the commented lines in this code: import arcpy parcel_num = "123456" mxd = ...
49
votes
11answers
35k views

How to install GDAL with Python on windows?

Can anyone please explain to me in step by step instructions how to install GDAL/OGR with Python on Windows. I have Windows Vista and I have tried following the information on the website and it does ...
6
votes
3answers
3k views

Convert .mxd with embedded VBA command button to ArcMap 10

I'm trying to convert an .mxd file from an older version to ArcMap 10. The old version had two simple VBA scripts attached to toolbar buttons. I am trying to convert this .mxd to ArcMap 10. For ...
3
votes
1answer
1k views

How to clear python console in QGIS?

After running several hundred lines of commands (and getting their subsequent error statements...), it is nice to be able to clear out the console window and start clean. In the Python Console ...
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
1k views

Programmable buffers using GDAL and python

Is there a way to programmatically generate buffer layers for vector layers using GDAL and python?
0
votes
2answers
4k 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
720 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
3answers
180 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

Can you create new annotation feature classes with Python in ArcGIS for Desktop?

I am working on a project that needs to create file geodatabases from scratch and I cannot find any information about how to make new feature classes as annotation with Python. Does anyone have any ...
6
votes
3answers
1k views

Is anyone successfully using arcpy.ExportMetadata_conversion?

I don't know if it is a bug or my lack of python skills, but I keep getting 'ERROR 000816 The tool is not valid' in my python script when I call ExportMetadata_conversion Initially, I was attempting ...
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
659 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
972 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
4k 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
14
votes
11answers
31k 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
361 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
628 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?