Questions tagged [python]

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

Filter by
Sorted by
Tagged with
3
votes
3answers
2k views

Adding shapefile directly to geoserver

I have py script which is creating shapefiles using shapefile.py. Once the shapefile is created I have to add them manually to the geoserver. Is there a way to add it dynamically to the geoserver? ...
1
vote
1answer
360 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 remains ', ...
1
vote
1answer
163 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 ...
11
votes
5answers
10k views

How to workaround large mosaic process which is failing?

I need to mosaic about 550Gb of tif imagery together and the software I have tried keeps failing. The area has been split into zones so that the smallest has approx 200 tiles. I have used the latest ...
14
votes
4answers
9k views

Exporting features with attachments for use outside ArcGIS?

ArcGIS 10 features the new ability to add attachments to individual features to feature classes stored in a geodatabase. One use of this would be to add multiple pictures to a specific location, fire ...
6
votes
2answers
3k views

Big satellite image processing

I'm 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 ...
1
vote
1answer
3k 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. Here's ...
3
votes
1answer
417 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 ...
3
votes
2answers
1k views

Python Widget Wrapper to extend basewidget class in ArcGIS Viewer for Flex?

I'd like to create a flex wrapper for python code run locally (utilizing arcgis data and outputting data that can be displayed on the flexviewer). I'd like to use gdal or pyproj modules to process ...
6
votes
3answers
5k views

Saving *.dbf as *.xls using Python?

I've been let loose in the workplace to learn python to do things in Arcmap 10. so, I am learning python as I go and trying to remember the programming I have done. Where I am in this project is ...
2
votes
2answers
2k views

Moving all shapefiles (SHP) in MXD to new File Geodatabase (*. gdb) using ArcGIS Desktop?

What I need to do is to move all the shapefiles in an mxd into a newly created gdb, checking prj, and update mxd reference. I have ArcGIS 10 SP4, license ArcView. I studied a bit of Python and get ...
3
votes
2answers
851 views

Adding VBA into a Python script generated by ModelBuilder

I have created a model that does a calculate field and have used VBA in the code block. But when I export it to Python, it doesn't work. Here is the VBA code: new_value = [HDATA_N_LAREF_ACTIVITY_TEXT]...
1
vote
2answers
1k views

ArcGIS problem accessing fields attribute table

I encounter a strange problem. I have a simple shapefile to which I added some fields and then populated them. Now I want to access those fields from a script to run some buffer operations. I want ...
6
votes
2answers
12k views

Convert specific RGB (GeoTIFF) color to transparent

I have an RGB GeoTIFF file and I want to convert a specific RGB colour to transparent. I would like to use GDAL for doing this, but external Python scripts are also an option (though I haven't learned ...
4
votes
3answers
4k views

How to truncate file geodatabase tables with Python?

I need to truncate file geodatabase tables (1 or all) with Python. What is the code for that?
5
votes
1answer
1k views

Using group by to set a PostGIS datasource using QGIS Python API

I am writing a QGIS Plugin and wish to obtain data from a PostGIS table using the Group By clause using something like the following code: uri = QgsDataSourceURI() uri.setConnection('localhost', '...
4
votes
1answer
1k 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 ...
52
votes
3answers
19k views

Smoothing polygons in 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 ...
8
votes
5answers
8k views

Copy file geodatabase 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?
2
votes
0answers
206 views

How to Auto Increment Attribute Based on Nearest Point? [closed]

An authority I am working with would like their Hydrants, a point shapefile, to be renumbered based on their location. I am looking for any python script that would help me A. Find the next closest ...
4
votes
1answer
696 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 = QgsRasterLayer(fileName,...
2
votes
2answers
1k 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, ...
1
vote
1answer
2k views

Scipy: Convert RGB TIFF to grayscale TIFF and output it on Matplotlib

I want to manipulate RGB bands in a TIFF file and output the grayscale map on matplotlib. So far I have this code, but I couldn't get it on grayscale: import scipy as N import gdal import sys import ...
2
votes
1answer
7k 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'] == ...
3
votes
1answer
184 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 ...
2
votes
1answer
649 views

can't generate/display signed float values using python/gdal

I'm trying to create a raster with signed float values as the pixel values and display the results in MapWindow on windows. What is the proper gdal band type to use? I've tried both gdal.GDT_Byte ...
1
vote
0answers
145 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 ...
2
votes
1answer
2k views

How to use SQLite db with QGIS plugin?

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 compiled the resorce.qrc file, ...
9
votes
1answer
2k 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
1answer
958 views

ImportError: cannot import name QgsVectorFieldSymbolLayer

I am using QGIS 1.7.4., downloaded April 2012, but receive an import error loading the class QgsVectorFieldSymbolLayer. As i understand this class has been added in the Python bindings on 2011-11-15. ...
3
votes
1answer
1k 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
497 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 ...
3
votes
1answer
900 views

Hyperlinking in QGIS - Add Data to current window

I am looking to add to my current action in QGIS so that a hyperlinked file will open in the current QGIS window, rather than in a new window. Here is what my action looks like: "C:/Program Files (...
0
votes
1answer
387 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 start ...
0
votes
1answer
1k 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 here....
1
vote
1answer
2k 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 ...
2
votes
1answer
444 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 ...
4
votes
1answer
417 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 ...
2
votes
2answers
1k views

Zoom to selected feature, without using 'current' in ArcPy?

I am wondering if it is possible to build a zoom to geoprocessing service without using 'current' for the MXD variable in Python? Using 'current' my tool works in ArcMap, but not in my geoprocessing ...
2
votes
1answer
233 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 ...
5
votes
1answer
14k 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 ...
31
votes
10answers
15k views

Seeking Python tools/modules/add-ins for 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 ...
3
votes
1answer
745 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
7k 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), ..., (...
3
votes
2answers
386 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 ...
3
votes
1answer
454 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
4answers
6k views

How to connect the selectionChanged signal with pyqt?

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 I ...
3
votes
1answer
498 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 ...
4
votes
3answers
9k 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 (...
4
votes
1answer
510 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 ...

1
156 157
158
159 160
166