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

learn more… | top users | synonyms

1
vote
2answers
327 views

ArcGIS 10.1: “ERROR 000223: Cannot extract event table properties” when iterating through multiple files/folder

I am trying to convert ~270k csv-files with lat/long-data to layerfiles. The files are split into folders by year, i.e. ~30 folders with ~9k csv-files in each. I have written a script to iterate ...
1
vote
1answer
149 views

How to add attributes to shapefile with Python and pyshp?

I'm using pyshp for creating a shapefile. I need to populate tens of fields with values using the record() method of shapefile.Writer. I have those values as a list, but have no idea how to send it to ...
1
vote
1answer
156 views

Need python code example - setting a combo listbox to Null

I want to be able to set the value of a field to Null using python, but I get an error. I am using arcpy.CalculateField_management Any help would be appreciated. Rob Smith
1
vote
1answer
644 views

GDAL bindings problem with ArcMap 10.1 Python tool

I'm really getting mad with this. ArcGIS sometimes can be so just...irritating! Forgive me if this question is by any means duplicating this one or similar ones, but I really can't find my way out of ...
1
vote
2answers
200 views

access attributes of one class for use in another class in python add-in

I want to get combobox attribute 'dem' and use it for further processing in class ExtentData. But I am not sure how to get attributes from one class to another for processing in pythonaddin. In ...
1
vote
1answer
2k views

Python GDAL: Save array as raster with projection from other file

I have an array of data, and for each datapoint I know the latitude and longitude. I'd like to save it as a GTiff with the same projection as other rasters I have. This is what I've tried so far, but ...
1
vote
4answers
484 views

Get vector features inside a specific extent

The problem: I have a very large vector layer with many features and a much smaller raster layer in a defined region. I want to get only those vector features which are within the raster layers ...
1
vote
1answer
229 views

How to add MS SQL table using python console?

I have MS SQL Server 2008 R2 database. How to add MS SQL Table using python console in QGIS?
1
vote
2answers
157 views

How to handle adding a PostGIS layer in pyQgis without saving password?

I'm writing python plugin and trying to find the right way to add PostGIS layer on the map without storing user password. After adding layer on the map, I strip out the password from uri like this: ...
1
vote
1answer
1k views

Python GDAL: Write new raster using projection from old

If I read in a raster image as an array, then make some changes to the values in the array, how do I then save the array as a raster with the same projection information as the original array? In ...
1
vote
1answer
90 views

GeoDjango - Use GDAL python binding in the shell

I would like to use the GDAL python binding in my GeoDjango site. The aim of this is to use ogr2ogr capabilities in a script. I am on windows 7 so I have installed GDAL-1.9.2.win32-py2.7 downloaded ...
1
vote
1answer
344 views

How to write a CSV from Python console in QGIS?

I am trying to write out a CSV file from a vector layer made up of points using the python console in QGIS. I've tried the following command: QgsVectorFileWriter.writeAsVectorFormat(layer_Map, Folder ...
1
vote
1answer
256 views

How to use QgsOverlayAnalyzer class in pyQGIS?

