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

learn more… | top users | synonyms

1
vote
0answers
10 views

How to install xlw and xlrd libraries on MacOS so that QGIS Python can see them?

I experience a problem with XYtools and need to install Excel libraries for Python. I tried to install them directly from the terminal and it worked on the system, however, how to import them into ...
1
vote
0answers
19 views

How to open a shapefile using ArgParse in Python? [duplicate]

I am trying to open a folder of shapefiles along with their associated files (i.e. '.prj, .cpg' etc) using Argparse in Python. I'm not sure if the code below is a good place to start: parser = ...
2
votes
1answer
31 views

Convert CSV file format to Breakline CSV format file [on hold]

I have a csv file with almost 36000 rows.The format of csv file is x,y,Polygon number, Z I would like to arrange this csv file in the below mentioned format. Let’s say in this example, Polygon ...
3
votes
0answers
30 views

Merge RGB band using python

I need to merge the RGB bands of three TIFF images. I'm trying to use a PIL library (Python Imaging Library), but this execution error happens: Traceback (most recent call last): File ...
4
votes
1answer
69 views

Problem Editing a Vector Layer QGIS

I have a vector layer which I need to load and edit (add several attribute columns). I am doing this without opening QGIS, so within a python script. I have the following piece of code for the layer ...
1
vote
1answer
16 views

Unable to call otbApplication from python

I have been tryng to use some of OTB functions from python, but i am unable to import the module (otbApplication), even after to adding the PYTHONPATH to my basrc file. I am working in Ubuntu14.04, ...
-4
votes
0answers
41 views

Need help on this piece of Python code [on hold]

why this code doesn't work? It work if I replace R6G to G and m[0:3] to m[2]. def n(m): if "R6G" in str(m[0:3]): return '60_Green' else: return 'No Match'
0
votes
0answers
43 views

How to read shapefile faster using python basemap (and pickle)?

I am trying to plot a simple 'merc' map with boundary from shape file. The total size of the shape file ne_10m_admin_0_countries_lakes.shp is just 8mb. The simple mslp surface plot from GFS data took ...
0
votes
1answer
25 views

Problem with read_shp() in NetworkX

I'm trying to convert a shapefile of only line geometry (a street network) to a NetworkX graph to run some connectivity algorithms on it. I'm running into this issue: File ...
3
votes
0answers
46 views

ArcGis' python library (arcpy) are imported so long

python -c import time; t1 = time.clock(); import arcpy; print('{0} seconds'.format(time.clock() - t1)) 3.60283379862 seconds It takes this long each time i launch my script or test. Is there any ...
1
vote
1answer
18 views

GDAL Python: how to extract a cutline from VRT file in world coordinates?

I'm trying to extract the world coordinates of a cutline (clipping polygon) in a GDAL VRT file. Unfortunately, the cutline is stored in image coordinates (pixels), and i could not find the right ...
1
vote
1answer
53 views
+50

PackageLayer_management failing within script, needs to run outside of an ArcMap session

I'm automating a workflow that requires outputting a layer package, it throws the general ERROR 999999 when executing and breaks. It does, however, generate a folder in the correct directory, with ...
0
votes
0answers
25 views

Choosing the right region of interest [on hold]

I am using this code in order to track the dog in this video. At first it seems to work but then window cannot follow the dog. I think the problem is the region of the window. I set the variables ...
2
votes
1answer
30 views

How to calculate a curve distance between two xyz points?

