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

learn more… | top users | synonyms

3
votes
3answers
4k views

Add feature layer to display with in a script tool for desktop mapping 'App'

The point of this question is to find a way to programatically change the map extent based on user input. My method involves creating a Feature Layer & Selection, but if you have another ...
6
votes
1answer
447 views

Use Python to find the pathname of “Current” Arcmap

I am trying to find the path name of the current ArcMap document that the python script is currently running in. For Example: "F:\2012\1111\MyArcMap.mxd" I tired using sys.argv[0] as shown ...
3
votes
1answer
451 views

Is it possible to use Python to perform network analysis on only part of a network?

I have a large network dataset and want to perform an analysis on it which would output the start/end point, the distance between them and whether they're first, second or third (etc.) nearest ...
3
votes
1answer
849 views

Get a pixel value

How can i do this operation: I want to get a pixel value fro the satellite image (Landat, GeoTIFF, 7 bands) using qgis-python. What operators should i use? (for example in qgis's Python Console) ...
4
votes
1answer
692 views

Find distance and heading from a point to a polygon in lat, lon coordinates

I have counties mapped using polygons in Shapely with latitude/longitude for coordinates. Given a complex polygon x and single point y, how would I find the shortest distance between x and y as well ...
1
vote
1answer
230 views

Using Python in Arcmap to partition strings [closed]

I have a title "Text that remains Proposed Thing to replace" var_a = New Text I want the output to be "Text that remains Proposed New text" Currently outputs this "(u'Text that ...
1
vote
1answer
143 views

Button that allows project search and zooms to site once executed

I am trying to create a button that will execute a Python script. I have limited Python experience. What we are trying to accomplish is to recreate these steps: Query on project Site and Radius ...
6
votes
2answers
1k views

Big Satellite Image Processing

Im trying to run Mort Canty's http://mcanty.homepage.t-online.de/ Python iMAD implementation on bitemporal RapidEye Multispectral images. Which basically calculates the canonical correlation for the ...
2
votes
1answer
464 views

Removing duplicate features in PyQGIS

I'm trying to remove duplicate features from PyQGIS. Manually I can do it by using "Edit -> Merge Selected Features" and then "Multipart to Singlepart" from fTools in QGIS, but can this functionality ...
1
vote
1answer
730 views

The table was not found error - ArcGIS 9.3.1, Python

I have a python script that does the following on multiple tables maketableView - not shown in code Addjoin Copyrows MakeTableView it was working ok, until all of a sudden it stopped. Heres ...
3
votes
1answer
204 views

Problem with precision when convert from WKT to shapefile

I have a problem with converting from WKT to shapefile in pygdal. In wkt I have fields with precision (for example real 7.2). When I create a shapefile I have field numeric with no precision (numeric ...
35
votes
1answer
4k views

How to smooth the polygons in a contour map

Here is a contour map for which all the polygons of levels are available. Let ask how to smooth the polygons keeping all vertices preserved in their exact locations? Indeed the contour is made on ...
3
votes
1answer
172 views

How to unload() a plugin in QGIS 1.7?

I am writing a python plugin for QGIS 1.7 (started it on QGIS 1.6 but switched to 1.7 recently). Since I switched to 1.7 my unload function doesn't seem to be working anymore. Whenever I implemented ...
1
vote
2answers
751 views

How to automate relative filepath when adding a new toolbox to the arcmap catalog?

So I'm creating an arcpy script for a custom toolbox and I want to make it so that a user can essentially utilize the script in that toolbox without having to change the source path (which I made ...
5
votes
2answers
897 views

How to check if domain already exists?

I am trying to check the existence of domains in my file geodatabase which contains 4 domains (automatically populated after I created some annotation feature classes). My code is as follows: import ...
0
votes
1answer
214 views

Insert cursor raises exception on geodatabase

world, I'm having trouble to insert a line geometry into a personal geodatabase (using Python/ArcGIS 9.3.1). Everything works fine if the target feature is a shapefile. My guess is that calling: ...
4
votes
2answers
2k views

Check if shapefiles exists in folder

In ArcGIS modelbuilder I want to check if a shapefiles exists, if not I want to create the shapefile in that folder. I guess the calculate value tool within ArcGIS modelbuilder can be used, but I need ...
2
votes
2answers
842 views

Having trouble getting specific items from a list. What am I doing wrong?

I am a total beginner when it comes to python. I received some help already getting this code started but I hit a wall. I have a directory with 200 folders, each with a geodatabase, feature dataset, ...
2
votes
1answer
823 views

How to use SQLite db with QGIS plugin?

Hi I would like to use SQLite for storing some information in my plugin for QGIS. I have a problem: if I put the db let say test.db among the resources as file, after compilied the resorce.qrc file, ...
3
votes
1answer
476 views

Batch clip feature class to preserve area field

I have a large land cover map in a geodatabase, that I want to batch clip by defined catchments (about 63 polygons). The output files are named based on a field in the "clipper" (sys.argv[2]) called ...
3
votes
2answers
2k views

Batch Processing 400 MODIS HDF4 Files Using Several Tools In ArcGIS 10

This is my first post, I hope I don't screw it up. We have about 400 MODIS HDF4 files we are looking to batch process in the ArcGIS 10 or Python environment. The tools we are looking to use are ...
0
votes
5answers
1k views

How to copy a fgdb using Python?

I am trying to copy fgdb from one path to another using Python. copy(base.gdb,dest) And got the message: Error Info: [Errno 13] Permission denied: How to fix it?
1
vote
1answer
576 views

How to translate ESRI cursor example to pyQgis?

For example, how to translate this code into pyqgis? rows = gp.UpdateCursor("D:/St_Johns/data.mdb/roads") row = rows.Next() while row: row.buffer_distance = row.road_type * 100 ...
2
votes
2answers
638 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 ...
1
vote
1answer
906 views

ArcGIS Python Script Tool Validation: Control Overwrite Behavior

I'm creating a script tool to read the USGS earthquake GeoRSS feeds. It works fine as a script with hardcoded values. The script also works fine as a tool for creating a new feature class for a given ...
3
votes
1answer
326 views

How to move Layer to back?

from my Plugin I've loaded a rasterlayer using the following code: fileName = "/path/to/raster/file.tif" fileInfo = QFileInfo(fileName) baseName = fileInfo.baseName() rlayer = ...
3
votes
1answer
977 views

How can I create an empty feature class in a file geodatabase based on the schema of an SDE feature class?

I have 150+ feature classes in SDE for which I need to create an empty feature class in a file geodatabase. For these feature classes I need to import the attributes and the name of the feature class ...
1
vote
1answer
3k views

UnboundLocalError: local variable 'x' referenced before assignment

I am trying to execute this code, import osgeo.ogr def findPoints(geometry, results): for i in range(geometry.GetPointCount()): x,y,z = geometry.GetPoint(i) if results['north'] == ...
2
votes
2answers
1k views

Modelbuilder: Needing to input multiple featureclasses into merge tool

So I have 490 point fc's in a single directory with uniform spatial features, field names/datatypes. I'm trying to figure out how to consecutively input the first seven fc's into the merge tool, ...
0
votes
1answer
808 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 ...
2
votes
1answer
147 views

Any reason NOT to convert to a single projection when loading GIS data?

I have been given the task of: Loading a list of properties with lat/long coordinates into a SQL Server 2008 database. Loading points and areas (polygons) of interest from a variety of shapefiles ...
1
vote
0answers
402 views

how to create shape file table from text file in QGis python

I have a text file with all field information how can create new polygon shape file table with the text file.. text file having following content.. NAME LAYER GM_TYPE KML_FOLDER ID PERIMETER ...
3
votes
1answer
536 views

Raster data array output flipped on x-axis using python/gdal?

I'm trying to create a raster using the python gdal libraries and I've gotten to the point where data is being output, but the output data is flipped on the origin point's x-axis. I know I must be ...
1
vote
0answers
113 views

refactoring an XSLT processor with minor changes

having an extremely large xml-file - which is derived from the field of geo informatics. i got it from a German subsite or the OpenStreetMap-Project: the Geograpical-Engineering-site that deilvers a ...
3
votes
1answer
833 views

Select Layer by Location Produces Empty Output in Python

I am new to using Python scripts to execute ArcGIS tools. In my first script I am attempting to loop through many Select Layer by Location operations on overlapping feature classes. I want to create a ...
1
vote
0answers
147 views

Polygon symmetry detection

I was wondering if there was any way to create main axis (axis of symmetry) lines for polygons. I have polygons that represents buildings. I will want to find main axes (axis of symmetry) for those ...
1
vote
1answer
227 views

ArcPy: Creating weekly-sum layers by summing field values from seven consecutive daily .dbf's

So I have 490 consecutive daily rainfall shapefiles/.dbf files in a single directory. Each consists of a uniform even-spaced grid of 220 points having uniform pointIDs, number of records, field names ...
3
votes
2answers
814 views

Unzip a file using python caller in FME 2011

The idea is to download a zipped file from a website and unzip it using FME 2011. I have attached a screenshot of FME workbench which is not working. Any help is greatly appreciated. Thanks. Sam
0
votes
1answer
354 views

Python Field Calculation [duplicate]

Possible Duplicate: Iterative position within Field Calculator/Python I need to calculate a field for a data set that is grouped by county. At each change in county I need the column to ...
0
votes
1answer
595 views

Installing GCC correctly

I'm writing this as an utter Ubuntu newbie. I want to run the script found on Save points to a shapefile with GDAL. But I get the following error, yes this error is similar to the question posted ...
1
vote
1answer
1k views

How To Add Values to an Attribute Field Based on a Selection - Python

Alright another problem that I have. I am trying to give a priority ranking to lots based on various criteria. Basically I have 7 areas that are criteria, if lots overlap each other the criteria is ...
1
vote
1answer
285 views

Arcpy ChangePrivileges_management not working

I was trying to revoke access for a user using Python script, but it does not seem to work. I mean the script runs successfully without any error, but does not what it's intended to... Here're the ...
2
votes
1answer
184 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 ...
6
votes
2answers
2k views

Point-in-polygon using Python and OGR

I want to use OGR in Python to write a simple point-in-polygon test: def point_in_polygon(point, polygon): """ point : [longitude, latitude] polygon : [(lon1, lat1), (lon2, lat2), ..., ...
2
votes
0answers
148 views

Setting border-style to 'no pen' using QgsGraduatedSymbolRendererV2

I am developing a QGIS plugin that, after a series of inputs, will produce a thematic map using the QgsGraduatedSymbolRendererV2. Because the polygon are very small, the boarders make it such that ...
1
vote
1answer
212 views

Python27 in Quantum GIS is missing SQL drivers in PyQT4

I am developing a QGIS plugin and need to create a table view in my GUI that I have been designing with QT Designer. I have PyQT4 installed but I have noticed that I have 2 Python directories. I have ...
3
votes
1answer
3k views

How do I rotate the polygon about an anchor point using python script?

I know there would be no tool in arcpy module as such but mignt have in third party modules. I however tried taking the vertices of the polygon and moving using the below formula. but did not get the ...
2
votes
2answers
603 views

Zoom to Selected feature, without using 'current' in python

I am wondering if it is possible to build a zoom to geoprocessing service without using 'current' for the mxd variable in pyhton. Using 'current' my tool works in arcmap, but not in my gp service. ...
0
votes
1answer
256 views

How to use the transformer KMLRegionSetter ? (Python/FME)

I use Python and FME. I would like to use a transformer "KMLRegionSetter_2" for KML file. I use a fmi file for the transformation. reader=FMEReader("OGCKML",{'USER_PIPELINE':"C:\\arcfactory.fmi"}) ...
4
votes
5answers
546 views

Can a new point automatically be populated with data from the containing polygon

I need some help to create a script. Imagine that I'm using 3 shapes: 1 point and 2 polygons. When I create a new point I want it to assume some attributes of the polygons in which that point is ...