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

learn more… | top users | synonyms

2
votes
1answer
676 views

Using Python in the Field Calculator, how do I refer to a field in another shapefile?

I want to compare the changes in geometry between two shapefiles (of election districts in NYC. One is from 2001 and the other 2005). I am attempting to calculate a new field in the 2005 shapefile ...
2
votes
1answer
131 views

How to get a list of all projections that are currently available in QGIS via the PyQGIS-API

i'm building a QGIS-Plugin and i want the user to choose a CRS out of a combobox in which the coordinates he would enter into some textfields are represented, so these can be converted into another ...
2
votes
1answer
71 views

Python code for locking elements in Layout view

Is it possible to lock elements in layout view in Python? I know it is possible in the production cartography extension from ESRI but all I need is the funcionality to lock elements. I am wondering if ...
2
votes
1answer
190 views

Dissolving stream orders using Python rather than VB script?

I've been trying to dissolve streams, using orders programatically and I came across this VB script. The reason is that if I use ArcGIS dissolve, it merges the confluence of the same orders. I would ...
2
votes
1answer
523 views

Why does Merge then Dissolve return ERROR 000732: Input Features: Dataset … does not exist or is not supported?

I'm not sure why I'm running into this problem. I thought it might have something to do with the merged file being locked or open, but I don't see a "LOCK" file being created in Windows Explorer. ...
2
votes
2answers
1k views

How to incorporate drop-down list within cells of shapefile attribute table using ArcGIS Desktop?

A question has been brought to my attention. When working with a shapefile within either 10 or 10.1. Is it possible to create a python script or some sort of programming language to accomplish this ...
2
votes
1answer
80 views

remember QGIS instance

