A version of the Python programming language

learn more… | top users | synonyms

0
votes
0answers
25 views

ImportError: No module named arcpy - ArcGIS 10.1 and Python 2.7 [duplicate]

Traceback (most recent call last): File "C:\Python27\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 326, in RunScript exec codeObject in __main__.__dict_ File ...
1
vote
2answers
235 views

How do you get all the results from a Selection made by Attribute or Location using ArcPy?

Using arcpy I'm trying to get the results of a selection, or what is currently selected as a list. Basically I'm attempting to build an addin which on click will either perform an operation where I ...
1
vote
1answer
103 views

How to retrieve the year from a date format?

I'm attempting to retrieve the year from the following date format: 1/1/1988 I've tried the following but it does not work str(1/1/1988)[4:] and I've also tried str(1//1//1988)[4:]
2
votes
1answer
25 views

Listing datasets doesn't bring back the correct result

If I do a ListDatasets() in python, then I don't get the correct result in the list except for datasets belong to other schema owners, so why can I still see the datasets in ArcCatalog. The code is ...
1
vote
1answer
163 views

Find Direction/Location of point in polygon using Python ArcGIS10.1

I have a point located inside a polygon, I want to determine its location or direction i.e. if it is in the northwest corner or southwest. I have the x,y of the point. Any idea on how to do this? I ...
0
votes
0answers
249 views

ERROR 001269 : Compressing the service definition failed.ArcGIS 10.1,Python 2.7

I am trying to publish an mxd using python script. I invoke this pyhton script from c# application, after creating the sddraft file, the system throws up this error "001269 : Compressing the service ...
4
votes
2answers
264 views

How can I define the layer CRS for a memory layer in pyqgis

how can I define the CRS for a memory layer from the qgis project settings vpoi = QgsVectorLayer("Point", "vectpoi", "memory") feature = QgsFeature() ...
1
vote
0answers
52 views

How do I make vectorlayer with sql on PostGis via python code

I need to make a vectorLayer and fill with the SQL's results on PostGIS via python code. I'm working with python 2.7, QGIS 1.8 and PyQt 4.5 How do I it ? thanks
0
votes
1answer
35 views

How to make a vectorlayer through of sentence SQL on PostGRES

How do I create a vectorlayer to through SQL on PostGiS on Python 2.7. I is working with QGIS 1.8 and I needed create a vectorLayer through SQL on PostGIS.
0
votes
0answers
663 views

QGIS Plugins - DLL load failed: %1 is not a valid Win32 application

This is my first question so please go easy. I am trying to develop a Plugin for QGIS. I made my plugin using the "plugin builder", then compiled the .qrc and .ui files with PySide-rcc.exe and ...
1
vote
1answer
398 views

QGIS python - reference a layer in the table of contents

I'm trying to create a plugin for QGIS using python, But need some help. I want to 1.Zoom to a layer and 2. make the layer visible(switch off or on). But I have managed to zoom to an active layer by ...
1
vote
0answers
58 views

Insert last coordinates from a list of coordinates with line ID into a multipart polyline feature class

I'm having problems creating the last line from a list of coordinates that I have. I have a text file with coordinate data with a X, Y, and a Line ID (LID). I read the file and inserted each ...
3
votes
2answers
297 views

How to control state of buttons in Python Add-In?

I have bunch of buttons to perform separate tasks within a Python Add-In. Buttons are greyed out and required to be enabled after initial tools run. In the following example, tool1 is turned off after ...
4
votes
2answers
382 views

Gdal Python Bindings and File Geodatabase API

I'm trying to get python 2.7 to work with GDAL/OGR and an ESRI file geodatabase. There have been a few similar questions asked but the answers don't fully resolve my situation. I have installed the ...
1
vote
1answer
68 views

How to update attributes of a shapefile using list values?

I am using an update cursor to update the attributes of a shapefile using values from a list. It seems very easy, but I couldn't make it run correctly. When I run the following code, it updates all ...
3
votes
0answers
94 views

Why are my raster mean and standard deviation -1?

I have a set of about 25 rasters whose descriptive statistics I have been examining. The data in the rasters were calculated in Python and the rasters were created using Python-GDAL. In all but one ...
1
vote
0answers
118 views

Spatial Filter in Qgis Using Python

Is it possible to create buffer and get intersected features in Qgis using Python? I did in ArcObjects.but i need the same in QGIS also. Dim topo As ITopologicalOperator topo = chkPoint Dim sFc As ...
0
votes
0answers
26 views

How to create an array of points in ArcMap? [duplicate]

I have a master point in following projection system: WGS_1984_UTM_Zone_45N WKID: 32645 Authority: EPSG Projection: Transverse_Mercator False_Easting: 500000.0 False_Northing: 0.0 Central_Meridian: ...
1
vote
0answers
55 views

Convert List by Source to List by drawing order using arcpy

When I do some calculations, it results in adding a table to TOC which converts "List by drawing order" to "List by Source". I want to convert it back to "List by drawing order" using arcpy and I am ...
0
votes
1answer
320 views

Getting error in compiling make file for plugin build in qgis 1.8

I am using QGIS 1.8 for building plugin. For developing i am using following ref this link example. where in this step 6 where compile the makefile in OSGeo4W. gives error pyuic4:command not found. I ...
0
votes
2answers
198 views

Why is Shapely not installing correctly?

I am trying to run Shapely on a new machine, and tried both installing it from source, using the installer on its webpage, and using pip install shapely. Every reference I try to make from the library ...
1
vote
1answer
124 views

Export ArcGIS Model to Python - Iterate Rasters, Collect Values, Calculate Values

I want to batch process a large number of raster files, calculate some values and properties and export these to a .csv or .xls. I managed to get a good working model that does this perfectly. ...
1
vote
3answers
531 views

How to setup a debugger for QGIS Plugin development?

As the title of the question implies, I wish to know how to set up a QGIS Python Plugin Debugger so that I can develop plugins more efficiently. Any information regarding this would be much ...
1
vote
1answer
130 views

Best Platform to develop QGIS Python Plugins

I am currently developing QGIS Python Plugins in a Windows 7 64-bit environment. Having said this I am stumbling across various issues which from what I have been able to gather have a less tendency ...
1
vote
1answer
250 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
364 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
347 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
201 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
397 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 ...
3
votes
1answer
115 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 ...
7
votes
1answer
1k 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
2answers
296 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
206 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 ...
2
votes
2answers
384 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
311 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
321 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
1answer
340 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
587 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 ...
2
votes
0answers
279 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
3answers
64 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
202 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
254 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
319 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
197 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
272 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
124 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
124 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
610 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
93 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
4k 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. ...