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

learn more… | top users | synonyms

2
votes
1answer
58 views

AddJoin failing in Python ArcGIS

My AddJoin operation is failing: arcpy.CopyRows_management(lup_file,out_dir+'lup') try: # Perform copy rows on merged csv file print 'start' aa = arcpy.Raster(SEIMF) ...
0
votes
0answers
71 views

GEOS assertion failed

The following script fails, if I import the 'rasterstats' library. import rasterstats import ogr geom1 = ogr.CreateGeometryFromWkt('POLYGON ((415924.806155724043492 ...
3
votes
1answer
52 views

Is there a tool to track edits that were made?

Is there a tool/report that keeps track of what edits were made that I could run prior to or after reconciling my versions? This would help me to know if there are any changes I need to make to any ...
-1
votes
2answers
179 views

How to compare values from a column in attribute table with values in Dictionary{}?

I am just entering to the python world, hence the level of my question. Can anyone tell me what Python function should I use to compare values stored in one column in an attribute table with values ...
0
votes
0answers
43 views

Creating a line along an existing polyline from a point

I have a large data set of points, all of which lie on a river network and have x, y co-ordinates. I want to calculate the slope of the river channel at each point from the underlying DEM by taking ...
0
votes
0answers
29 views

How to add field to postgres layer with PyQgis?

I'm fetching a posgtres layer with PyQgis and then I'm trying to add field with this: lyr.startEditing() lyr.addAttribute(QgsField("class", QVariant.Int)) But It is not adding the field and also ...
2
votes
1answer
85 views

Plugin Tutorial issue: trying to work around changes in QGIS API

I'm currently following the tutorial to create my first python plugin for QGIS: http://www.qgisworkshop.org/html/workshop/plugins_tutorial.html and have similar issues to this thread: QGIS 2.0 Plugin: ...
0
votes
0answers
26 views

UnicodeEncodeError when using arcpy.gp.TraceGeometricNetwork_management() [closed]

I am creating a python tool (run through ArcMap) which will eventually go through a feature class selected by a downstream trace and use the obtained values to do some function. I am trying to follow ...
0
votes
0answers
47 views

arcpy.SearchCursor strangely throwing IO Error

I've been trying to use arcpy.SearchCursor on an xls file. Something I've done countless times before. I had a script running and then yesterday it started throwing: IOError: ...
3
votes
1answer
84 views

Python Postgres Multiprocessing speed increase

I'm trying to speed up my PostGIS queries using multiprocessing. My current setup is using python and psycopg2 such as below. Although this has given a speed increase, it still seems like there are ...
1
vote
2answers
79 views

How to get an indication of how points are spatially distributed?

Let's say I have a set of points and I want to get an indication of their spatial distribution. That is, if all points are at one location a possible return value would be 0, whereas if all points are ...
0
votes
1answer
64 views

ArcGIS arcpy reprojecting raster issue

I have a raster which I want to reproject from GCS_WGS_1984 to GCS_NorthAmerican_1983. I am using the following code: try: spatial_ref = ...
1
vote
0answers
44 views

Install PyQGIS in virtualenv

Is it possible to install PyQGIS in virtual environment? I want to use rendering capabilities in my own application which runs using virtualenv.
0
votes
1answer
61 views

problem with SelectLayerByAttribute management in script

hello my problem is that this tool works perfectly in IDLE or PyScripter programs, but if I use in the script in ArcGIS desktop this problem occurs: arcgisscripting.ExecuteError:ERROR 000582... why ...
0
votes
0answers
89 views

ArcGIS Python Field Calculation

Ok so i've got a problem with the field calculator in ArcGIS: I'm already pretty far with it since i got some help :P but it still doesnt work. What i've got: -A complete table of several states of ...
1
vote
1answer
27 views

How can I pan an ArcGIS map from an external application?

I have a web application with geocoded addresses. I would like to be able to click on an address within that application, and have ArcMap 10 respond by panning the map to the corresponding location. ...
2
votes
3answers
71 views

Best way to find points outside state boundary that are supposed to be within specific State

I have a nationwide featureclass called bakeries. In the bakeries FC, there is a field called "State" and the field is populated with state abbreviations(AL,NJ,CT,etc). I have another feature class ...
4
votes
0answers
65 views

How can I modify layer order with the QGIS python API

Typically, after a new_layer = addRasterLayer(...) that inserts new_layer before the active layer, I'd like to move it to the top of the table of contents. How to do it? I use an existing QGIS ...
0
votes
0answers
40 views

Spatialite not available from qgis python console

I have a problem using pyspatialite from within the qgis python console. When I run the following code in ipython from pyspatialite import dbapi2 as sqlite conn=sqlite.connect("MyDB.sqlite") ...
1
vote
0answers
78 views

Publishing esri geoprocessing service - upload custom python modules?

I have an esri geoprocessing service which causes problems when publishing to arcgis server. The python scripts behind the service are structured as a custom python module, in a folder with an ...
3
votes
1answer
106 views

How to do a separate Python installation with ArcGIS?

I see a lot of threads asking how you can have a separate Python installation (e.g. the Anaconda or Python XY distribution) and get it to work with arcpy, while not 'breaking' ArcGIS at the same time. ...
0
votes
0answers
35 views

How to get the color of a vector layer in pyQGIS?

I have see this topic (How to change the color of a vector layer in pyQGIS?) but I'm looking for get the color not to change. How I can resolve my problem ? Thanks
2
votes
1answer
114 views

How to draw polygons from the python console?

I've been visiting and revisiting the page on geometry handling in the PyQGIS Cookbook: https://www.qgis.org/en/docs/pyqgis_developer_cookbook/geometry.html but can't seem to figure out how to get the ...
2
votes
0answers
33 views

QGIS: rotatable markers with offset from point

Im wondering, if its possible (in QGIS), to set a rotatable marker with offset from point, like in my example below. Any suggestion?
0
votes
0answers
55 views

How to programmatically set a rule-based renderer in QGIS?

These days im in a process of developing a plugin , which highlights/change color of set of features in a vector layer depending on some calculation. i found nice article about QGIS – Rule based ...
1
vote
1answer
71 views

How to export Raster to JPEG in Python?

I built a model to import table data, create xy event, kernel density and clip density raster. I would like to export the clipped raster as a JPEG but I am not sure how to write the ExportToJPEG code. ...
4
votes
1answer
128 views

call Sql Server stored procedure form arcpy

Is there a way to execute a SQL Server stored procedure with arcpy or Python and retrieve the results returned by the stored procedure? There is a very similar question posted on ArcGIS forum with ...
0
votes
0answers
99 views

Creating multiple feature classes from multiple text files using python

I have a folder with multiple text files. I am writing a code that reads all of the text files, and creates a point feature class (i.e. a shape file) for each one. The text files are all tab ...
0
votes
0answers
50 views

Kartograph - “projection not named”

The Kartograph package looks very promising, so I have been trying play around with it. As it turns out, I have been able to get the most basic map to work (the "world.json" example), but I could not ...
1
vote
1answer
56 views

How does the tolerance influence QgsGraphBuilder and tieing of points?

I am developing a script which uses OpenStreetMap data to calculate the distance (over the road network) between each building and the nearest hospital. To do this, I mainly follow the official ...
6
votes
3answers
229 views

How to count the number of lines connected to a point?

I have a water network which and I need to install elbows and Tees (T). When 2 lines connect to a point, I want to install an elbow, when 3 lines connect, I want to install a Tee. How do I get ...
-2
votes
1answer
143 views

ArcGIS 10.1 Custom Toolbar issue with addin wizard

I am having some issues. In ArcGIS, I created a custom toolbar (with the python addin wizard) to do the following: 1. Button to connect to feature class, 2-5. A series of comboboxes to view, edit data ...
0
votes
1answer
62 views

Custom forms and Python logic: attribute error [closed]

As a beginner to Python, PyQt4, AND QGIS, I am attempting to work with the custom forms feature in QGIS. At this point I'm not sure if my error comes from the code or the .ui. This blog gave me a ...
1
vote
1answer
44 views

How to automatically add identical new polygons to a layer?

I am seeking a way, using QGIS, to automatically add polygon features identical to others on the layer. In this case, they are water valves on a water network. Anyone know of a user-friendly way to ...
0
votes
1answer
56 views

How to get a kml from stored in a blob file of oracle with arcpy

How to get a kml from stored in a blob file of oracle with arcpy? i try get data or kml files contains in a database oracle in a field of a table, using cursos options of arcpy. import arcpy, os ...
1
vote
2answers
112 views

os.system /subprocess.call error handling when error in command line function?

In my Python script I call a GDAL utility using: subprocess.call('gdal_rasterize -a ICE_TYPE -where \"ICE_TYPE=\'Open Water\'\" -b 1 -burn 5 -l ' + shapefileshortname +' ' + shapefile + ' ' + ...
1
vote
0answers
61 views

Export map to geotiff?

I try to export my map (layout or data view doesn't really matter) to a georeferenced tiff-file (geotiff). However, this presumably easy task is proving rather difficult to accomplish. I first tried ...
0
votes
2answers
56 views

How to get Python script tool to take list of variables?

I am looking at making a Python script script tool that requires the user to input a series of attributes into a list, which is then used to build a query, to select multiple polygons (i.e. "abc, ...
0
votes
0answers
46 views

Creating Parallel Road Lines

I am aware of the "Copy Parallels" option from the editing toolbar. It works fine when I'm dealing with 1000 roads or so, but when I need to create parallels for 300,000 roads it takes a long time, as ...
1
vote
0answers
56 views

How can i add a north arrow in QgsComposition?

I'm trying to add an svg image of north arrow in QgsComposition using this code: mapRenderer = iface.mapCanvas().mapRenderer() theComposition = QgsComposition(mapRenderer) ...
0
votes
1answer
96 views

How to disable the Escape key for a dialog? [closed]

I may have found the solution to my own question but I have another problem. It turns out that the user can just hit "Esc" and close the form. How can I disable the escape key? I'm looking for some ...
0
votes
0answers
42 views

Accessing QGIS attributes table interface with python

I try to use a python script to manipulate the attributes table windows in QGIS. The only thing I find is how to open the windows for a specified layer : iface.showAttributeTable(observLayer) I ...
1
vote
1answer
74 views

Why does connect to Excel spreadsheet through ArcPy give ERROR 000582?

My ultimate goal is to automate kernel density analysis on xy data from a table. I am trying to learn Python but I am very new. I built a simple model to take table data and display xy data. When I ...
1
vote
1answer
66 views

Python scripts of GRASS in QGIS 2.0

I want to use v.kriger from GRASS through sextante QGIS 2.0, but this command is not here. But I find, in C:\OSGeo4W\apps\grass\grass-7.0.svn\scripts, the command as a python script. How can I use ...
0
votes
1answer
64 views

Plotting 3D Data using Python

I have a Uniform Grid of 1KMx1KM squares as a shapefile with population data in each grid in a specific column as an integer. I would like to extrude each polygon based on the population and export ...
1
vote
1answer
79 views

QGIS Python Labelling

i want to label a point layer with those values exceeding a set of variables attribute table as follows 'loc field'(text),'a'(float),'b'(float),'c'(float) variables as follows vara = 5, varb = 3, ...
2
votes
0answers
59 views

How to display images as cross sections in 3d

I want to display a base map and several vertical cross sections in 3D. The base map image is easy to rectify as a geotiff. How can I also display the cross sections? The cross sections are at ...
0
votes
1answer
76 views

How to add several layers to the table of contents in ArcMap using Python in one shot?

I am already able to add individual layers to ArcMap table of contents using the following codes: # Adding the layer to the table of contents mxd = arcpy.mapping.MapDocument("current") df = ...
1
vote
0answers
32 views

Using the geocode function with cursors

How do I use a cursor with a geocodeaddress function? I want to be able to: 1) read from a table 2) only geocode addresses(from table1) whose street number is not 0 using a cursor 3) then update a ...
1
vote
1answer
47 views

How can i change vertex option programmatically using python in QGis?

I want to activate the option "Show markers only for selected features" in Setting-> options->vertex markers ,using python. does anyone know if i can do it programmatically ? i attached a photo of the ...