it would be absolutely great if someone could help me with the following problem: I have a simple Python-Plugin that starts another executable in a subprocess. From within this application (which ...
2
votes
2answers
332 views

arcpy.mapping.AddLayer invisible layer

I'm having a bit of a problem with a script on a particular machine. ========================================================== import arcpy,sys class AddLayer(object): ''' classdocs ...
2
votes
2answers
564 views

How to import qgis.core to python IDLE?

I try to follow the step in How to import qgis.core to python app? to import qgis.core with Python Shell. But when I type set PYTHONPATH=C:\Program Files (x86)\Quantum GIS Wroclaw\apps\qgis\bin it ...
2
votes
1answer
311 views

How to upload a shapefile to geoserver using cURL and replace file?

In the sequence of this: How to upload a shapefile to geoserver using cURL? which was properly solved, I now need to be able to replace the existing file, cause my process is to be repeated every ...
2
votes
1answer
508 views

How to add a progress bar to a python plugin?

I would like to add some type of progress bar to my Qgis python plugin. Can someone point me to an example?
2
votes
1answer
98 views

Listing installed QGIS plugins via PyQGIS

Can you please tell me how I can programmatically (or from the console) access the loaded plugin list? I tried: QgsProviderRegistry.pluginList() but got: TypeError: ...
2
votes
1answer
270 views

How to get all attributes from a non geometry PostGIS layer with Python in QGIS?

I want to extract all attributes from a non geomety layer in QGIS with Python, but there is only the function uniqueValues(fieldIndex) More specific: I have a postgresql table which is loaded into ...
2
votes
2answers
2k views

How to clip multiple raster datasets with county polygons?

The example below shows three raster (i.e. in black) and a single county polygon feature class. How can I clip/extract by mask the rasters by their corresponding county polygons (i.e. Edwards, Clark, ...
2
votes
1answer
305 views

Python script for Data Driven Pages to run a series of DDP at once?

I have a several different polygon shapefiles that I am using to create individual maps for each polygon within the shapefile. The layout is the same for each map, the only thing that changes is the ...
2
votes
1answer
464 views

Script for Editing TIN in Arcgis: modelbuilder works, when exported as script gives an error

Arcgis can give such a headache! I want to automate loads of small tasks, and so I need to edit empty TIN with python in order to create a full TIN. My srcript is giving errors, so I tried by hand to ...
2
votes
1answer
279 views

Is it possible to set a layer style (e.g. set the color ramp) before loading the layer using pyQGIS?

I am implementing a tool which allows an user to calculate some statistics with some data from the registration office. My question is, can I set some layer styles using pyQGIS? The analysis part is ...
2
votes
2answers
841 views

Conditional combining of multiple rasters to produce one output using Python?

I have two rasters for same spatial extent and need to compare both rasters cell by cell and produce one output raster. Each has 10 land cover classes. Based on those 10 classes the comparison should ...
2
votes
1answer
900 views

Importing QGIS core into Python on OSX

I am interested in learning how to write standalone scripts using QGIS. An answer to my previous question directed me to the PyGIS CookBook which has the following instructions for importing the ...
2
votes
1answer
330 views

How to implent a “maketrans” python function on field calculator

i'm traying to implent python string translate function at field calculatore http://www.tutorialspoint.com/python/string_translate.htm in order to fix hebrew imported from cad. here is the code - def ...
2
votes
2answers
3k views

arcpy.Delete_management not deleting a geodatabase folder

This script runs fine the first time but fails when run the second time. The issue seems to be that the KMLToLayer_conversion statement creates a file geodatabase (no surprise) that subsequently ...
2
votes
1answer
218 views

Does ArcMap/ArcPy support creation of textElements using Python?

From what I can tell python at ArcGIS Desktop 10.0 cannot create new textElements nor GraphicElements. Yet, 10.1 seems to support the ability to at least create a clone, of a existing GraphicElements, ...
2
votes
3answers
1k views

How to access vector coordinates in GRASS GIS from python?

Is there a way to iterate over lines and their vertices using python? I'm new to GRASS GIS, and it looks like there are ways to read raster (for numpy), but I don't see a direct way to access ...
2
votes
1answer
251 views

How can i include program form (created in Designer ) to my QGIS plugin?

How can I include a form created in Designer in my QGIS plugin? And how to get controls values (textbox,label,etc)?
2
votes
1answer
511 views

How to add GDAL Programs folder to ~/.bash_profile

I have recently installed on Mac OS X Lion 10.7.4 the GDAL Framework 1.9 with Python bindings from [http://www.kyngchaos.com/software:frameworks][1]. I need to add the following Programs folder to my ...
2
votes
1answer
3k views

Exporting .jpg files from data driven pages in Arcmap

I have generated about 90 maps through data driven pages(ArcGIS 10.0). I now want to export them as .jpg files in either landscape or portrait format. I tried python but it is not working, it worked ...
2
votes
1answer
202 views

Converting 2D shapefile to Equal Area Projection?

I have thousands of shapefiles with coordinates in lat/long (-180 to +180 x, -90 to +90 y), that contain polygons of which I wish to calculate the area. I'm using the Python GEOS/OGR/GDAL API. If I ...
2
votes
1answer
207 views

Why isn't this Python calculation working correctly?

I want to label the source files for a unified shapefile, and there are three respective columns for each. If there is no value in the column, there is no data from that source; if there is a value in ...
2
votes
2answers
173 views

Exposing ArcInfo level liscenses to ArcView desktops via ArcGIS Server and custom python script tool

I have a script that uses an ArcInfo level tool. The script works great on my machine but uses an ArcInfo level tool which the ArcView users don't have. Is exposing these ArcInfo level tools ...
2
votes
2answers
884 views

create relationship class with stand alone python script

I have created a relationship class in arc catalog using the same arguments I'm using below, however if I try and create it using the script below I get: arcgisscripting.ExecuteError: ERROR ...
2
votes
2answers
410 views

Convert Georeferenced imagery to vector data using python

Are there any opensource tools I could use to take a projected georeferenced image such as a jpg with world file, that is UTM projection such as NAD83 and convert it into distinct vector polygons ...
2
votes
1answer
422 views

Converting x, y, zoom for Calculating tile bounds

i am working on calculating tile bounds lat lon from x,y,z tile coordinate. i have looked gdal2tiles code structure and i have found this good function: def TileLatLonBounds( tx, ty, zoom ): "Returns ...
2
votes
1answer
610 views

Looking for a pure Python method to convert Lat/Long To MGRS

Does anyone know of any packages out there that implement a pure python method to convert lat/long coordinates to MGRS coordinates? PyPi has a package, but it requires some c-extensions from ...
2
votes
1answer
3k views

How to create a list and append objects to it through a loop

Still struggling with this script. Now I need to create an arpy.AddMessage that says "Projected: with the list of feature classes that were projected in the loop" i.e. Projected: filename, ...
2
votes
2answers
733 views

How to set up a plugin repository for QGIS?

I am working with python plugins for QGIS.I developed my plugin and created .zip file including my .ui,.py and resources files.In order to incooperate this plugin into QGIS i created .xml file ...
2
votes
1answer
8k views

Python :ImportError: DLL load failed: The specified module could not be found

I am working on Python plugins for QGIS. I set my variables as PATH :=C:\OSGeo4W\apps\qgis;%PATH% PYTHONPATH:=C:\OSGeo4W\apps\qgis\python But when I try to run my .py file in IDLE I get an error ...
2
votes
1answer
145 views

Locate DTEDs from one layer that intersect a polygon in another layer

I'm new to the GIS world, and using ArcGIS 10, so please forgive me if this is a simple question. I have DTED files (level 2) that I have placed into a mosaic dataset, and I'm trying to determine ...
2
votes
1answer
447 views

Perform Multiply (Times) Function on Several Reclassified Rasters Using Python

I have several reclassified rasters (0 = snow cover, 1 = no snow) and I would like to use the multiply function on all rasters that have the same spatial extent. In ArcGIS 10 this function can be ...
2
votes
1answer
347 views

Search Raster Files from Folder that Have Same Spatial Coordinates Using Python

I have approximately 700 raster files in a single folder and I need to find files that have the same spatial extent and copy to a different folder. The raster files measure daily snow cover and ...
2
votes
2answers
128 views

Finding Two locations with a conditional search on DEM

I want to find two locations H difference in elevation between two locations on a DEM. Ex: point A and B are my output after search on DEM. conditions are (1)buffer R distance around point A and (2) ...
2
votes
1answer
371 views

ArcPy replaceDataSource to an SDE raster catalog error

New to Python! I'm trying to re-path a multitude of rasters currently the workspace is a folder, the intended workspace is a raster catalog in an SDE database - using the replaceDataSource method I'm ...
2
votes
1answer
339 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) ...
2
votes
2answers
644 views

Convert CSV files into OSM with FME

I have a database which i've exported as individual csv files for each table. Below are some of the attributes which exist from two of the csv files: wayPointID linkID order x y z length ...
2
votes
2answers
379 views

how to calculate a field from a shp currently sected in a arcmap session using a Python script in ArcMap 10?

Hi I nedd to create a script in Python for use in ArcMap 10. This script must be able to calculate a field from the shp currently selected in ArcMap. Any ideas?, I'm new to Python so any code example ...
2
votes
1answer
488 views

How to determine area of pixel in meters with GDAL and Python?

I have a raster loaded in Python using GDAL bindings. I'd like to be able to determine the area of a pixel in meters although I'm not confident that the projection is in meters. On this page I see a ...
2
votes
1answer
519 views

Running C# code from a python tool (ArcMap 10)

It appears that the only way to copy individual rows of data while preserving GlobalIDs in code is by using C# or VB.NET. I need to run the C# code from the above link within a python tool, and I am ...
2
votes
1answer
2k views

How to populate a field with the max M value of a feature using Python in Field Calculator?

I need to calculate the max M value for a line feature using Python in ArcGIS 10 Field Calculator but I cannot figure it out. In 9.3 I used the follow VBA expression… **Pre-Logic VBA Script Code:** ...
2
votes
2answers
819 views

Mapnik TextSymbolizer showing nothing above OpenStreetMap base layer

I'm trying to use Python to create a TextSymbolizer to display a trail name above the trail LineSymbolizer. Below this layer is the OSM base layer which contains its own data for that trail. I can ...
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 ...
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, ...