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

learn more… | top users | synonyms

2
votes
2answers
49 views

ArcGIS are two rasters the same? - including null values

I am working on a task to calculate Height Above Nearest Drainage (HAND) - that is the height above the nearest point along the flow path that is on a drainage - not the geographically nearest ...
1
vote
1answer
160 views

QGIS Python Labelling

i want to label a point layer with those values exceeding a set of variables attribute table as follows 'loc field'(text),'a'(float),'b'(float),'c'(float) variables as follows vara = 5, varb = 3, ...
2
votes
4answers
99 views

Summarising all fields in attribute table using ArcPy? [closed]

I was hoping to run a script that will iterate through all fields in an attribute table, SUM each field and produce the result in a table. The script below will essentially do what I want with one ...
0
votes
0answers
42 views

Duplicate FID for points

I ran the script below to export feature vertices to points. The code works but after 10,000 points the same FID appears for 5 to 10 points. This continues for the rest of the dataset. There are ...
2
votes
2answers
93 views

Calling QGIS from MacOS python

I would like to import qgis.core and utils from my own copy of python. I do have PYQT4 installed there. I'd be happy to add to my PYTHONPATH or sys.path.append in my code, where do the qgis modules ...
0
votes
0answers
26 views

Create polygon with predefined size

I need to create a polygon (square) with a predefined size to place it anywhere in a map. The size is given in centimeter (size in cm * scale = size in real). Is that possible with postgis/qgis?
1
vote
0answers
32 views

How to convert a raster file (*.tif) into a composite geodataset by using Python in ArcGIS 10.2.1

I created geotiff rasters (approximately 6000 rasters) in .tif format by using Matlab Mapping Toolbox. When I examined the properties of the data, I realised that it is 64 bit double type. I need to ...
1
vote
1answer
437 views

Converting Tab to Shp Using OGR2OGR with Python on linux

First i downloaded http://svn.osgeo.org/gdal/trunk/gdal/swig/python/samples/ogr2ogr.py and i am importing this. How can i get ogr2ogr to run in my script? nothing seems to be working and i not sure ...
2
votes
1answer
245 views

Why shapefile loaded in canvas always appear in random color?

I created the simple frame .UI file, compiled with pyuic4, and tried the ShapeViewer.py to load the shapefile "world_borders.shp". However, the map is always loaded in different random colors every ...
1
vote
2answers
92 views

Removing leading zeroes (0) when labelling in ArcGIS Desktop?

I am trying to do a simple labelling exercise however bit confused how to on how to remove unwanted '0' values. I have field with road number displayed like: 0000647, 000652, 0000000236 I would like ...
2
votes
1answer
297 views

Configuring spatialite database access for Python 2.6.6

I'm working on a GIS project, and I would like to implement and test some geo-spatial algorithms in Python. For this purpose, I will not only need sqlite, but also spatialite, in order to store and ...
1
vote
1answer
44 views

How to save changes in Feature-Geometry with GDAL/OGR and Python? (Segmentation fault)

I have a problem with my code: driver = ogr.GetDriverByName('ESRI Shapefile') dataSource = driver.Open('merge.shp', 0) if dataSource is None: print 'Could not open file' sys.exit(1) layer = ...
0
votes
1answer
527 views

ArcPy SelectLayerByAttribute Error and how to control GP output layer name

I have a rather long script that first references an SDE feature class (non-versioned) to perform an attribute selection based on a SQL selection. I've been unable to figure out why the script will ...
2
votes
1answer
44 views

Python Geospatial Development Error

I'm working through some examples in the Python Geospatial Development book by Erik Westra. On page 439, about setting up a tile map server, he gives the following code for calculating a bounding ...
-5
votes
0answers
37 views

How do i create a simple square polygon from Python through arcpy? [duplicate]

I do not need a google search result because I checked. I need to see a code. This has been super difficult for me. Please help.
1
vote
1answer
113 views

How to export a set of layers into multiple PDF(orAI)files, one layer at a time?

