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

learn more… | top users | synonyms

0
votes
1answer
12 views

Collect last word from varied length string for filtering, auto labeling and column population? [on hold]

I have been looking and reading for a few days about how to collect the last word from a varied length string. I have found lots of postings about how to collect/split the last word, but none of the ...
0
votes
1answer
9 views

Shapely (geos) crashes during unary_union

When attempting to union multiple polygons with Shapely 1.5.6 in Python 2.7.9, using GEOS 3.4.2, I get the following error in the underlying C++ code: Assertion failed: (!"should never be reached"), ...
0
votes
1answer
13 views

Inline variable substitution in Model Builder using python code

I have an inline variable substiution which I would like to import into my Python script. Is that possible? I am trying to make a parameter within my path. My path currently is ...
1
vote
0answers
23 views

If Else Statement Existence of a File With User Input [on hold]

I am trying to design a block of code that checks if a user inputted directory exists, prints if it does, and if it does not. import os foldername = raw_input ("Please enter the name of your ...
1
vote
1answer
34 views

How to get a layer by name in PyQGIS?

I have a plugin which finds buffer for list of cities, provided the distance. The state and city names are taken from the attribute table and gets filtered accordingly. What I want is My plugin should ...
0
votes
0answers
13 views

Suppress values from multiband rasters

I have a raster stack with 84 bands . It is a time series raster. It so appears that the cloud is causing error in my processing and hence i need to suppress or replace them by a NaN to eliminate them ...
0
votes
1answer
18 views

ImportError: libqgis_core.so.2.9.0: cannot open shared object file: No such file or directory

I installed qgis in debian linux and I want to run a standalone app in python. So I import qgis.core and qgis.gui in this app. But it gives me an error: ImportError: libqgis_core.so.2.9.0: cannot ...
0
votes
0answers
36 views

gdal ReadAsArray returning NoneType

I'm trying to read in several rasters as array using gdal in a python script, but I keep getting NoneType returned and can't figure out why. The process is this: 1. Use gdalbuildvrt ...
1
vote
2answers
31 views

How to get cell value along Flow Direction

I have: a flow direction raster where I took off (assigned NoData value) the cells that overlayed the river network (from flow accumulation). a perfectly overlapping raster where I asigned a ...
0
votes
1answer
43 views

Is it possible to embed python in code for HTML pop-ups in ArcGIS

When clicking a point feature I want the html pop-up to not only contain the data of the feature but also an image of the area around the feature (eg. 2 km^2). The image would have the base map 'World ...
1
vote
2answers
144 views

Why is my cursor empty?

Yesterday I set up a Python script using a cursor on a layer. Today I've tried running again and no matter what I run it in, the cursor is empty. I've tried removing the query on the layer, tried ...
2
votes
1answer
21 views

Python FindLabel Function for Label Expression with Formatting Font?

I originally had this FindLabel function (which works)... def FindLabel ( [NAME], [Count_] ): if [Count_] != None: return [NAME] +'\n' + "Well Log Count: " + [Count_] I wanted to format the ...
0
votes
1answer
28 views

Cannot rename output file using standalone script for QGIS

I would like to rename all output files after my script has finished processing them by adding "(A)" after their file name (eg. Layer.shp -> Layer (A).shp). I received an answer from this post on the ...
0
votes
0answers
41 views

Problem exporting ecw project- arcpy

I work with arcview 10.3. Every time i export maps with ecw raster format , python (version 2.7.8) get crashed and i see: I use this code: import arcpy,os,sys,string import arcpy.mapping from arcpy ...
1
vote
1answer
30 views

How to add label to QgsVectorLayer by Python

my goal is to define label programmaticly for the case similar for the figure below: But didn't find any guidance how to do so using Python. I have a feeling it could be done using QgsLabel but ...
1
vote
3answers
45 views

SearchCursor Index Out of Range

I'm using ArcGIS 10.2 and trying to obtain values in a field using SearchCursor. Would someone help me with this? import arcpy oc = r"C:\Users\Scratch\oc.shp" catchments = ...
2
votes
5answers
106 views

How to export attribute table with start and end coordinates of lines to Excel?

I am working in QGIS. I have a georeferenced line layer and I want to export the attribute table and the coordinates of start and end points of my lines to Excel. Can I do this with QGIS?
1
vote
1answer
40 views

How to add multiple attributes to a newly created feature with PyQGIS

I am creating a form for updating the attribute values of the newly created feature. But when i am updating the values only one attribute field is getting updated. So if i want to update the multiple ...
2
votes
1answer
30 views

Does mapCanvas().refresh() not work in QGIS 2.6?

Before I used the function qgis.utils.iface.mapCanvas().refresh() to reload the map canvas after for example a layer color was changed from a plugin. But this is not working with QGIS 2.6 for me. ...
-1
votes
0answers
9 views

Integrating GIS with HDM4 software

what kind of a programme could be developed to integrate the HDM4 Software (Highway Development & Management) with the GIS??
2
votes
1answer
85 views

ArcGIS Python syntax error using nested if else

I am trying to use the field calculator in ArcMap 10.2 to fill an empty field based on the contents of two exiting fields usint this python script in the Pre-Logic Script Code. def ...
1
vote
0answers
19 views

Raster Vector stack

I want clipped image of NDVI for a particular area. I did raster calculation for getting the image with NDVI values. After that I tried extraction function clipper. In this function we have to use two ...
1
vote
1answer
58 views

How to export only certain column from selected feature to csv file in QGIS using python code

I have selected features in QGIS, I want to export only two columns from the selected features to a csv file automatically using python code. I have tried the following code: layer = ...
3
votes
2answers
43 views

How to define layer's CRS and avoid the CRS dialog in PyQGIS?

There is an existing Shapefile, which I want to add. At the moment my code looks like: self.iface.addVectorLayer(self.shpFilePath, "Track", "ogr") It works fine, but i want to define the crs ...
1
vote
1answer
43 views

Download file from network using PyQGIS 2.x

I have a python plugin targeting QGIS 1.8 that uses QgsNetworkAccessManager and QNetworkRequest to issue a GetCapabilities request to WMS servers. With 1.8 everything was working fine. Now we are ...
0
votes
0answers
29 views

Polygon of Voronoi cell using scipy.spatial?

I have points (e.g., lat, lon pairs of cell tower locations) and I need to get the polygon of the Voronoi cells they form. from scipy.spatial import Voronoi tower = [[ 24.686 , 46.7081], [ ...
-1
votes
1answer
56 views

Unable to merge two shapefiles (created from text files) using ArcPy? [on hold]

I am trying to merge 2 shapefiles together created from 2 text files. I am new to python and managed to get the textfiles into shapefiles, however, when trying to merge the two newly created ...
1
vote
1answer
41 views

Problem with tool validation script in ArcGIS?

I have tried to write some validation code for a script in ArcGIS. This validation code more or less repeats what the script itself does, which is a simple cutting up of a long string by using the ...
0
votes
0answers
59 views

Python - Taking list of cities out of .txt file and printing them to another text file with coordinates from Google [closed]

new here, and this is my first post. I have a python script that I am working on, and the scripts main purpose is to take a list of cities from a .txt file on my computer, and have the script spit ...
2
votes
0answers
21 views

QGIS Python Script for RoadGraph plugin

I am looking to create a Python script that will take X,Y coordinates from one field in an attribute table, compare them to another set of X,Y coordinates in a different field, and populate a field ...
2
votes
1answer
34 views

Issues with PyQGIS while running a QgsZonalStatistics script

I have experienced a very bizarre issue with my PyQgis code. I simply want to load a raster and a vector layer to do zonal statistics, the first part works perfectly but for the zonal statistic I have ...
0
votes
0answers
21 views

Why does np.multiply change int nparray to float? [closed]

I'm working on a Debian system using Anaconda/Spyder. I'm multiplying large ndarrays such as the following: out = np.multiply(array, .0001) where: array.dtype = int16 but the final output array ...
2
votes
2answers
52 views

How do I serve OSM map tiles (mbtiles) from a Raspberry PI 2?

My main processing machine is a Ubuntu box running 14.04 with PostGIS and TileMill. I generated my tiles and the resulting mbtiles export is about 250MB (megs, not gigs). The PI runs python, has a ...
-4
votes
0answers
46 views

How to find a point inside a multipolygon?

I have a table postGIS with a column (type: geometry(Multipolygon)). One of the entries looks like below. How do I convert them into polygons ? or If I have a geo-coordinate , is there a way to find ...
3
votes
1answer
57 views

Using “Raster to Other Format” Conversion Tool (BIL file to TIFF file) in ArcGIS for Desktop?

I am trying to use the ArcGIS "Raster to Other Format" Conversion tool from a .bil file to a TIFF image. I have the following Python code to create the .bil file shown in this ArcGIS tutorial: ...
1
vote
1answer
36 views

Difference between osgeo gdal/ogr python module and GDAL C++ library

I am developing application in python and I use the osgeo gdal/ogr python bindings for gdal, but its not clear to me what exactly is the difference between the gdal/ogr in python and the gdal library ...
1
vote
1answer
56 views

Is there a Python implementation of a Straight Skeleton algorithm?

I'm looking for a Python package which provides an implementation of a Straight Skeleton algorithm. I'm aware that the open source (C++) project CGALcontains an implementation but it seems like ...
0
votes
1answer
25 views

How to connect mouseclick to map canvas in QGIS?

How to connect mouse click to map canvas in QGIS using python script? I have two lines of code to connect mouse click to map canvas: button.clicked.connect(self.onClicked) ...
-1
votes
0answers
45 views

Creating shapefile from georeferenced image?

I have a jpg image and a list of ground control points, I am looking to programmatically create an associated shapefile in python.
2
votes
1answer
46 views

Error with Python Script using Shapely

My professor gave us a basic Python script that demonstrated how Shapely works with a shapefile, however it's not working for me. Here is the code: from shapely.geometry import mapping, shape from ...
0
votes
1answer
42 views

How to trigger a QGIS action when a plugin button is clicked?

I tried calling the select free hand tool by below snippet of code. iface.actionSelectFreehand().trigger() I dnt have any idea how to call this when i am pressing a button in GUI. my gui is ...
1
vote
1answer
42 views

How to call default tool in QGIS inside plugin using python script?

I want to create a plugin which can draw irregular polygons in QGIS. For that, I want to call the Select features by freehand default tool inside my plugin. How can I do this within a python script?
0
votes
0answers
27 views

web2py - openlayers

I have used web2py and there is test.py under controllers which shows a map as below: and its code is: for url in [ 'http://dev.openlayers.org/theme/default/style.css', ...
0
votes
0answers
18 views

Reading long lat values from line feature

I have created a vector layer selecting starting point and end point of the line and created the line by line geometry in QGIS. How do i read the all long. lat. values in the line feature? v_layer = ...
0
votes
2answers
70 views

How to add XY point and update attributes with ArcPy 10.0

I would like to create a script tool that takes 3 parameters in ArcMap: Google maps coordinate (e.g. -33.876846, 151.215117) text string text string The coordinates would define the XY geometry, ...
1
vote
1answer
24 views

QGIS (2.6.1) Processing Toolbox InitGui error after changing /Users folder on Mac OSX

Using: Mac OSX 10.9.4 QGIS 2.6.1 I had previously installed QGIS and had everything running fine. My home directory was /Users/rowanbado, but for another application I had to add an ...
5
votes
2answers
80 views
+50

ArcPad Checkout from python command line

I have been developing a script to automate my ArcPad checkin/checkout processes. My problem is that I am having trouble getting arcpy to recognize the ArcPad tools from the command line. From the ...
1
vote
3answers
43 views

How to return a unique value from table using Arcpy?

Using Arcpy in Python, I would like to return / print '0.15' from the following table: When I use the following code I get "(u'D', 0.20)" as my print statement in Python: import arcpy fc = ...
0
votes
2answers
50 views

Shapefile projection for Matplotlib Basemap

Preface: First time working with GIS data. I'm using python's Basemap library for overlaying data on maps. The tutorial I'm using includes a shapefile for London (london_wards.shp). I use the ...
1
vote
1answer
25 views

Creating ArcGIS tool that can run list of checks?

Is it possible to create a tool in Arcmap where by uploading a shapfile, the tool can run a various number of checks/tests (ie intersecting other shapefiles) and flags or highlights conflicting ...