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

learn more… | top users | synonyms

5
votes
2answers
2k views

Using SearchCursor to access & export values in a raster table

I am desperately trying to export the values in a raster table to a .txt file. I've seen some other folk post about this, but for some reason can't get the code to work in my case. I have a raster, ...
3
votes
2answers
961 views

Add a .lyr file to multiple mxd's within a specified folder using python

I need to create a python script that will look in a certain folder or workspace, and add a certain .lyr file to each mxd in the folder. I am able create a python script that adds the layer by ...
1
vote
0answers
478 views

Access Geoprocessing results in Flex Viewer (Enhanced) Search Widget

I have Robert Scheitlin's Enhanced Search Widget up and running successfully with my MapService using ArcGIS Server and Flex Viewer 2.3. I also have a geoprocessing service that returns a point layer ...
2
votes
1answer
385 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
553 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
596 views

ArcPy - Dataframe rotation - Getting a polyline length wise in the dataframe in layout view in ArcMap

EDITED: I'd like to rotate my dataframe until a polyline fits dataframe-width wise in the layout view of a .mxd. If the lines runs north/south I would like the dataframe rotated until the line is ...
2
votes
0answers
58 views

Tiled image transforming to new profile

i have a set of tile which was tiled profile of mercator and proper to tms scheme mechanism. unfortunately i dont have any tif or georeference table or anything for this. all was tiled with mercator ...
0
votes
1answer
309 views

python calling def __init__(self, uri=None): method

I am working on python plugins for QGIS. I have my QueryBuilder.py and postgis.py files. I connected it to database using Connection class and under def __init__(self, uri=None) in postgis.py file. I ...
1
vote
2answers
1k views

Python script has execution error first time through on a JoinField, but not the second time

I have some Python code that takes a shapefile, creates its centroids via FeatureToPoint, joins an auxillary field from the shapefile to the centroid via JoinField, and then goes on to do some more ...
14
votes
3answers
2k views

Porting Avenue code for Producing Building Shadows to ArcPy/Python for ArcGIS Desktop?

Whuber provided an answer at Producing building shadows? which required using Avenue code. Any idea how to make it work in ArcGIS Desktop 10?
9
votes
4answers
4k views

How to Batch Clip in ArcGIS Desktop 10 using Python/ArcPy?

