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

learn more… | top users | synonyms

2
votes
1answer
211 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
0answers
183 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
221 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 ...
2
votes
2answers
703 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. ...
2
votes
1answer
210 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 ...
3
votes
1answer
4k 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 ...
20
votes
11answers
5k views

What are the Python tools/modules/add-ins crucial in GIS?

With ArcGIS 10, Python has become the de-facto scripting language for ESRI. While leading Open source software like QGIS, GeoServer, PostGIS all supports Python. Thus it became important to know/learn ...
1
vote
1answer
93 views

Other than the methods stated on the Desktop 10 Sharing Tools section, are there any other ways to distribute custom toolscripts?

Essentially I want to be able to distribute a custom script and it seems that I cannot create a .tbx file, so I looked into the other methods, but they are all only for Python modules it seems. What I ...
3
votes
1answer
551 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 ...
7
votes
2answers
3k 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), ..., ...
0
votes
2answers
270 views

extract edge of a line of a vector layer in a new point layer [closed]

I'm using python to build a plug-in in Qgis. I need to extract the edges of each line feature of a vector layer to create a new point layer of all edges. Someone can help me? My data input is a vector ...
3
votes
2answers
177 views

How can I read the settings for the QgsPaperItem from XML?

I saved a template qpt for the map composer and now I want to read all the settings. I am able to insert the items with composition.addItemsfromXML... But this doesn't load the settings for the ...
2
votes
1answer
365 views

How to add Real Attributes to Shapefile using pyqgis?

I created the Qmarxan plugin using the fTools plugin as an example base. When I create a new shapefile using the QgsVectorFileWriter function I don't have any difficulty specifying a "Real" field with ...
1
vote
3answers
1k views

How to connect the selectionChanged signal with pyqt?

Hi I am developing a plugin for Qgis in python, I need to connect the sselectionChanged signal emitted when a feature of the layer is selected, I could not find any examples on internet, here is what ...
4
votes
5answers
617 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 ...
2
votes
1answer
228 views

iterating and exporting all combinations of features as shapefiles

I am trying to export individual shapefiles of all 2 pair combinations from a multi-feature polygon shapefile. To explain this better as set of FID's 0, 1, 2, 3, 4 would be exported as individual ...
3
votes
3answers
5k 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 ...
1
vote
1answer
262 views

Small issue with field calculator

What am I doing wrong in this field calculator logic? Pre-logic def re_score(elev_t,f2, contour): f2=contour if elev_t.endswith('.5'): f2 = "Midi" return f2 Expression for field "Contourtyp" ...
4
votes
1answer
289 views

geodjango slowness and debugging

I'm using geodjango + postgres to display polygons from tigerline on a map. Pretty simple stuff so far. My issue is that when I use the GPolygon object: django.contrib.gis.maps.google.GPolygon there ...
2
votes
3answers
2k views

Qgis Python code library documenation.

I'm looking for python documentation for specific operations in the Qgis python console. I know there is no suggestions simular to Arcpy but I would like a pure list of operation code lines as ...
1
vote
2answers
937 views

arcpy.Delete_management not deleting

I'm struggling with deleting an mxd in a for loop. My code is: import arcpy, glob, os, datetime, time from time import strftime for filename3 in glob.glob(os.path.join(folderPath, ...
1
vote
1answer
238 views

Index out of range error when cleaning up variables

I'm running a script that parses points from a flat database structure into individual feature classes with related tables. A search cursor runs through and stores each field's data in a variable ...
4
votes
3answers
1k views

Using threading module with Arcpy: Manager/Worker architecture

