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 ...
6
votes
4answers
5k views

Field Calculation - Python - If/Then over multiple data columns

I have some VB code saved that looks at two columns of data, and populates a third with the low value. Pre-logic Script Code: Dim output as double if [MIN_LEFT] < [MIN_RIGHT] Then output = ...
6
votes
4answers
8k views

How do you test for a NULL string field in the Field Calculator with Python?

I am trying to perform an operation on a string field with a condition that it contains data. Referencing None with Python does not appear to work when the field is nullable and contains <Null> ...
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: ...
0
votes
1answer
362 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 ...
4
votes
1answer
529 views

Can you use arcpy.RasterToNumPyArray() to Graph a Raster with matplotlib?

Can you use arcpy.RasterToNumPyArray() to Graph a Raster with matplotlib? I'm looking to graph a raster with X, Y, and Z values in a 3D bar graph. I just can't seem to translate the numpy array to ...
6
votes
2answers
2k views

Segment road network line shapefile into new equal length segments line shapefile

I would like to subdivide a road network for an entire state into segments of equal length. So, Highway X would be divided into 0.5 mile segments, with a record for each segment, and Highway Y would ...
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 ...
6
votes
1answer
384 views

Is there a GeoDjango tutorial for GeoRSSFeeds?

I'm going through GeoDjango basics right now. Ideally, I'd like to publish a GeoRSS from a set of data I have that is already in Django's database. I know how to get a regular Feed working, but when I ...
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. ...
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

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 ...
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 ...
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 ...
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
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 ...
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 ...
19
votes
5answers
3k views

How to use ArcGIS functionality in Python without running ArcMap (e.g. separate editor/environment)

I'm trying to take the next step in programming ArcGIS with Python and see if its actually possible to run my script/code without having to load ArcMap and paste them into the Python window. I imagine ...
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 ...
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 ...
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 ...
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 ...
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 ...
2
votes
1answer
597 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 ...
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, ...
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 = ...
4
votes
3answers
2k views

Why would “import arcpy” hang Python script run from DOS/cmd prompt?

I have a very small test script (test.py) that I use to see if Python is installed and ready to use ArcPy. All it contains is: print "Starting" import os print "OS imported" import arcpy print "ArcPy ...
5
votes
2answers
270 views

Finding Raster Overlap within a Directory

Here is the scenario: I have a directory with 100+ map projected, single band, rasters that weighs in a 40GB+. I have used ArcMap's built-in mosaicing tools to create a raster mosaic. I am using a ...
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 ...
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 ...
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 ...
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 ...
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
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) ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
1
vote
1answer
617 views

How to change the the style of a vector layer programmatically?

I want to change the style of the polygon contained in the vector layer. Is there any API available? (I can click the properties of the shapefile, then select the style and change the symbol ...
2
votes
1answer
630 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
254 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 ...
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 ...