I am very new to Python scripting in QuantumGIS, so bear with me please. I am trying to use the QgsOverlayAnalyzer class in QuantumGIS (http://www.qgis.org/api/classQgsOverlayAnalyzer.html#details) ...
1
vote
1answer
334 views

Data Driven Pages, Graphs, and selections in ArcMap 10.1

Is it possible in python to create a selection set based on the extent from a Data Driven Page (DDP)? I have a layout view with a map and a graph. The graph is set to only plot the selected set of ...
1
vote
2answers
198 views

Batch set value/calculate field inside Cursor

I am matching data using a cursor, where one of the final steps is filling in a new attribute, match, with a value calculated during the cursor. This matching is done to an ID field in the original ...
1
vote
1answer
127 views

How to use QgsVertexMarker in a python plugin?

I am trying to display a vertex marker for a QGIS python plugin I am writing. I am getting a the following error... 'NameError: global name 'QgsVertexMarker' is not defined' canv = ...
1
vote
1answer
606 views

How do I copy all feature attributes to a feature in a new layer?

I'm trying to create a new layer in QGIS based on an existing layer. The new features should have all the attributes of the corresponding features in the original layer. I've been trying to use ...
1
vote
3answers
128 views

Applying rotation before FeatureToRaster_conversion?

I am converting polygon shapefiles to rasters. With arcpy I am using the function FeatureToRaster_conversion. gp.FeatureToRaster_conversion(InFeatures, InField, OutRaster, InCellSize) This function ...
1
vote
1answer
158 views

Why won't QGIS let me write to a file?

I am writing a QGIS Python Plugin. I am trying to write data to a file using with open("filename.txt", "w") as f: f.write("file text.") QMessageBox.information(None, "Test", "Written to file.") ...
1
vote
1answer
301 views

arcpy JoinField_managment RuntimeError

So, I've been banging my head against the wall the last few days trying to figure out what's wrong with my script. It's suppose to pull weekly flu data from a department of health website, parse it ...
1
vote
1answer
726 views

Error code 500 at REST Endpoint of published geoprocessing service - Problem with output parameter type?

Using ArcGIS 10.1 (Server and Desktop) I've been trying to publish a geoprocessing service based on a python script I wrote. Of course, it all works flawlessly from ArcGIS Desktop but I run into all ...
1
vote
1answer
423 views

How to hide/show QGisVectorLayer from Python code?

Once created a layer, how can I hide/show it? I can enable/disable rendering of a specific layer by selecting the checkbox through QGIS, but I need to do it programmatically from python code. How can ...
1
vote
1answer
404 views

How to change cursor shape in pyQGIS?

I noticed that PyQGis has QgsMapToolPan() and QgsMapToolZoom() functions, and the cursor shape on the canvas will change to a hand (for pan), magnifying-glass(+/-) (for zoomIn / zoomOut). I have a ...
1
vote
1answer
167 views

Why can't I add GlobalIDs to the table and feature classes I created?

I'm creating a script to which make a blank geodatabase with a required dataset, feature classes, tables, subtypes, relationships. I've got everything to work expect for the damn GlobalIDs! I have ...
1
vote
1answer
359 views

How to add a progress bar to a python plugin?

I would like to add some type of progress bar to my Qgis python plugin. Can someone point me to an example?
1
vote
1answer
182 views

Count the number of symbols in a 'new symbology' renderer from pyqgis

Background : I create a lot of symbology using 'saturation' ramps - for want of a better term, e.g. where the hue and value of each symbol stays the same, but the saturation changes. I couldn't figure ...
1
vote
3answers
5k views

Python Script for Select by Attributes taking user input

I am trying to write a python script and create a script tool in ArcGIS that will let a user choose the value or values that will be used to extract a shapefile. These selected value(s) will then need ...
1
vote
1answer
363 views

ogr: how to use epsg database for RD New projection?

I'm trying to assign this EPSG projection to my newly created shapefiles using ogr. The OGR Projections Tutorial says: ...any geographic coordinate system in the EPSG database can be set by it's ...
1
vote
1answer
586 views

How to drop ArcSDE connection using Python scripting?

I want to be able to control connections to ArcSDE via python. Here is my script so far using ESRI's example. import arcpy from arcpy import env env.workspace = r"SDEConnection" fcList = ...
1
vote
2answers
346 views

Cannot get arcpy.MosiacToNewRaster to work with list

Below I have a snippet of a much larger code that I cannot get to work and I am not sure why. It seems that I always have trouble using arcpy functions with rasters. Can anyone help me get this code ...
1
vote
1answer
255 views

Setting Script Tool Parameters Using Python and ArcGIS 9.3.1

Can't quite figure this out and i'm sure it's a simple fix. I have a script that utilizes the AGSSOM tool. It first stops all published services, allows for databases to be tidied up by ...
1
vote
1answer
266 views

Grid labels in ArcGIS, overlapping issues

I do have 3 grids made by Grids menu in data frame properties. I do need them to display in certain layout and also to behave accordingly to couple of rules (overlapping issues), so I can automate my ...
1
vote
1answer
395 views

installing module in embeded python in qgis

I'm newbie to Quantum GIS and Python. I'm using QGIS in windows platform. How I can install module for python embedded in QGIS? Also, how can I run embedded python from windows directly? Thanks
1
vote
1answer
408 views

ReportLab integration into QGIS returns error message “no module named reportlab”

I want to use ReportLab in my own plugin which I have written for QGIS. I have installed ReportLab for the python versions 2.4, 2.5 and 2.6. The package is respectively installed into the ...
1
vote
2answers
918 views

Arcpy Error in adding input field to field map

hi guys i m doing a script in Arcgis i m new to this, i have to append some field from a table to another, i did this script in python but i have a problem when it want make the Mapping field with a ...
1
vote
1answer
119 views

Selection on Feature layer (geoprocessing)

I have a feature layers with states and counties fields. I want to make a selection tool. Tool dialog should have input for feature layer and two drop downboxes for states and counties. When user ...
1
vote
1answer
612 views

Applying layer file not formating labels in ARCGIS 10

I'm applying layer files in ARCGIS 10 using the ApplySymbologyFromLayer_management command via a python script tool. The symbology part works fine but the lables are not formatting. It is my ...
1
vote
2answers
179 views

Toggle editing option in plugins

I am working on python plugins for QGIS.I developed the plugins same as RT SQL LAYER plugins. When we draw the layers using query builder of "Add Postgis Layer" option,toggle editing option is ...
1
vote
1answer
82 views

Filegeodatabase fanout and Python problem

I have fme wb which does fanout with gdb. It means that in the end as output sets of data I get few new created gdb. But If I start this fme wb within python script It does not do fanout. Just write ...
1
vote
1answer
226 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
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 ...
1
vote
3answers
2k views

Error when creating insert cursor in arcpy

I've written several scripts that copy data from MS Access db into a new, empty ESRI Geodatabase. I've pretty much copied the code and changed it for each table -- the first two scripts have worked ...
1
vote
1answer
1k views

How to create multipart line and polygon with interior ring in ArcGIS Python?

My objective is to swap X,Y coordinates of feature classes using Python and arcgisscripting. Based on help examples, I managed to write script which reads and writes all geometry types. The problem ...
1
vote
1answer
474 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 ...
1
vote
1answer
431 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))" ...
1
vote
1answer
6k 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 ...
1
vote
1answer
231 views

GDAL Tiling, Missing Tiles

i have used gdal2tiles.py for tiling about 100 tiff tiles which i have generated virtual dataset with gdalbuildvrt for my 1:250.000 scaled maps... everything goes well from 15 to 11, but when it ...
1
vote
2answers
489 views

Python Mapscript 6.0.1 layer.getShape API

I am attempting to follow the mapscript example described here - http://trac.osgeo.org/mapserver/wiki/RasterQuery but ran into some trouble with s = layer.getShape(result.shapeindex, ...
1
vote
2answers
614 views

Join/Relate in ArcGIS 9.3.1 ArcEditor through a python script - is it possible?

I'm working on a ArcGIS 9.3.1 ArcEditor and I want to write a python script that will do a Join or Relate. Problem is, that join table\join field are restricted to ARCINFO (higher license), and relate ...
1
vote
1answer
525 views

Win7 GRASS 7 & i.landsat.toar

Hello has anyone got experience running i.landsat.toar ? The output files I get are empty, the command takes but a moment to complete. However when run in verbose mode all the calculations are done, ...