I asked this question on Stack Overflow on how to setup a manager/worker scenario. But I am getting some error when trying to use threading on my Python install with ArcGIS 10 (just the python ...
2
votes
1answer
350 views

Use arcpy.SearchCursor with raster

How can I efficiently subdivide one raster into multiple rasters using the arcpy.SearchCursor? For example if I have a slope and I was to subdivide into 3 rasters: slope1 with values between 0 and ...
2
votes
0answers
160 views

Are there Plugin Compatibility Issues between QGIS 1.6.0 and 1.7.4?

I've been working on a QGIS plugin on Quantum GIS 1.6.0 Copiapo with Python 2.5 that calculates additional values for eachf feature of a vector layer and adds them to the .dbf. We've just upgraded to ...
5
votes
4answers
5k views

How to import qgis.core to python app?

I'm new to Python. I want to create GIS app with Python using QGIS library on Window 7 64bit. The way I do: install QGIS 1.7.0 I set PYTHONPATH=D:\Program Files (x86)\Quantum GIS ...
8
votes
2answers
3k views

How to Rotate Features in ArcGIS for Desktop using ArcPy?

I have a series of polygons that I want to rotate. Each polygon has a rotate angle and an anchor point (xy coordinate) stored as field values. As it happens, all anchor points are on a vertex of ...
5
votes
0answers
645 views

How to get rpy2 for QGIS on OSX?

I am a new QGIS user, have installed QGIS on a Mac running Snow Leopard OSX 10.6.8 following all the instructions. QGIS seems to work well for everything other than when I boot up I get the message ...
4
votes
1answer
1k views

Sorting a table on multiple fields using ArcPy

I'm trying to sort a table based on three fields with ArcPy (which should be only one line of code), and I had a "tool is not license" error. I just saw that sorting with multiple fields as parameters ...
0
votes
1answer
2k views

How to find Q in m3/sec from a raster having Q in mm for hydro power calculation

I am having a raster file with runoff depth Q in mm which was obtained from SCS method. I want to calculate hydro power potential at any location on my DEM. In the formula Q is in m3/s but we are ...
2
votes
3answers
1k views

how to extract a rectangle corner coordinates in python script

i want to extract a rectangle corner coordinates of a shape file in python script..please suggest me a solution. Thanks in advance, Bhavya
4
votes
1answer
724 views

Iterative position within Field Calculator/Python

I'm not great with Python or programming in general, so I'm not even sure how to ask this question. Basically what I've got is in the left column, and what I want is in the right column. UniqueID ...
2
votes
1answer
2k views

Error getting while creating new field to a shape file table

i am getting the error for following code to add a new field to a shape file table. from osgeo import ogr # Open a Shapefile, and get field names source = ogr.Open('my.shp', 1) layer = ...
1
vote
1answer
149 views

How to select and update from multiple tables?

I have two feature classes which have common Valve ID #s. One table has multiple service connections with a unique number. I need to select all services linked to each valve and collect the ...
3
votes
1answer
514 views

How Can I Calculate Time from Coordinate?

For my application I am searching for an API or an algorithm for clicking point time and time zone. I dont know how I can do this but after getting time I want to calculate giving coordinate sun ...
2
votes
3answers
3k views

Using if/elif/else statements in ArcGIS Field Calculator?

I have no experience with Field Calculator in ArcGIS 10. I have a very simple calculation I would like to perform that I could do easily via pure SQL but just can't seem to get my head around it in ...
2
votes
2answers
299 views

What are my hosting options for an app that needs tilestashe along side a django app?

I'm building a GIS webapp that uses tilestache to serve MBTiles and a django app to serve geoJson. I'm having trouble understanding exactly what kind of setup I'd need to host this. I'm new to server ...
2
votes
2answers
2k views

Running Different Versions of ArcGIS and Python?

As we know, there are few versions of ArcGIS (9.x,10) and Python(2.x,3.x) are in use. Issues are facing when we run scripts/toolbox of arcgis since the script written in one version of python and the ...
5
votes
1answer
825 views

Wrap GEOS functionality into python

I've been looking on how to get GEOSExtractLine available in python. I looked into Shapely source to if it was available for it, but it's not. I'm trying to wrap this funcionality into Django, much ...
2
votes
1answer
605 views

How to switch to a GDB created in the middle of a script

EDIT: Here's my full script and hopefully a better way of explaining what I need done: #Import import arcpy, sys, os # Set environment settings arcpy.env.workspace = sys.argv[1] inFiles = ...
0
votes
1answer
530 views

ArcGIS: Extracting data from large intersect dataset

I have a big dataset imported into ArcMap. For each point, I created a buffers of 200m. And I apply Intersect to all the buffers, resulting in a huge dataset of around 2183962 objects. Previously, I ...
0
votes
1answer
522 views

Trying to make xml data readable for Arcgis

I am trying to convert xml data into tabular form for the process of geocoding. We have the xml file with info that we are going to run through an address locator. Do I need a script for this? Can ...
2
votes
0answers
252 views

Recalculate Quantile Breakpoints in CalculateField_management loop?

I have a program that iteratively replaces a temp field where I choose a certain symbology (color ramp and quantile color break methodology) with a few other fields from a join. The program works in ...
2
votes
1answer
623 views

Attribute Table Decimal Places

As we all know, the attribute table field properties has number format to display number of decimal places to up to maximum 15. If we have many fields/columns in attribute table, how can we change all ...
3
votes
1answer
2k views

Use ArcPy to rename MXD layers

I have a MXD with some layers that have parentheses in them. I'd like to rename them via script. Is this a valid approach? import re map = arcpy.mapping.MapDocument("CURRENT") layers = ...
3
votes
2answers
6k views

Using conditional statements in Field Calculator

I have two fields, "P_Area" and "PC_Area", whose sizes I'd like to compare in a third field, "Areas_Equal". The "Areas_Equal" field should contain a "Yes" if the other two are equal and a "No" if they ...
9
votes
7answers
3k views

how to overlay shapefile and raster?

I have a shapefile with polygons. And I have a global raster file. I want to overlay the shapefile's polygons onto the raster grid and calculate the mean raster value for each polygon. How can I do ...
2
votes
2answers
793 views

r.mapcalculator and python again

I've been trying to write a script creating binary maps: a=raw_input ("enter a threshold") b=float(a) grass.run_command('r.mapcalculator', formula="**'base_map'>=b**", outfile='map'+str(a), ...
3
votes
1answer
1k views

Sorting shapefile records on attribute to update new rank field using Python?

Basically, I am trying to sort the records within the shapefile based on an attribute(eg: pop) and then add a new field that indicates ranking based on the sort. eg: the record with the highest pop ...
2
votes
1answer
524 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 ...