I've come across a few similar questions for older versions of ArcGIS, but haven't found a suitable answer for ArcGIS 10. I have two polygon shapefiles that cover a large area (e.g. an entire ...
2
votes
1answer
2k 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, ...
1
vote
1answer
455 views

Defining multiple projections inside a file gdb [error 000289 failed to alter spatial reference]

I am importing multiple shapefiles into a filegdb in ArcGIS 10, and using the following code to define the projection of the feature once imported, to the .prj of the original .shp file. Here is my ...
1
vote
1answer
498 views

Administrative level and coordinates from Yahoo GeoPlanet WOEID

The Yahoo GeoPlanet data can be freely downloaded from: http://developer.yahoo.com/geo/geoplanet/data/. If I understand it correctly, each WOEID corresponds to a unique location on earth, with ...
3
votes
2answers
256 views

Finding script location… dynamically

Should be a simple question... but those can be the hardest. I have created a script that uses ESRI's arcpy site package and it functions properly in a stand-alone environment. I am now trying to ...
2
votes
2answers
651 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 ...
3
votes
1answer
3k views

How to use ET GeoWizard tools or Xtools Pro in ModelBuilder or Python to automate processing?

Is it possible to use ET GeoWizard or XTools Pro tools in automation of mapping in either in ModelBuilder or Python?
4
votes
2answers
3k views

How to send long JSON objects (polygon geometry, table rows) in POST request to Geoprocessing Service?

I am seeking to understand my options for sending long JSON objects in a request to a Geoprocessing Service. In particular, I am looking for some example code to illustrate how to include two long ...
3
votes
1answer
504 views

import arcpy yields “TypeError: This object does not support enumeration”

Similar to Enumeration Problem with Eclipse and ArcGis 9.3, with Arcgis v10 I no longer seem to be able to run python scripts from a command shell. Entering the same code into an interactive python ...
6
votes
3answers
3k views

need to clear cache memory using python

I have looked at several posts here and on other sites but have not found a solution to the problem I am having with this python script. In this script I use 2 nested 'for' loops to extract a series ...
2
votes
2answers
2k views

Help with ArcGIS10 Python and SearchCursor reading Null values in field

I'm using a Phython script to count the number of unique string values in a feature class. My script works if there are values in the field but if there are any NUll values in the field it crashes. ...
1
vote
1answer
449 views

Passing parameters to PostGIS SQL queries in Python: weird behaviour

The following code always goes to the except section and I do not understand why..Any help would be much appreciated. l = None c = conn.cursor() try: s = "SELECT ST_NPoints(ST_GeomFromText(%s))" ...
4
votes
2answers
564 views

Issues with osgeo - qgis.core and arcpy modules

Is it possible to have the python shell from either qgis or argis to load (import) both qgis.core and arcpy? I am developing a metadata creation tool and have completed the core functionality using ...
0
votes
1answer
405 views

Gdal2Tiles getting tif with dtype = uint8 but want int16

I have a gdal2tiles code for getting tiff file. In my code I am getting true tiff format but it makes my dype uint8. I want int16 for dtype. how can I overcome it? I know I have to add gdal.GDT_Int16 ...
4
votes
1answer
1k views

How to assign OGR geometry a spatial reference when writing to a new layer using the Python API?

I'm using the Python OGR API to add new features to a PostGIS layer. However, despite setting the geometry spatial reference, when the geometry is written out the spatial reference is missing. This is ...
2
votes
0answers
161 views

Is there any way to suppress the calculate field dialog box in arcpy script?

I've got a python script that I inherited. The python script takes input from a variety of feature classes and tables and spit it out to a single table. When I run this script via a scheduling ...
0
votes
4answers
401 views

GIS data - Geoprocessing Service to receive data

I would like to move 8 shapefiles from one intranet to another intranet via arcgisserver (or an other method). Creating a FTP site is not an option. I think I saw somewhere on how to send data to a ...
0
votes
0answers
61 views

Map stack preferences [duplicate]

Possible Duplicate: Comparison of JavaScript mapping libraries? I've spent most of my GIS life doing analysis and 3D stuff and after skirting the edges of web-mapping for a while (using ...
2
votes
0answers
136 views

How to change the QGIS help dialog?

I am working with python plugins for QGIS. I am done with my one of my .py file using python 2.5 and pyqt4. It is just help file for QGIS, which i changed. I wanted to incorporate the same in QGIS. I ...
2
votes
4answers
3k views

How to enumerate ArcGIS Server 10 map services with ArcPy

I need to connect to ArcGIS server with ArcPy and enumerate over map services. I need to: Loop through each ArcGIS server map service Stop/Start the service Get the service source document (MXD/MSD) ...
10
votes
4answers
3k views

ArcGIS 10.0 Python SearchCursor file locking

I have a script that gets a value from a shapefile's field to return to the user. It seems that only when the arcpy.SearchCursor is called ArcMap locks the file and it doesn't get removed after the ...
2
votes
1answer
2k views

Projecting shapefile with transformation using OGR in python

I want to change coordinate system of a shapefile from British National Grid to WGS84 (in order to be able to convert it to KML later on). To get the best results of projecting I would like to use ...
2
votes
1answer
628 views

How to save and reload legend settings using Python?

Maybe you can help me with maybe a strange question. I know how to change settings of a legend individually by arcpy (like: Patch, Title, Items, Columns, Frame, Element Size&Position, etc.), but ...
4
votes
1answer
253 views

Variable XML dataset as reader in FME

I have one problem i am thinking how to solve. My workbench is started from python script. Workbench reads xml file, but name of xml file is each time different. So is it possible to solve this with ...
0
votes
1answer
361 views

Error when using .isalnum in ArcGIS fieldcalculator

ArcGIS keeps throwing an error when I use the following script in the field calculator, using Python: pre-logic script code: y= () if !fieldx!.isalnum(): y= 1 else: y= 0 Fieldy= y The ...
3
votes
4answers
1k views

ArcMap 10.0 Python script tool - Have the script tool dialog box stay open past successful completion of script

Is there a way to have the script dialog box have the radio button that says "Close this dialog when completed successfully" unchecked for any user who runs the script tool? Is there configuration ...
4
votes
2answers
361 views

How to import GDAL in Jython?

I'm trying to use jython with GDAL on Windows. Python and GDAL are installed through MS4W and work perfectly together. Jython is installed manually, but I can not import GDAL. I tried to update ...
1
vote
1answer
7k 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 ...
10
votes
2answers
768 views

Metadata -auto build using python

We have a large (10,000 plus) repository of spatial data (shp/gdb/tab vectors and ecw/tif rasters and also las, xyz and DEM data) where some have metadata records in xml using anzlic metadata editor. ...
3
votes
1answer
3k views

How to set the Output Extent (Environment Setting)?

I'm a bit confused as I'm trying to figure out how to set my output extent before creating Thiessen Polygons in a loop of ~100 points shapefile. (ArcMAP 10.0 - Python) for i in range(3,51,1): ...
1
vote
0answers
104 views

Copied points not intersecting the original points

I'm using an arcpy search cursor to access a Oracle database. I have a simple Python class that I copy the returned row objects into, which gives me more flexiblity than the cursor. The problem is ...
2
votes
2answers
471 views

QGIS 1.7.3 and pyqt4 version mismatch

I installed QGIS 1.7.3 using OSGeo4W installer.I have python 2.7 and pyqt4-py2.7 installed on my system.My system paths are: ...
4
votes
1answer
363 views

Can I delete only tables, or only objects sharing a string of text, from a geodatabase?

I've got about 1000 tables in a geodatabse that I need to delete. They are named IntersectedBuffers_1, IntersectedBuffers_2, etc, and they're the only tables in the database. Could someone please ...
2
votes
1answer
478 views

The minimum bounding circle of geometry that crosses the 180th meridian

Background: I've been given a task where I have to calculate the minimum bounding circle of Alaska (for the purpose of running a Roeck test). I'm using the Census' state level geometries available ...
5
votes
2answers
581 views

Accessing non-spatial PostgreSQL tables using OGR Python bindings

When connecting to PostgreSQL/PostGIS using the OGR Python bindings is it possible to get non-spatial table names (i.e. OGR layers) from the connection? Currently, doing: conn = ogr.Open("PG: ...
3
votes
1answer
687 views

Run FME Workbench with Python

I would like start/run FME workbench from one external python script. Is there some simple syntax/command to do this?
1
vote
1answer
239 views

GDAL Tiling, Missing Tiles

i have used gdal2tiles.py for tiling about 100 tiff tiles which i have generated virtual dataset with gdalbuildvrt for my 1:250.000 scaled maps... everything goes well from 15 to 11, but when it ...
0
votes
1answer
816 views

libmysql.dll-procedure entry point error [duplicate]

Possible Duplicate: How to fix QGIS error “Entry Point could not be located”? I am working with qgis,pyqt4 and python2.5. I was getting error qtcore4.dll could not be located.so ...
0
votes
4answers
399 views

Resolving Arcpy “GetObject not point” Error

I'm new to Python (v 2.6.5) and am trying to write an ArcMap (10) script that reads the vertex coordinates of a polygon shapefile which includes a small hole (doughnut polygon). I've been working ...
1
vote
1answer
10k views

How to fix Qtcore4.dll can't find procedure entry point? [duplicate]

Possible Duplicate: How to fix QGIS error “Entry Point could not be located”? I am working with QGIS, python2.5 and pyqt4 for py2.5. My system variables are as follows: ...