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

learn more… | top users | synonyms

1
vote
0answers
8 views

Arcpy if statement to act on layers at the top level of hierarchy

I am about to save copies of all of the layers in my mxd. I only want to save the top level group layers though. I have some group layers within group layers - I dont want to save them individually. ...
0
votes
0answers
2 views

how to write a netcdf4 in the right manner [duplicate]

What is the standard way to write a netcdf4? I'm using this guide http://netcdf4-python.googlecode.com/svn/trunk/docs/netCDF4-module.html but when I dump the output file with ncdump, I get the error: ...
1
vote
0answers
9 views

Updating Multiple Fields in Feature Class from a Table

I have a Point Feature Class with 2 million records with 35 fields. I have another csv file (contain 25 fields) which have around 4000 records to update certain records of the Point Feature Class . ...
0
votes
0answers
6 views

standard way to write a netcdf4

What is the standard way to write a netcdf4? I'm using this guide http://netcdf4-python.googlecode.com/svn/trunk/docs/netCDF4-module.html but when I dump the output file with ncdump, I get the error: ...
4
votes
2answers
109 views

How to run a python script on the server, returning the results to the client

Here's the end result I'm trying for: the user clicks on a feature on an ArcGIS Server JS map a Python script is triggered on the server the Python script uses an attribute from the feature (eg its ...
1
vote
1answer
27 views

QGIS Modeler flexibility and errors?

I'm trying to build a simple multi-step selection (by attribute) with the QGIS Modeler. I created a simple sample layer to avoid data-driven errors. Now I want to query the layer and select features ...
1
vote
1answer
18 views

How to select from selection with PyQGIS?

The expression box has a handy "select from selection" button. Is there a way to emulate this with python? I have the basic expressions down, but can't find a way to do this.
2
votes
3answers
25 views

QGIS python plugin appends values every time it's started

I've written a small python plugin (using plugin builder as base) to simplify the expression process for a given layer (just a few comboboxes that are used to create a query). The combo box populating ...
1
vote
0answers
19 views

Why processing.runalg(“gdalogr:rasterize”…) is not creating out files when running in the QGIS 2.6.0 console?

I want to the QGIS python scripting functions to turn to rasterize a point vector using many different dimensions. Right now my code looks like this: import processing RasterPixelSize = ...
-4
votes
0answers
31 views

error while trying to compile quantum gis: unresolved external symbol class QwtIntervalData [on hold]

While trying to build qgis-2.6.1 from source on windows 7 32 bit with mvc++ 2008 I got the overall result ========== Rebuild All: 281 succeeded, 3 failed, 0 skipped ========== from this I am able to ...
3
votes
1answer
49 views

More efficient way to get the start and the end points of a line (arcpy)?

I am collecting start and end points for a large polyline feature class in a file geodatabase. I am using arcpy, ArcGIS 10.3, Python 2.7.3 64-bit and a 10.3 compressed file geodatabase with just one ...
-2
votes
0answers
28 views

How to set NULL value by arcpy.da.InsertCursor on date column?

How to set NULL value by arcpy.da.InsertCursor on date column? I try insert "NULL", None, '', 0 dictIN= [{'field1':"test1",'date1':'01-02-2015','date1':''},\ ...
0
votes
1answer
22 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
14 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"), ...
1
vote
2answers
29 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
29 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
42 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
19 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
22 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
41 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 ...
2
votes
2answers
47 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
47 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
147 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
24 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
30 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
51 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
37 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
48 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
112 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
43 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
33 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
87 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
60 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
45 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
31 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
59 views

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

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
60 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
22 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
36 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 ...
2
votes
2answers
59 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
47 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
60 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
38 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
60 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
27 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.