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

learn more… | top users | synonyms

0
votes
1answer
19 views

How to return end of string up to a certain character using Field Calculator?

I am trying to accomplish this task: http://stackoverflow.com/questions/15851568/how-to-get-the-last-part-of-a-string-before-a-certain-character within the Field Calculator. I have the below but ...
0
votes
0answers
14 views

How do you duplicate a point within a shapefile using Python?

How do you duplicate a point within a single feature class using Python? I have a partial sample script below, but in a nutshell, I want to duplicate a point, copy it into the same shapefile, and ...
0
votes
0answers
5 views

Pyqgis 2.2 : How to allow editing on layer and features

I'm writing a pyqgis plugin with qgis 2.2 I succeeded in accessing and displaying vector data (geometries & attributes). Now I would like to allow editing for all my layers and all features ...
2
votes
2answers
19 views

Selection of lines that lays mostly in defined zone (majority overlap)

I have lines of surface runoff and I need to select the ones that are lying mostly in internal buffer of polygon. I'm trying to make some script in python, but it's very important to make the script ...
1
vote
0answers
18 views

How to sort a column in attribute table programmatically

Is there any way to sort ( alphabetically ) a column in the attribute table programmatically (without clicking on the column header) in QGIS ?
3
votes
1answer
72 views

PostGIS: Insert a Point using Python

What is the right way to insert a Point to a PostGIS database using Python?
2
votes
1answer
46 views

data source for worldwide cross-sections of topographic and bathymetric for woodworking art project?

i am a decent r programmer and statistician, i am able to work with data sets pretty well. i am less familiar with GIS tools, but if given a shapefile i can certainly plot political borders and ...
0
votes
0answers
35 views

Python + GME (Spatial Ecology) + Subprocess.call

I'm trying to run the following code to use GME commands in Python. import arcpy,os,subprocess from arcpy import env env.workspace=r"D:\Users\myname\Desktop\aviso" count=0 for raster in (f for f in ...
1
vote
0answers
30 views

ArcPy Multiprocessing 000714 - Working in Debug Mode

In an attempt to render an interactive window via matplotlib I am using an out of process script in a toolbox. If I debug the script, it is possible to step through and render the window as expected. ...
1
vote
1answer
20 views

Couldn't load SIP module (QGIS doesn't load Python)

I recently installed QGIS 2.4, but Python does not load. I am running on a Windows 64 bit machine. I receive the error message "Couldn't load SIP module Python support will be disabled". Traceback ...
1
vote
1answer
40 views

Controlling Python Version from ArcGIS?

I am writing a VB.net console application that calls ArcGIS Desktop 10.1 ArcToolbox geoprocessing tools from my code. Some of these tools use Python syntax and I am encountering a problem that I ...
0
votes
1answer
39 views

Cannot put a layer name as the same as the raster name just created by Python script

I have a question regarding Python script for making a Heat Map Tool. I am making a Heat Map Tool where users can set the map extent, the tool will read the current scale of the map, then make a ...
0
votes
0answers
17 views

Is it possible to rotate the geographic projection in QGIS?

I'm trying to create a Qgis plugin that can rotate a raster layer in the canvas so that the north is pointing at another direction. Unlike the thread below, I'm open to defining a custom projection. ...
-2
votes
0answers
30 views

Update fields in feature class [duplicate]

I am working on ArcGIS 10.2.1. I have a feature class containing more than 4000 records and a table having approximately 1000 records. Both feature class and table have some common fields however, ...
1
vote
1answer
34 views

What is the inverse of QgsGeometry.asGeometryCollection() in qgis python?

What is the inverse operation of QgsGeometry.asGeometryCollection() as documented here: http://qgis.org/api/classQgsGeometry.html#a7cb1cbf8cfa441456067a66ad3a25a94 I'd like to do something like: ...
0
votes
1answer
48 views

Updating a feature class

I am working on ArcGIS 10.2.1. I have a feature class containing more than 4000 records and a table having approximately 1000 records. Both feature class and table have some common fields however, ...
2
votes
0answers
17 views

How to snap dangling nodes with prescribed angle?

