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

learn more… | top users | synonyms

0
votes
0answers
2 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
34 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
38 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
20 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 ...
2
votes
0answers
41 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
15 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 ...
0
votes
0answers
24 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
29 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
21 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
37 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: ...
4
votes
1answer
32 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
57 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
46 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
28 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
38 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
30 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
35 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
41 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
18 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 ...
-6
votes
0answers
27 views

Exporting Multi Maps like JPEG,etc with Python? [closed]

I need to Export Multi Maps like JPEG or .... ETC with Python
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
25 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
52 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 ...
0
votes
0answers
32 views

Equivalent to .replace() for integers? [closed]

I've recently been using the str.replace() method to change field values in string fields. Since this seems to be way faster than calculating field values, i was wondering if there is an equivalent ...
2
votes
2answers
38 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
votes
0answers
18 views

Python Script for seeing if 2 polygons overlap or not [closed]

I am trying to create a function that would tell me whether two polygons intersect or not with the inputs being the lower left, lower right, upper right, upper left of each polygon. Such as ...
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
12 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
66 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
45 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
37 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 ...
0
votes
1answer
54 views

QGIS - what is the core database system? [closed]

What is the core database system used by QGIS? When you launch an existing project that has multiple .shp files (with associated .dbf tables), is the core db system used to convert that data to its ...
4
votes
2answers
54 views

performance problem with PyQGIS: manipulating attributes

I have selected a vector layer with attributes slope and area. I want to combine all the features with slope 0 to 5, 5 to 10, ... , 85 to 90. The original features are to be discarded, and new ...
2
votes
1answer
107 views

How to detect corner of shapefile in python [closed]

Is there any way to detect corner of each shapefile in python !? (not BBox) Or somehow to detect the edges? I want to detect each shapefile vertices to calculate the differences in latitude for my ...