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

learn more… | top users | synonyms

0
votes
3answers
95 views

How do you read/write a FeatureCollection from/to a json file?

I am trying to read in a json FeatureCollection (geojson 1.3.1) Python (2.7), add some properties, and write it back out to a json file (or string). I can read the file, and modify the properties, ...
1
vote
1answer
42 views

How to split epsg 4326 linestring in parts consisting of given length in meters in python?

I want to know linestrings (epsg:4326) length in meters instead of degrees. I know that I can use proj4 for that. Here is my code, if you interested. project = partial( pyproj.transform, ...
1
vote
1answer
31 views

store function attribute of class in QGIS plugin

I'm pretty new to python and pyqgis so the question will be pretty trivial.. I'm writing a plugin and in one script I have a class and some internal functions.. .... class ...
1
vote
0answers
32 views

create own plugin

With the QGIS plugin 'plugin builder' I create a new plugin. Then I followed the steps described on this website : http://www.qgistutorials.com/en/docs/building_a_python_plugin.html It works perfect ...
1
vote
0answers
41 views

GRASS GIS i.landsat.toar hangs & holds CPU at 100%

I use python scripting to automate processing of several Landsat 8 scenes. I use a VPS (4 core, 8GB memory, SSD) running Ubuntu 14.04 with GRASS 7.0.1 Line in script for i.landsat.toar: ...
2
votes
1answer
61 views

Create new shapefile based on values ranges in existing shapefile using gdal/ogr/python

I have a shapefile containing many thousands of polygons with values stored in an attribute field and ranging 0-105. I would like to create a much simplified file that contains classes for value ...
1
vote
1answer
33 views

setHeaderData not working in a QgsAttributeTableModel?

I want to display the content from a layer in a new view I have so far a code like below (you should have 2 columns at least, then, just try in the QGIS Python console replacing mylayer_id) from ...
1
vote
1answer
66 views

How to display shape files stored in a database into a web page

I'm pretty new to geodjango and python in general. But I would like to display my shapefiles stored in my database into a web pages and present them in layers and retrieve certain information if a ...
1
vote
1answer
44 views

How can a gui be visible till all the work is done? (QGIS plugin, python)

I have made a gui in QTDesigner for QGIS2.10 (as a dialog). When I press the ok button (if result == QtGui.QFileDialog.Accepted:) everything works just fine but the gui is disappeared. How can the gui ...
0
votes
0answers
82 views

using arcpy.UploadServiceDefinition_server to publish to portal

I'm using arcpy.UploadServiceDefinition_server() to publish SD files to a server that is federated with portal. Using this ESRI Documentaion I am able to publish the service to a specific folder on ...
2
votes
2answers
55 views

landsat-util zip files

I've just started using landsat-util and am having a couple of problems. First of all, the standard download command only downloads Bands 4,3,2 (the visible bands) and the QA band. In the docs it says ...
0
votes
1answer
42 views

function in update cursor

I have az update cursor loop, in which I'd like to use the function written earlier. Function: def TL (): addlayer = arcpy.mapping.Layer(r"gk25.shp") arcpy.mapping.AddLayer(df, addlayer, ...
2
votes
1answer
69 views

How to properly handle a multi-column value table in an ArcGIS Python toolbox?

I am building a relatively simple python tool for ArcGIS 10.3 which will automate the process of generating summary statistics for multiple raster datasets, for polygons in a polygon dataset, using ...
1
vote
0answers
40 views

Creating spatial layer from MS SQL Server table?

I have a table in MSSQL that I am trying to use to create a spatial layer from using the QgsVectorLayer function to load the table as a layer, and then using Fiona to create a shapefile but I am ...
0
votes
0answers
34 views

Error when using Natural_Breaks from PySAL

I am trying to reclassify a raster using Natural Breaks using PySAL, because this method is not implemented in ArcPy. I have checked this questions: Classification to attribute PySAL natural breaks ...
2
votes
1answer
73 views

AttributeError: 'module' object has no attribute 'classFactory'

I'm trying to compile a cython plugin for QGIS. The plugin is working on windows (32/64) machines but was never used on Mac before. I compiled the cython for python as described here but there are ...
1
vote
1answer
20 views

Why does setSubSymbol causes QGIS to crash?

I am having problems creating a multilayer line symbol with this code : symbol = QgsLineSymbolV2.createSimple({}) symbol.deleteSymbolLayer(0) symbolLine = QgsSimpleLineSymbolLayerV2() ...
0
votes
1answer
47 views

Create a World File from bounding box

What is the most pythonic way to create a Word File for a .png image, having only it's bounding box? For example, given the following bounding box: <LatLonBox> ...
0
votes
1answer
60 views

Copying point features along line features by predetermined distance

first post here. I searched the forum for this issue but other cases were slightly different. Anywho... I have points in a feature class. Each point has its centroid on a unique line feature in a ...
0
votes
0answers
28 views

Collector Python data editing

So just to start off with... I have a horrible rudimentary level of Python, so if someone plans on dropping code as an example, I will definitely have trouble following it. Apologizes abound... I do ...
1
vote
1answer
70 views

Pretty table python module with variable number of rows [closed]

Is there a way to produce a table in a txt file using pretty table python module, using an i variable for the row count for the case I do not know the number of rows from the begining? For example I ...
1
vote
0answers
23 views

Save selected features as… python [duplicate]

In a plugin I want to save the selected features in a new shapefile. I search and I try to create a new layer and write the selected fields and features in that: vl = QgsVectorLayer("Polygon", ...
0
votes
0answers
17 views

using import ogr in Arcgis python [duplicate]

I need to use import ogr in my python window provided by ArcGIS 10.2, but i can't configure ogr and gdal on my system. Please tell me how i can fix this issue and import ogr in my python window ...
3
votes
1answer
59 views

Writing a custom GeoServer WPS process or Data Store

I have a third party custom written database that I want to access where I can only return JSON from queries (with a location lat/lon) . I want to be able to visualize the results on a map. It will ...
0
votes
0answers
42 views

QGIS 2.8/.10/…crashes when I run, into PyQGis Console, a script within “exit command” of any GUI designed with the same pyQgis script code…Why?

I use QGis 2.8 or 2.10. I open Console PyQGis, so I can write Python specific code that I can design any GUI, as a simple Window Form. After I wrote this code I run this script created and it's ok ...
0
votes
1answer
138 views

Python: Point in polygon, boundary and vertex check (ray casting)

So I have written some code to check whether a point [(x,y)] lies within a polygon [(x,y), (x,y), (x,y), (x,y)] but the code fails if the point lies on a boundary or a vertex, I need this to be ...
0
votes
0answers
23 views

Python pyModis installation give error on windows 10 using pip install pyModis [duplicate]

I am using windows 10 operating system on my HP i7 machine with Python 2.7 installed. For windows, it is possible to install pyModis using pip by writing the following syntax in Windows PowerShell: ...
-1
votes
1answer
61 views

fiona writing geometry into shapefile problem [closed]

Context: I use lxml library that generates some dictionary (infact it is xml attribute dictionary) from xml and i am trying to write these into a shapefile-i.e. get one element-attribute from xml ...
1
vote
1answer
52 views

Change variables in QGIS 2.12 using python

Now it's possible in QGIS 2.12 to add your own variables, I wonder how I can add new variables or change variables using the Python console.
0
votes
0answers
26 views

gdal2tiles_parallel seems to be signiciantly slowing down for super high-res images

I have 3 images that I've been trying to 'tileize' 1 86,000*41,000 2 86,000*21,000 both are simple .pngs I've been using the parallel version of gdal2tiles on a DigitalOcean box with 20cores and ...
1
vote
1answer
34 views

Performing transformation with pyproj?

This seems like it should be straight forward, but I'm struggling to get the correct transformation from my state plane to lat long. My code is as follows # projection from ...
1
vote
2answers
90 views

Python script for select by attribute function for QGIS

The following is of course working, selects these features of my_layer that have attribute 1 for my_field2 and appends the corresponding attributes of my_field1 in my_list: my_layer = ...
0
votes
1answer
51 views

Improving performance of Clip using OGR?

I have a set of points which I am trying to clip to a set of polygons. The files have many features (150,000 polys, 8,000 points). I'd like to automate this process carry it out once a day, hence I am ...
1
vote
0answers
120 views

Boundless OpenGeo Explorer fails with Python errors

I am running this stack on a Windows 2012 R2 Datacenter. PostgreSQL 9.3.10 PostGIS 2.2.0 PGAdmin III 1.18.1 Geoserver 2.7.3 QGIS 2.12.0 Boundless OpenGeo Explorer 0.6.2 Everything runs ...
0
votes
0answers
15 views

ArcGIS AddIn to load qgis symbology

I'm looking to make an add-in for Arc so that I can load symbology created in QGIS. I'm familiar with Arc and the way symbology works in it, but I'm unsure what the best way to tackle QGIS symbology ...
1
vote
0answers
16 views

qgis python map canvas saveimageas save wrong image

I've been trying to write a small python script to output 2 tif's based on given box extents. The script all works, box coordinates convert to project coordinates, zooms to right place (would like ...
6
votes
2answers
410 views

How can I turn a python list into a table?

I am trying to create a table of coded values so each textual description has a numerical attribute. The order of numbers is not important - they just need to be unique. What I have so far is a ...
3
votes
0answers
85 views

Dissolving polygons in a large dataset

I need to dissolve polygons by the ID attribute in a large dataset (+-1gb shapefile). I have been struggling to find an efficient method to do this. I have tried the following methods: Postgis ...
0
votes
0answers
38 views

Using gdal in ironpython

I would like to replicate the following two statements GDAL python has: # project the decimal degrees to Mercator: gdalwarp -s_srs EPSG:4326 -t_srs EPSG:32631 -r cubic original.asc ...
0
votes
0answers
67 views

Cannot read TIFF files produced by ArcGIS in Python

I'm trying to use (1) PyLibTiff package maintained by Pearu Peterson & Joe Jordan and (2) module tifffile.py developed by Christoph Gohlke to read and write TIFF files in Python. I know GDAL can ...
1
vote
0answers
49 views

python - find lat lon in geotiff [closed]

I'm a python newbie. I have a Geotiff file. I need to find coordinates in the Geotiff to find the position of a thermometer within the geotiff (the thermometer has the coordinates ...
1
vote
2answers
71 views

What is the life cycle of arcpy script in arcgis?

In the code below just before the arcpy.AddMessage("Finished!") statement I have used a selection Query. The problem is that the newly created shape file Testing1 in which am firing the query is ...
1
vote
0answers
34 views

Extract raster values to multipoint shapefile and write to new field using gdal/python [duplicate]

I have a raster with one band and I would like to query a set of overlying points (.shp) to determine how many points as well as which points points fall under a range of certain pixel values ...
1
vote
2answers
71 views

Error with my python script

I am trying to write a string that will call for a error log. Here is the error I am getting: Python Exception <IOError>: [Errno 22] invalid mode ('r') or filename: ...
0
votes
0answers
23 views

import qgis works in Qgis desktop but does not work in Python [duplicate]

if i write in python 3.5 or 2.7 import qgis ImportError: No module named 'qgis' if i write the same in Qgis desktop scripting - i get no error. Did search the forum didnt find any answers, btw: ...
0
votes
0answers
93 views

CSV to Polygon.SHP with Python

I'm looking for a way to convert CSV file to polygons shapefile. I need to make polygons with defined size. In the CSV file, The first row is the length of each polygon and the first column is the ...
0
votes
1answer
107 views

Setting CopyFeatures_management output to newly created folder in Python script?

How do I set the output of the copyfeatures_management so that the shapefiles go into the new folder I created? Currently, they are being placed in my set workspace at the beginning of my code. ...
1
vote
0answers
42 views

Activate tracking for ArcGIS Online with python

It is possible to update data in ArcGIS Online by python-script: http://blogs.esri.com/esri/arcgis/2014/01/24/updating-your-hosted-feature-service-for-10-2/ Configuration is done by changing the ...
0
votes
1answer
62 views

'Result' object has no attribute 'GetMessage', ArcGIS Example

i'm using the following ArcGIS example to calculate the surface and volume of a raster. I added the script to my toolbox: ...
1
vote
1answer
42 views

Making lookup table for performing Lookup(inRaster, lookupField)?

I want to replace the Digital number (DN) values in a raster file with some other values which are present in a text file;in the text file, I have a table which it's first column are all possible DN ...