I have got a streets shape file, to snap the dangling nodes in ARCGIS. But, I have to snap only some nodes(of feature) with a prescribed angle (green node in the image, and the angle marked in ...
2
votes
1answer
23 views

raster overlap count

Would it be possible to simply detect and count overlaps between raster files, i.e. not polygons against rasters, using arcpy? By default I don't have the spatial analyst extension for ArcMap 10.1 but ...
0
votes
0answers
18 views

ArcGIS 10.2 with MatPlotLib Non-Blocking Plot

ArcGIS 10.2 ships with MatPlotLib 1.1.1 installed. I am trying to display a non-blocking plot window. Trials: Launch an interactive plot in a Tk window from a toolbox. This causes the plot to ...
0
votes
0answers
10 views

Placing Pins and following transformation on zoom map d3

So I am using this http:// bl.ocks. org/mbostock/4699541 framework on D3.js and I just figured out how to append circles to the map. However when you click on a state the circle moves out of place ...
0
votes
1answer
15 views

Adding a Vertex To Exisiting Feature(linear) Using OGR Python

I am working on a project that involves finding the intersection of linears in a shapefile, if that vertex(the found intersection) doesn't already exist for each(or one) of the features, then that ...
0
votes
2answers
39 views

gdal2Tiles output differs from MapTiler

I'm in need to process a large batch of Landsat images with MapTiler and since the version I'm using (1.0 Beta 2) does not support multiple input files, I created a simple python script that calls ...
1
vote
2answers
56 views

Raster' object is not iterable

I'm trying to calculate the percentage of cell counts in new raster and the new raster is created from an old raster based on the Value > 14. In my code, 1st for loop is for original raster and ...
1
vote
0answers
26 views

How to go about creating a custom tool/adding special functionality for a web app

In my soon to be developed web app, I will have an image service and also a feature service that is essentially an index to the image service, with all kinds of attributes. I would like for the user ...
5
votes
4answers
273 views

How to split single address field into 4 fields (House No., Direction, Name, Suffix)

I have to do some massaging of our parcel data to make it usable by a program in sheriff helicopters. The program requires one of the following address formats within the fields: Our addresses are ...
2
votes
0answers
23 views

Polygon parcel division in python

Is there an open source tool or module in python that does parcel division of polygons like in ArcEditor?
1
vote
0answers
29 views

PyQGIS: Editable Combobox for Value Map widget isses

I am having issues with an editable combo box in QGIS 2.4. The edit widget is set to Value Map with an uploaded CSV. However, if a new values (not included in the key value pair list) is added, the ...
1
vote
1answer
84 views

How does one modify selected geometry with a function in qgis python console?

My example use-case is that I want to redistribute vertices along lines as in: Redistribute linestring vertices to specified distance How to create points in a specified distance along the line in ...
2
votes
1answer
32 views

How to do loops on raster cells with python console in QGIS?

I'm new here and beginner with python. I'm looking for a solution to my problem for some hours but now you are my last chance... I'm using the python (2.7.5) console in QGIS (2.4.0). Is there a ...
1
vote
1answer
36 views

Import arcpy using PyScripter or IDLE gives No module named RuntimeError?

I'm trying to figure out this problem. Yesterday I installed PyScripter and since then, scripts doesn't work. When I run any script (in PyScripter or IDLE) which uses "import arcpy", I get this error ...
0
votes
1answer
77 views

How to write output from subprocess to disk (using multiprocessing)

This code was developed from another question I posted about how to kill an arcpy tool if it takes longer than a specified time. See How to cancel tool execution in python. Using the multiprocssing ...
0
votes
1answer
56 views

What is the syntax for Python 2.7 to permanent display in percent in a field column?

What is the syntax to build to calculate field, for example, Acres to Percent? 841173.00 to 82 % What I want the field column in Percent to be display numbers with percent with the alignment to ...
0
votes
2answers
34 views

Error while importing CSV File using PyQGIS

Currently I am trying to import a CSV file using the python extension in QGIS and I have run into a problem that I can not seem to solve. I am trying to do a basic import of a CSV file from a python ...
0
votes
0answers
14 views

How to get sql error from postgis when a plugin fail to load vector layer?

I am writing a plugin for qgis that load a sql layer from postgis database. I am disappointed that when the layer fails to load i can't find a way to get the sql error message from database server. ...
0
votes
1answer
24 views

40k+ points from Shapefile, clustering them and populating on Google Maps/Webapp

I just started a new Python/Django webapp job related to GIS (and i'm totally new to GIS). Here is my task and what i have found so far, and i am stuck as to finding out what's the best way or the ...
1
vote
0answers
19 views

Import QGIS Python modules in Python command line or standalone script

I am running a Windows 7 machine with Python version 2.7.8 (32 bit). I installed QGIS 2.4 (Chugiak) from OSGeo4W and simply want to be able to import the QGIS Python modules (e.g. qgis.core) into ...
1
vote
2answers
34 views

How to find the minimum pixel value within a region of interest?

I am working on a Python script for dark object subtraction, a radiometric correction method for remotely sensed data.To accomplish this, I need to find the minimum band pixel value of a waterbody ...
2
votes
1answer
43 views

Randomly choosing one from multiple fields in Field Calculator of ArcGIS for Desktop?

Using the Field Calculator in ArcGIS for Desktop, I want to randomly choose one field from a list of 10 fields (strings). The Excel equivalent, which is working, is: =INDEX(A2:J2;rnd()*10+1). How ...
0
votes
2answers
33 views

Export Raster Data to TIFF, BMP, or PNG File Using Python

I am writing a Python script to export a Raster Dataset to a TIFF, BMP, or PNG file, as I would manually by right-clicking on the layer, choosing Data | Export Data, and then make my choices in the ...
1
vote
0answers
26 views

Link to pdf file through mouse clicking

I need help in identifying the feature attributes displaying a pdf file when click in that feature. I see many examples but I don't have success. I try this code: command = "firefox"; imagerelpath = ...
6
votes
1answer
156 views

How to classify time periods in a new field, using Python?

I have a datetime field (Horario) in my feature class, showing only the time. Although the date doesn't appear, it seem to be stored automatically as 30 Dec 1899, I'm not sure why. I want to use ...
0
votes
1answer
27 views

Python for loop doesn't work for Spatial ETL Tool

I've created a Spatial ETL tool from ArcGIS 10.1 and would like to run this tool to all 200 featureclasses in a geodatabase. Therefore, I've written a python script to do this automation. (btw, i'm ...
1
vote
0answers
25 views

Using python libary simplejson and urllib in PostGIS

I installed PostGreSQL9.3 and want to create a Pl/Python function using simplejson library and urllib. First I use OSGeo4W Shell to test the similar python script, it works. Then in PostgreSQL, it ...
2
votes
2answers
50 views

How to check whether an optional FeatureSet parameter was set by the user in a geoprocessing script tool?

I have created a custom geoprocessing script tool which contains an optional FeatureSet parameter. When unpacking the parameters in the script, the FeatureSet is defined as a RecordSet object, even ...
0
votes
1answer
27 views

List index out of range error

I've been writing a script that clips large datasets based on a selected feature. It works fine when I run it in a test workspace where only related layers are active and running. However, when I run ...
1
vote
1answer
36 views

sum of raster counts

I'm trying to get the sum of "counts" in a raster. I have the code below which can successfully read the counts of each row in raster attribute and stores the counts in a list provided below. ...
1
vote
1answer
17 views

Python Error while installing Cartogram

I am quite new to GIS and qGIS especially. I would like to install cfarmers cartogram plugin. From what I understand, this has to be done manually - so I 've followed the instructions from ...
1
vote
0answers
19 views

How to write a custom map canvas item by subclassing QObject and QgsMapCanvasItem?

I'm writing a QGIS python plugin where I place some QgsVertexMarkers on the canvas like this: marker = QgsVertexMarker(self.canvas) marker.setCenter(QgsPoint(point[0],point[1])) Now i would like ...
0
votes
1answer
34 views

Using OGR Intersection Method Python

I'm currently working to find the intersections between linears in a shapefile. I'm a newbie to the GDAL/OGR library. I've done some googling and came up with what seems to be a useful example(see ...
0
votes
0answers
27 views

How to select duplicate polygons? [duplicate]

Although it may seem this has been answered before, there doesn't seem to be a solution. I am trying to simply select duplicate polygons. I don't want to delete them or anything like that. I need ...