A version of the Python programming language
0
votes
0answers
11 views
Change directories to access different files within Python Add-In [migrated]
This might be a general programming question but since I am doing it from within an Add-In therefore asking here at GIS forum. I have a project folder with sub-folders containing several files on my ...
1
vote
1answer
25 views
mosaic raster to file geodatabase yields missing raster sections
Since upgrading to ArcGIS 10.1 (SP 1) from 10.0, I've been encountering an issue when running the arcpy.MosaicToNewRaster_management() tool with output to a file geodatabase. I'm principally working ...
0
votes
1answer
27 views
Can an arcpy.da.SearchCursor be used on a dataset residing in a ParcelFabric?
I'm using ESRI's LocalGovernmentMI.gdb data model and am managaing parcel data in a ParcelFabric dataset. I'm trying to use a search cursor on the ParcelFabric_Parcels dataset but I recieve this ...
...
2
votes
2answers
57 views
Run Python child script using Python Add-In button class?
I have a Python script which I want to execute using Python Add-In button class. Right now, I am using following:
class child(object):
"""Implementation for Toolbar_addin.button2 (Button)"""
...
0
votes
1answer
27 views
How to use expression in QgsVectorlayer label by using python?
how to show the two field values as a label on features. I have done it for a field called "ErrorDescr" with this i need to show another field values. Other field is "MarkerId"
...
0
votes
1answer
25 views
UnboundLocalError: local variable referenced before assignment
I have following simple function to get percent values for different cover types from a raster. It gives me following error:
UnboundLocalError: local variable 'a' referenced before assignment
which ...
1
vote
1answer
20 views
Where can I find a python GDAL 1.8.0 package?
I have python 2.7.4 installed on my RHEL 5 machine along with gdal-devel-1.8.0 and gdal-1.8.0. I tried to install the GDAL 1.9.1 package available on python's page ...
2
votes
1answer
55 views
GDAL/Python: How do I get coordinate system name from SpatialReference?
In Python, using GDAL, I've extracted a raster's projection as a WKT string as follows:
wkt = dataset.GetProjection()
# wkt is ...
2
votes
1answer
59 views
Quick way to make a convex hull
I am using Python and ArcGIS 10.1.
Is there a function or very quick way to extract points out of point feature class into an array without looping through a search cursor (as I have millions of ...
0
votes
1answer
21 views
Running a script with QgsFeature from within the console
I am trying to run a script from the QGis Python console (similar to: http://spatialgalaxy.net/2012/01/27/qgis-running-scripts-in-the-python-console/)
The line feat=QgsFeature() operates fine from ...
-1
votes
0answers
25 views
How to use sub queries while inserting record into db using cx_Oracle in python? [closed]
I need to add a symbol with the value of self.wrkArea variable like this
(select chr(182) from dual) || self.wrkArea || (select chr(182) from dual)
i.e. ¶workarea¶ will be the result. how to ...
2
votes
2answers
87 views
Help with Python and adding a grouplayer to arc, renaming it from a folder name, then adding layers to it from that folder
I am trying to use os.walk to go through a directory tree, pull out all the .shp files in it, create a grouplayer in the mxd, rename the grouplayer the folder name, then add the layers from that ...
1
vote
1answer
48 views
Make Table View with field_info Output
I am using Make Table View to copy data from one table to a table view object and in the process hide and/or rename some fields. When I output the data to a dbf it hides and/or renames the fields ...
0
votes
1answer
69 views
Dissolving shapefile python script not working, syntax help please
I do not understand why this simple script won't work. I can get it to dissolve in model builder but not from a script that I run from inside the map document. My output results are 4 polygons, just ...
2
votes
0answers
52 views
Python Script that calls the Voronoi Polygons Function?
I've been looking to see if there was a way to call Voronoi Polygons function found in Vector/Geometry Tools, directly from the code but I have not found one. Does this currently exist? Is there a way ...
1
vote
1answer
91 views
QGIS python location problem
It seems that MacPorts installs Python27 in /opt/local, but that MacPorts QGIS updates and uses the Apple Python27 in /Library. The result is that MacPorts additions to Python27 such as OpenCV don't ...
0
votes
0answers
77 views
ArcMap runs custom script once and then it crashes on second run
So I made a script that takes data from an MSSQL database and inserts it into a featureclass. I added the script to a toolbox and am able to run the tool from within ArcMap 10.1. The problem is that ...
0
votes
0answers
30 views
How do I get XYtools to work in OS X 10.8
This is the first question I have asked here so I hope I am not asking in the wrong place. I have an installation of qgis (1.8 lisboa) and I want to use the XYTools python plugin.
I have installed ...
0
votes
3answers
34 views
Using Sort_Management for multiple tables
I like to convert tables (100+) living in access database to a geodatabase tables, sorting them and deleting unnecessary fields in each table at the same time. I figured I use the Sort_management ...
2
votes
1answer
137 views
Convex Quadrilateral Polygons subdivision in equal parts using Python / OGR
Consider an irregular polygon (P) which has four vertices.
I would like to subdivide P into smaller polygons as shown here http://i.stack.imgur.com/4SKhB.jpg
In the old days I was using ArcGIS 9.3 ...
4
votes
1answer
127 views
Personal shell launcher for PyQGIS
I have changed a shell launcher found at http://inasafe.linfiniti.com/html/id/developer-docs/platform_windows.html as to fit my wish: setting the system environment variables to be able to use PyQGIS ...
3
votes
2answers
97 views
Concatenate only when all fields to be concatenated have values
I have two fields that I want to concatenate. Field1 contains null values and Field2 has values for every record. I want to concatenate only when both fields have values. I tried using a function ...
3
votes
0answers
75 views
How do I write XML metadata with Python?
Some Python software I have written generates raster files via GDAL. I would like the software to create an XML metadata file for each raster so that I can include details about how the raster was ...
0
votes
1answer
83 views
Using macports python 2.7 with macports qgis
I installed qgis through macports on my mac running OSX 10.8.2 but when I run the application (qgis 1.8) it says that I don't have python-gdal installed.
I searched google and it appears that it is ...
1
vote
0answers
74 views
How to draw nodes of a graph in Python and link them to a table?
I would like to draw some points with a Python GUI, like a graph, and link those points to a table.
0
votes
1answer
38 views
gdalwarp cant find libproj.dlib
Thought I had finally got Python, gdal and QGIS to play nicely together but just tried to do a batch transform using a bash script to call gdalwarp and it claimed it couldn't read the libproj.dlib ...
3
votes
1answer
175 views
Import functions in python Add-In logic script
I am running into an error. I have a set of functions which I want to import in the python Add-In script at the time of execution, but when I built Add-In with "import stats" line then tools are ...
2
votes
1answer
58 views
How to declare folder name as global?
I have asked similar question at stackoverflow but posting here as well since it involves ArcGIS and python Add-In. Following code shows first step where i have to declare output folder as global so ...
3
votes
2answers
239 views
Read specific column and row value from a text file using Python [closed]
I have a text file as following:
1.25 177.
1.50 220.
2.00 272.
5.00 427.
10.00 556.
25.00 763.
50.00 916. ...
1
vote
0answers
120 views
DLL problem with PyQGIS
I am having problems with Python Shell importing the module "qgis.core".
When I type "import qgis.core" the Shell ("idle.pyw") gives me this error:
Traceback (most recent call last):
File ...
2
votes
2answers
349 views
Combining Python and QGIS out of console
I was wondering if it's possible to use Python and QGIS out of QGIS environment (namely, avoiding the use of the console). I'm pretty new to QGIS, I've been always using ArcGIS 10.1. What I am looking ...
3
votes
1answer
395 views
How can I Setup Python to recognize QGIS
I want to use QGIS and work with Python out of the console, but I'm having troubles letting the system recognize the paths of some DLLs.
Since I couldn't find a good answer on the web, I wonder if I ...
0
votes
0answers
38 views
Use Overviews to Select Area of Interest in Very Large GIS Rasters/Images (e.g., GeoTiff's)
I am working with large images in Python and Gdal on a Windows machine and wondering if it is possible to directly access the specific smaller overviews I built into them using gdladdo. I am viewing ...
4
votes
1answer
190 views
Efficient computation of nearest distance for each point to closest polygon
I'm looking for a more efficient way to compute the nearest distance between features from 2 layers, in this example for each point the nearest distance to the closest polygon. Is there a more ...
1
vote
1answer
124 views
OGR Python bindings
When I try to access one of the GRASS vector files through Python OGR bindings, it gives error:
Here is the script code in Python 2.7.3 IDLE (GUI) in Windows 7.
from osgeo import ogr
ds = ...
5
votes
2answers
180 views
Calling GRASS functions from external Python
I have GRASS 6.4.3svn installed in my machine running Windows 7. Also in my machine i installed Python 2.7.3 for Windows.Now i need to call GRASS libraries from Python and not within the Python shell ...
0
votes
2answers
74 views
How to parse fields values using ArcView 10.0 scripting
I am using 10.0 ArcView and am trying to get the "R" in R12345678910 to drop. I lost all my scripts I've saved and appreciate some assistance.
The numbers are in a column in the attribute table and ...
3
votes
2answers
250 views
How to draw rectangle to clip layers using python addin in ArcGIS 10.1?
I want to clip rasters in data view using interactive rectangle (to define Area of Interest) and add them to current dataframe. Following is a piece of code which is not returning anything. Any ...
0
votes
0answers
33 views
QGIS Plugin delete QGSVertex from map canvas
i'm developing a qgis plugin and i need to add a function to delete previous drawn vertexes on map canvas.
On my dialog class, i can draw vertexes and when i draw one i'm also adding it to a list, so ...
3
votes
1answer
147 views
Pasing multivalue parameter using arcpy
I am trying to get my head around how multivalues derived from the arcpy command GetParameterAsText gets looped through a script. Could some please provide a sample script that does the follow basic ...
2
votes
2answers
75 views
Invalid Username When Developing a QGIS Plugin on Mac
On a fresh Mac OSX 10.8 install, I've installed Quantum GIS from Kingchaos binaries and it's running fine. I'm trying to develop a plugin for QGIS using Plugin Builder. The skel that Plugin Builder ...
0
votes
1answer
178 views
zonal histogram fails to create output table when looping
Using python I'm having problems when trying to attempt a FOR LOOP with the ZonalHistogram function of ArcGIS 10.1. It works fine if I use it only for one image but it gives me this error while for ...
2
votes
1answer
92 views
Why does ogr's CreateLayer() return None?
Why does ogr's driver method CreateLayer return None? I'm using python 2.7 with gdal 1.9.1.
path = r'D:\_tempAuto'
out_shp = '%s\test_OGR.shp' % (path,)
driver = ogr.GetDriverByName('ESRI ...
0
votes
0answers
502 views
Use Python to change datasource from a feature class to a view built on the feature class
I'm trying to replace the datasource for all of the layers in my map document using Python but I keep running into an error. Right now, all of the layers point to a feature class called ...
1
vote
2answers
172 views
Start-up error message in QGIS: Unable to load the extension GoogleLayers causes an error when calling its method initGui () [duplicate]
Possible Duplicate:
Problems with Google layers plugins
Impossible de charger l'extension GoogleLayers provoque une erreur lors de l'appel de sa méthode initGui()
Traceback (most recent ...
2
votes
1answer
239 views
How to style a layer from console?
I am new to the QGIS python console.
I am trying to load a raster layer from the console, set the crs and a specific style from a qml file.
layerPath = os.path.join(raster_dir,raster_name)
fileInfo = ...
1
vote
0answers
131 views
Mapnik: mapnik.has_pycairo() returns False. How to fix this on Windows for Python27?
I'm trying to modify rundemo.py (comes canned with Mapnik Windows binaries) to render output files at a higher resolution, but it seems I still have issues with my Mapnik-to-Cairo setup.
I've got ...