I have a curve surface (example is attached). Each node has its own coordinate in geographic system (longitude,latitude and depth). I want to calculate a distance between two nodes (from the one on ...
2
votes
1answer
25 views

Encode an azimuthal equidistant projection in NetCDF conversion

I'm trying to do Azimuthal Equidistant in CF-compliant NetCDF, but I didn't get the correct projection. If you compare the first two information (gdalinfo) you see there is no AUTHORITY and also ...
1
vote
1answer
39 views

Cut a linear feature according to the directions or azimuths

I have a shapefile linear that contains a single items as in the image and I want to divide it into several section respecting the azimuth and the line direction. i have this code : import os ...
0
votes
0answers
6 views

Extracting GDB files from zips - If exist, rename and move: If not, just move. Python [migrated]

Currently trying to develop a catch all script that when pointed to a folder it will look through all of the subfolders and anything that is a .gdb will be moved to a new folder, if the GDB files have ...
1
vote
1answer
36 views

Calculate Field throws an error when parsing python with backslashes

I have an FTP I need to access through a python script. It works fine with forward slashes, but I don't need it to be read as an html. Below are both sets of code: Working: ...
5
votes
1answer
42 views

Stacking Vector Layers in TileStache

I am serving several vector tile layers of different geometries (point, line & polygon) in TileStache using VecTiles:Provider, with this cfgfile: { "cache": { "name": "DISK", ...
1
vote
1answer
58 views

Can't write decimal data into shape (shp) attribute table with Python

I am trying to create a shapefile with Python GDAL/OGR library. I add to it a real number field, but when I write into it doesn't appear as it should but rounded. I will explain better with the code: ...
1
vote
1answer
49 views

Moving file geodatabases in python without ArcPy

Please find my script below currently all i'm wanting to do is iterate through a folder and any subfolders extracting anything that is a .gdb directory + its contents to a new folder. import shutil, ...
2
votes
1answer
32 views

Importing Several Raster Layers, Doing Manipulations and Exporting The Newly Saved Rasters

I have the following code: src_ds = gdal.Open("/home/usr/Desktop/RasterFolder/Name.tif") if src_ds is None: print 'Unable to open %s' % src_filename sys.exit(1) myarray = ...
-1
votes
0answers
12 views

analysing height data using dem [duplicate]

i ran the following code on python 2.7: import sys, struct from osgeo import gdal from osgeo import gdalconst minLat = -48 maxLat = -33 minLong = 165 maxLong = 179 dataset = ...
0
votes
1answer
39 views

Analyze height data using a digital elevation map

i ran the following code on python 2.7: import sys, struct from osgeo import gdal from osgeo import gdalconst minLat = -48 maxLat = -33 minLong = 165 maxLong = 179 dataset = ...
3
votes
1answer
31 views

Lookup Projection Name from EPSG with pyproj

Is it possible to programmatically lookup a projection's name (e.g. Albers Equal-Area) from its EPSG using pyproj? I see pyproj.pj_list, but it does not contain a mapping to the EPSG. Thanks.
2
votes
0answers
9 views

Qt TextLineEdit: Retrieve string instead of QString [migrated]

I am using Qt and want to get string from text field. I found below solution but it returns a QString. I just want to avoid writing extra code to extract string further. Can anyone suggest a simple ...
0
votes
0answers
37 views

Convert WGS84 coordinates to ECEF Cartasian (XYZ) coordinates using pyproj

I need to convert WGS84 to ECEF to map some points to a 3D sphere. I've trawled through the pyproj docs, but can't find specifics on the matter. Basically I want to input the WGS84 GPS lon/lat ...
0
votes
0answers
26 views

(python) distance between a point and a list of segments

I have a line (made of multiple adjacent segments) and a set of points, and I want to find all the points which are within a given distance (40m mainly but could change) from that line. segments ...
0
votes
0answers
42 views

Adding a Field to a Feature Class using Python

I'm trying to create a script that adds an integer field to a File GDB, calculates it, buffers it, then clips it to a different GDB featureclass. Can anyone help me, I'm stuck so far!? I'll provide my ...
0
votes
1answer
19 views

GRASS parser() error

I'm trying to use GRASS on python 2.7, but I'm having some problems at setting my script on IDLE, then I'm getting an error at parser() function: Here is my script: import os import sys gisbase = ...
4
votes
1answer
39 views

How to toggle group visibility in QGIS using Python?

I've tried this, but it doesn't work out. root = QgsProject.instance().layerTreeRoot() group1 = root.insertGroup(0, "PGB") legend = i.legendInterface() legend.isGroupVisible(group1) ...
1
vote
1answer
37 views

Building QGIS 2.8.6 on Win 7 32bit?

I'm trying to build QGIS 2.8.6 on Windows 7 32 bit using MSVC Express 10. The build process completes without errors, but with a bunch of warnings. When I run the qgis.exe after installation, it only ...
0
votes
1answer
25 views

How to delete features/records in ArcGIS Online hosted service using Python

How to delete features/records in ArcGIS Online hosted service using Python? I need to delete some features using Python from a feature services hosted in ArcGIS Online. I read a similar post that ...
0
votes
1answer
54 views

Is there a python-module to convert data to a Shapefile (w/o GIS)?

Input data can be excel, text, whatever. I would like to produce shapefiles from data on a computer without GIS installed. Is there anything out there? Fiona seems to be such a module. Are there any ...
0
votes
0answers
32 views

Python GPS Observation Equations

I've been trying to write some code that will take pseudo-ranges and satellite positions and then compute the observer's position. I've been trying to follow through this book, but the crucial stage ...
1
vote
0answers
19 views

Foreign Key error, creating new splite db?

Attempting to use a plugin in QGIS (midvatten) that utilizes splite. I am attempting to create a db in a different EPSG than the plug in defaults to, im getting "foreign key constraint failed" as my ...
2
votes
1answer
42 views

QGIS - PYQGIS Import gpx as vector layer

I'm trying to use the python console to import some gpx files as vector layers. When I do it manually I have to choose which layers to add, my options are: I've tried various versions of the code ...
0
votes
1answer
26 views

TopoToRaster Tool Execute problem in ArcGIS

I am trying to execute TopoToRaster tool (ArcToolbox>3D Aanalyst Tool>Raster Interpolation>Topo To Raster) in arcGis 10.0 with .NET. Topo to Raster Input But get exceptions. My code is here : ...
2
votes
0answers
40 views

How do I speed up testing debugging when I am loading a large module as part of my program? [closed]

I'm using PyScripter to do some python geocoding automation and I'm coming across the situation where I am waiting several tens of seconds for a large module to be imported. This is very inconvenient ...
0
votes
0answers
26 views

First time rasterio error

First of all, I am new to python and rasterio. I am trying to open a simple raster with 5 bands using the rasterio module in python. This is what I am trying to achieve: import rasterio with ...
0
votes
1answer
53 views

QGIS loop/iterator with python in function editor (field calculator)

I am trying to create a loop to rename the fields of my attribute table. The fields should start at 1 and increment by one until the end of the table (e.g. 1,2,3,4,5,...,n) my code on the python ...
2
votes
2answers
40 views

Is there a size limit when adding features to ArcGIS Server programatically using POST?

I'm inserting new points using the ArcGIS Server REST API addFeatures method - this is working correctly. However, I'm finding that when the JSON reaches a certain (undefined) threshold the POST ...
1
vote
2answers
42 views

Recording the ArcPy script execution method

I have composed an ArcPy script which is run via a windows scheduler.The same script is loaded into a script tool so a user can run the process manually. I've used: get parameters as text, with or's ...
1
vote
0answers
19 views

Preparing CliMond data for Maxent

I had been working with BioClim data and that was working in Maxent. I could clip files and realign them etc. Now I have some data from CliMond which is in two formats: Either as text files ...
1
vote
0answers
13 views

Python error in go2streetview plugin

We have the go2streetview plugin installed in QGIS 2.8.6 Wien and when performing a search using this plugin, the following error appeared: An error has occured while executing Python code: ...
3
votes
1answer
67 views

python script for opening webpage directly in qgis

I have a shapefile with points reffering to a webpage with a photograph. Untill now I define an action to open the corresponding webpage in firefox. Eg. I have to share my project. Because I don't ...
1
vote
0answers
41 views

Cannot import name QtTest running unittests for QGIS plugin

I have the following imports in my unittest code: from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4 import QtCore, QtGui, QtTest When I run my unit test from the command line I get ...
3
votes
1answer
46 views

Automating Interpolation in QGIS

I have a project in QGIS which involves interpolating several different variables on several different maps, then using the raster calculator to multiply some of the resulting interpolations together. ...
1
vote
1answer
40 views

QGIS Zonal Stats Plugin - Python Console - compute one specific statistic

I think this is more of a syntax problem that I have here. But I am absolutely not able to figure it out. On a different Linux machine I got the following working: zoneStat = QgsZonalStatistics ...
1
vote
1answer
26 views

How to export Mapnik style to XML?

I would like to create Mapnik style using Python API and export it to XML-file. Creating style part is clear enough API has sufficient documentation. But I wasn't able to find function that does the ...