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

learn more… | top users | synonyms

0
votes
0answers
8 views

How to get linestringe from kml into shp or postgis [duplicate]

Im looking into extracting linestrings from a kml file into a shp file or postgis db. Each linestring would be a feature/row. How would I go about it usinge ogr2ogr or python? I'd like to get ...
1
vote
0answers
9 views

Python problem during CADInput installation

I was trying to install CADInput (version 0.60) on 2.4 Chugiak and 2.6 Brighton as well. In both cases I got an eror message during installation. For me the following extract of that message might ...
0
votes
1answer
24 views

copy only selected with CopyFeature_management

I am trying to test if each feature of a feature class list intersect each feature of a shapefile (clip layer). I'm working with arcpy in ArcGIS 10.0 The arcgis desktop help says that if the feature ...
2
votes
1answer
48 views

How to query values from a list in Python?

I have a list like this... list = ['1','2','3','4'] how can I use arcpy.Select_analysis to select features that have the attributes in the list. qry = '"SECDIVNO" IN ' + str(tuple(list)) ...
2
votes
4answers
61 views

Summarising all fields in attribute table using ArcPy? [on hold]

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 ...
1
vote
0answers
14 views

Set default values for value table in Python Toolbox tool

I created a Python Toolbox tool to reorder fields and create a new feature class with the reordered fields. The tool works nicely and I am able to use a value table to let the user arrange the fields ...
0
votes
0answers
26 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
65 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
21 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?
2
votes
2answers
90 views

Accessing geometry with SearchCursor in ArcPy

I'm trying to write a script that clips all feature classes in fcList by the successive rows of a clip feature. I'm using arcpy with ArcGIS 10.0 The problem is that I need to verify whether the ...
1
vote
0answers
24 views

Arcpy addin editable textbox on tool bar

I would like to add an editable toolbox on an arcpy addin toolbar. This would be used to change values of a threshold but I don't think this is currently available. (What I would really like is a ...
1
vote
2answers
63 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 ...
-4
votes
0answers
26 views

“UserAnswer” Invalid Syntax [on hold]

i having been making this for for just personal use, but when i run the program it seems to always come up with "Invalid Syntax" for the "UserAnswer" on everyone of them, please help... import ...
-4
votes
0answers
29 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
votes
0answers
39 views

Error creating polygons with ArcPy [on hold]

Based on the example from this page, running the code below results in an error message. Can someone take a look and tell me what I am doing wrong? import arcpy # A list of features and coordinate ...
2
votes
3answers
71 views

Converting personal geodatabase .mdb file to .gdb

Is it possible to convert an MS Access personal geodatabase file to a SDE enterprise geodatabase file format? What kind of python scripting would it entail? I need to convert it in such way to ...
0
votes
1answer
46 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 ...
1
vote
0answers
19 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
32 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 = ...
1
vote
1answer
24 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)" ...
1
vote
1answer
28 views
+50

How to create layer group in geoserver with gsconfig?

How can I create layer groups using python gsconfig ?
0
votes
0answers
24 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
0answers
13 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
16 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
18 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 ...
0
votes
1answer
29 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
1answer
18 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 ...
0
votes
5answers
52 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 ...
1
vote
0answers
28 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
1answer
45 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
2answers
13 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") ...
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 ...
0
votes
3answers
40 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
votes
1answer
48 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
57 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 ...
1
vote
0answers
41 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) ...
0
votes
0answers
85 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 ...
1
vote
1answer
31 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
45 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 ...
-1
votes
2answers
39 views

How do I import geos from shapely? [closed]

I clearly have geos installed under shapely, since I downloaded "Shapely-1.4.4.tar.gz". Also, the result can be seen in my directory in the correct path: ...
0
votes
1answer
59 views

How to label line features using python code?

I used the following code to label the line features(roads) in a layer.It works in the console, but not by python code(application) It works for the points too. What did I do wrong? Any help would be ...
1
vote
0answers
11 views

Python Band.SetNoDataValue(), sets all bands at once

Can someone tell me what I am doing wrong? I want to set bands 1 and three to 255, and band 2 to 0. The code below only should only set band 2, but gdalinfo shows that all bands get set to 0. Ubuntu ...
0
votes
1answer
37 views

How to add mdb geodatabase layer (feature class) to QGIS project using python?

I want to add a feature class of a personal geodatabase mdb to my qgs project by code (a plugin I am working on). I am using a command similar to that used for adding shapefiles, but this is not ...
0
votes
1answer
36 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
1answer
22 views

How to reference a return value from openProject macro?

It is very good to have available functions on startup.py, I created one to get the qgs project base name and referencing it as a Python expression on the composer thanks to all the information found ...
2
votes
1answer
38 views

Determine spatial average of several tiff files

I am relatively new to GIS. I have a set of tiff files containing a raster each. I would like to average them, though their extents are slightly different. They each have their geospatial data ...
2
votes
2answers
44 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
0answers
19 views

How to find QGIS or QT or Python object definitions

I am attempting a simple plugin, on QGIS 2.6, using the available QT Designer installed I have successfully loaded a plugin, and can display a dialog box with widgets, within, and now attacking ...
0
votes
1answer
46 views

How to set feature coordinates to values in attribute table?

I have some shapefiles that were produced programatically, and everything came out okay EXCEPT that the geometry information was not written correctly. The coordinates for each feature are null. ...
2
votes
1answer
56 views

Is it possible to render a large number of shapefiles to a pdf document using Python?

I'm extremely new to GIS, and recently made a map by loading a bunch of shapefiles into QGIS using a python script. However, it took 15 mins to scroll in or out on the image, and the pdf export ...