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

learn more… | top users | synonyms

1
vote
1answer
719 views

Dynamic Text in ArcMap 10.0 and arcpy - getting user name in specific format

I need to put in a specific text into a text element. The initials of the user who built the map. With arcpy I am trying to set the text element with dynamic text. If I put <dyn ...
1
vote
0answers
397 views

How do you convert a bounding box into the canvas CRS?

I need to convert the pixel coordinates of a bounding box to the same CRS being used by an existing layer. Here's the relevant code so far: # First, get the layer-coords version of the bounding box: ...
16
votes
2answers
3k views

How to find the angle between intersecting features in two featureclasses?

I have two intersecting line featureclasses. I want to find the angle at each point of intersection using ArcGIS 10 and Python. Can anyone help?
6
votes
2answers
1k views

Creating geodatabase from CSV using python

I have a file with weather data (daily) for multiple weather stations for multiple years. I am looking for some python script to automate the database creation process and its interpolation on a daily ...
9
votes
2answers
2k views

Error handling with python script in ArcGIS 10

I have a python script that I am using to create a list of all mxd files (with full pathing) in our Projects folder. The script then uses that to iterate through the list and do a ...
2
votes
2answers
1k views

With Python and ArcGIS, how do I add features to a featureclass?

In ArcGIS Python code: CopyFeatures_management copies features to the same featureclass - that means overwrite to the feature class. How can I add new features to one featureclass or namely different ...
7
votes
6answers
15k views

How to get X Y coordinates and cell value of each pixel in a raster using Python?

I’m really new to Python and I would like to know whether there is a quick method to get cell values of a raster pixel by pixel and the coordinates (map X Y coordinate of centre of each pixel) using ...
1
vote
0answers
130 views

Is Django's LayerMapping capable of putting a static value into all features?

I'm using GeoDjango's LayerMapping utility to try and import a set of features. The catch is that aside from the attributes in the source layer, I want all the destination features to have the same ...
0
votes
0answers
151 views

How to enable user to specify field mappings from a table joined to a feature class?

I have a feature class and a new table every few days. I need to have the table's attributes added to the feature class based on a join. What would be a good interface in ArcMap to let the user map ...
2
votes
2answers
1k views

Using newline/page break tag in ArcGIS Desktop Text_Element in arcpy.mapping? [duplicate]

I want to update a Text_Element with a newline or page break using ArcGIS Desktop 10.0. Does anyone know the tag or syntax?
5
votes
2answers
927 views

Python: How to export Shapely objects to DXF file

Using shapely package for Python how to export the resulting shapely objects such as buffer to a DXF file?
5
votes
3answers
4k views

Select Layer By Attribute using loop

I have 273 features in the feature class and i want to select them one by one and use the statement in the following code. At the line: *arcpy.SelectLayerByAttribute_management ...
5
votes
1answer
2k views

How to set QGIS Python path so that I can use system packages on Windows?

Several Python packages are best installed with a Windows installer. But those installers install to the system-wide Python directory. How do I set the Python path in QGIS? I tried setting PYTHONPATH ...
3
votes
1answer
435 views

Spatial Interpolation Methods like PRISM

I am looking for some kind of software (free software) that allows me to make an interpolation like PRISM software. The interpolation used in PRISM is a local regression and accounts for ...
10
votes
2answers
2k views

How do you delete an in-memory Table View?

In a Python script, I'm cycling through thousands of Excel files and using arcpy.MakeTableView to create in memory table views from the first spreadhseet in each file. How do you delete the reference ...
5
votes
3answers
423 views

QGIS Gazetteer query without adding data to canvas

I have a PostGIS database with 30 million gazetteer points, each have an X Y coordinate. I want to query this and then zoom map to location. However, I dont want to add the data to the project because ...
3
votes
2answers
6k views

select column in csv file in Python

I would like to study a range of data using the same technique in ArcMAP (it will take too much time to do it one by one ;) !). I've been just recently playing with ArcMAP and Python (which can help ...
7
votes
1answer
2k views

Python-arcpy : How make feature list from gdb and value list from field and use them in gaLayer function?

I'm not an expert in python, however I have to write a script to do geostatistical analyses with the GACreateLayer function from Arcgis. I have several data (>2000) and I want to use list of features ...
3
votes
1answer
242 views

Best Method for Validating polygons?

I would like to assess the spatial accuracy of a load of polygon shapefiles which are supposed to show air quality for a bunch of countries. Firstly I want to assess whether each shapefile has a ...
2
votes
2answers
296 views

Is code completion available in QGIS Python Console?

I wanted to know if the autofill functionality is available in the python console for QGIS as the one available in ArcGIS Desktop's Python Console or am I supposed to hardcode it.
1
vote
2answers
748 views

Resources for python scripting [duplicate]

Possible Duplicate: QGIS tutorials and resources I would like to know regarding the available resources for starting to learn about python scripting for QGIS.
1
vote
1answer
439 views

Gdal tiling error for EPSG: 3857

i have lots of data which was coordinated with gdal some programatic way at below: gdal_translate -of GTiff -a_ullr %s %s %s %s -a_srs EPSG:3857 %s/%s %s/%s.tif then for tiling them all i am ...
0
votes
0answers
262 views

Missing QGIS python plugin database connectors

I am working with python plugins for QGIS.I developed my plugin and inorder to incooperate the same into QGIS i copied the folder in C:\Documents and Settings\comp90\.qgis\python\plugins I opened ...
1
vote
0answers
178 views

I am getting a blank layer preview from geoserver after Quick Exporting my shapefile to postgis and then getting postgis to point to geoserver [closed]

What could be the potential problems? Looking at the layer's data fields/form the one thing that isn't filled is the Native SRS and its source, but I have already passed in the projection info as it ...
2
votes
2answers
367 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 ...
-1
votes
1answer
128 views

GeoPortal Managing Tool [closed]

i know in this site everybody more or less have been setup a geoportal for showing their basemaps and analysis on local or net for their workers or conserned people in the net. it is obvious that in ...
4
votes
1answer
1k views

How to list all of the contents of a geodatabase with arcpy?

This seems like a simple problem, but I have not found a way to accomplish it. I am writing a script that needs to record the paths of everything inside of a geodatabase to a text file, and later copy ...
9
votes
2answers
2k views

Is it possible to get the EPSG value from an OSR SpatialReference class using the OGR Python API?

When reading a layer from a OGR PostGIS connection I can get the SpatialReference of the layer, but is it possible to get the EPSG value? Is there any documentation on this? For example: lyr = ...
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
963 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
480 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
386 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
556 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
460 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
501 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
652 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
450 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))" ...