I am completely NEW to PYTHON(only took a 3-hr entry course in ESRI tutorial. I have a dataset contains files named as "1_A, 1_B, 1_C....12_A,12_B, 12_c,....200_A, 200_B, 200_C..etc." I need to export ...
0
votes
1answer
219 views

Orthographic reprojection with mapnik

I am trying to create a google earth like wep application. My problem is that I can't get to render a full view of the earth. The zoom_all() function generates the following error : RuntimeError: ...
1
vote
1answer
31 views

What is a OGRGeometryShadow and why can't I use it in Intersects()-method?

I'm trying to script something with Python and GDAL/OGR and Shapely. What I have: two LineString geometries: "geom1" and "geom2" I made an Intersection: "intersection = geom1.Intersection(geom2)" ...
0
votes
1answer
527 views

OSRM API - nearest point fed into routing

I am using the OSRM API to (1) determine the nearest point on a road segment from a give random point with http://server:5000/nearest?loc=_lat_,_lon_ The returned coordinates are used then as an ...
0
votes
0answers
44 views

Has anyone been able to programmatically generate and post web map definitions to ArcGIS Online and create web maps?

I'm using Python to build an ArcGIS Online web map definition JSON string, and then trying to post the configuration to ArcGIS Online to create a web map. I am using an admin account to generate the ...
0
votes
1answer
64 views

Python Script to Identify and Flip Lines Digitized in the Wrong Direction

I have a river dataset that was digitized both in the direction of flow and opposite the direction of flow. I need to find an automated method to determine which lines were digitized from downstream ...
0
votes
1answer
25 views

With QGIS Plugins/PluginBuilder, how to prevent 2nd instance of Plugin from starting

I am using QGIS 2.6.0, with PluginBuilder 2.0.3 [checking the version, I just noticed that the 2.1.0 update is available] I am writing a plugin; it installs and runs. While running, I am able to ...
7
votes
1answer
237 views

Efficient Network Neighbors?

I would like to identify the Kth order neighbors of an edge on a network, specifically the neighbors of a large set of streets. For example, I have a street that I'm interested in looking at, call ...
11
votes
1answer
498 views

Teaching Python to Land Surveyors

Does anyone have any good examples of using Python to automate or simplify common surveying tasks? I'm teaching a Python/ArcPy lab this week for a GIS class. There are a number of surveying ...
0
votes
1answer
34 views

Python buffer in a line using GDAL

I am trying to make a buffer from a line using gdal. I use the example in the gdal Cookbook import ogr, os def createBuffer(inputfn, outputBufferfn, bufferDist): inputds = ogr.Open(inputfn) ...
0
votes
0answers
19 views

Help with Parameters in Qgis Python lidartools:lasclip

I am trying to use the python console to batch quite a few processes from lastools. I'm having trouble with the arguments to lasclip. clipped_las = processing.runalg('lidartools:lasclip', True, ...
0
votes
1answer
130 views

Issue using Matplotlib in QGIS

I am developing a QGIS-plugin and for graphing I want to use matplotlib, like many other QGIS -plugins. This worked fine under linux, but under windows with QGIS2.4 I am experiencing problems. I ...
0
votes
1answer
19 views

Python OGR Geometry changes Floating Points

I'm creating a Polygon in OGR and adding coordinates to it in Python. It is a must that my coordinates aren't allowed to change when adding, however they do and I don't understand why. Here is my ...
0
votes
0answers
24 views

How to create a 8Bit unsigned geotiff with gdal?

I'm trying to create a 8 bit geotiff with this code. Is there a way to use unsigned 8 bit? I only found the GDT_UInt16? import numpy as np from osgeo import ogr, osr, gdal from osgeo.gdalconst ...
1
vote
1answer
138 views

Using GDAL to read dted files

How do I get the elevation at a certain point using gdal to read in a dted file? I don't see much useful information out on the web. I'm sorry I should have been more specific. How would I ...
0
votes
1answer
41 views

GPX to shapefile tool error message

I downloaded the GPX to shapefile tool and when I use it I get the following error message: 1 No module named re Failed to execute (gpx2shp).
0
votes
5answers
54 views

Aligning Raster Over the Polygon

I have a raster image which have to be aligned over the polygon. Both the raster and polygon have the same coordinate system. The figure shows the raster image which has to be fitted over the RED ...
5
votes
1answer
881 views

Interpolating Maps - Statistical Learning Techniques vs Spatial Statistics Techniques

I have recently begun experimenting with the interpolation of variales over a whole country. I have good sized training set where I have several dependant variables (continuous and categorical) ...
0
votes
1answer
108 views

Plugin QGIS Error “QTextEdit.setPlainText(QString): not enough arguments”

I try to make save as button but i got this error message when try to save file in my directory File "C:\Users\Mr.Pakde/.qgis2/python/plugins\condition\conditiondialog.py", line 80, in saveAs ...
1
vote
1answer
62 views

Computing intersections for each geometry in a table

I have a table with many Linestrings and for each of these Linestrings I need to figure out which other Linestrings, from the same table, intersect with it. If I recall correctly this gives me a ...
0
votes
3answers
45 views

Empty shapefile after project tool in a for loop

I am running a for loop to process a years worth of data. The entire script runs fine for the first run through, but when it runs again (when date is 1/2/2013), I get the following error: 'NoneType ...
1
vote
0answers
39 views

Generate random points in polygon. Algorithm question

i created a Random Point Generator in python using the algorithm described here by @whuber. The algorithm is implemented using Shapely, PostGIS and psycopg2. To boost performance pythons ...
1
vote
2answers
120 views

Adding layer into ArcMap via Python - .pyt versus .py

In the final step of a script I've built, I'm trying to add a layer into an empty blank map document. This is my block of python code below that adds the layer. Everything works fine if its run from ...
2
votes
1answer
192 views

Updating and inserting a field within the same loop

I am working with an empty feature class where I am writing a script to create polylines within the featureclass and attach an associated text value with the polyline. I am using a for loop as noted ...
1
vote
0answers
55 views

Splitting Line.shp at Point.shp with Python/ogr

I'm trying to modify some ESRI Shapefiles using Python with gdal/ogr module. What I want to do is quite simple, but I didn't find any solution by now. I have two shapefiles: (1) Lines.shp and (2) ...
-1
votes
1answer
49 views

Is there a way to execute tools based on the names of feature classes or raster names?

I would like to execute Zonal statistics as a table on two different raster layers that share a common element in their name. For example: one layer is called x_1980, and another layer is called ...
1
vote
2answers
91 views

QGIS Python Script - Routing along Waypoints [closed]

I used Anita Graser's script point_layer_to_route.py which worked like a charm until I updated to 2.6. With QGIS 2.6 I always get objects without any features. Can anybody tell me if he/she had the ...
0
votes
1answer
138 views

CSV Format change [closed]

Breakline Input File, Breakline Output file I get a breakline file from a CAD guy in below mentioned format. So I am calling this as a “Input” file. I am calling this as a “Output” file. I would ...
0
votes
0answers
99 views

Python script to get feature count in a feature class that fall in a specific range

I need to write a Python script to be used in the ArcGIS Field Calculator that will return a feature count for values between a range defined by the values in two other columns. Here is a graphic ...
0
votes
2answers
15 views

Error with layer.pendingAllAttributesList

While coding to obtain individual layers' attributes (field) list, I am stymied by the code. I can identify a specific layer: MyLayer = QgsMapLayerRegistry.instance().mapLayersByName("TestPoint") ...
7
votes
5answers
3k views

How to workaround large mosaic process which is failing?

I need to mosaic about 550Gb of tif imagery together and the software I have tried keeps failing. The area has been split into zones so that the smallest has approx 200 tiles. I have used the latest ...
0
votes
0answers
54 views

How to create shape file and show in map using Python?

I have calculated distance between longitude and latitude by import .csv using python. Now I want to show this points or distance between points in map. So how can i do it by using only python? and ...
0
votes
0answers
21 views

Python script to get count of features that meet a certain criteria [duplicate]

I am in search of a Python script for use in the ArcGIS Field Calculator to return the number of features that meet a certain criteria. Here's where I am getting stuck: def ...
1
vote
1answer
45 views

Using GDAL's GetProjection information to make a coordinate conversion in pyproj

I'm opening a geoTIFF file in Python using gdal. Upon reading with the GetProjection() method, I find the following information ...
1
vote
0answers
65 views

With QGIS, why use QT Designer tools for creating Slots/Signals/ etc, if plugin coding can do it alone

I am curious why there is facility within QT Designer to create signals and slots as, to my surprise, I did not need to do this. All of the necessary coding was accomplished completely within the ...