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

learn more… | top users | synonyms

0
votes
0answers
14 views

Spatialite in GeoDjango - “…they do not properly define db_type…”

I've started a new project and choose GeoDjango for it. Because I already developed with Django and sqlite as a DBMS and all worked perfectly fine for me, I found it a great option to use spatialite ...
3
votes
2answers
125 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
20 views

In qgis using python, how can I get multiple pixels from a raster based on a vector point file

I just started working with qgis, and for the life of me I cannot figure out how to solve this problem: I have several points of interest, these are stored in a shape file (just simple points). I ...
6
votes
3answers
1k views

Is anyone successfully using arcpy.ExportMetadata_conversion?

I don't know if it is a bug or my lack of python skills, but I keep getting 'ERROR 000816 The tool is not valid' in my python script when I call ExportMetadata_conversion Initially, I was attempting ...
0
votes
0answers
12 views

Is there a faster alternative to arcpy spatial join?

I am wondering if there is a more efficient method than using arcpy spatial join in python. I am currently using intersect and closest methods (including a near distance field) so would need ...
1
vote
0answers
16 views

Using tool validation to create parameter based on fields of another parameters input?

I'm assuming I'm missing something and this is a pretty easy thing to do but I'm stumped... I'm working on a script that currently takes and input excel file and uses a "hard coded" field name that I ...
0
votes
0answers
38 views

Alternative way to find intersection between two polygon feature classes

I have been working on making a script to find intersection between two polygon ArcGIS feature classes. I can successfully do this in arcpy instances using spatial join or using search cursors on the ...
0
votes
1answer
30 views

Loop stops before expected without error message

I try to run a script that clips all the feature class of a geodatabase by the successive features of a clip layer (named pochoir). Thank to support here and here, the test of the intersection is ...
0
votes
2answers
767 views

ArcGis Python Script, Calculate Field

Sorry for my English. I am trying to write a Python Script for ArcGis 10.2. #import system modules import arcpy import math from arcpy import env #Set environment options ...
0
votes
1answer
39 views

VB to Python for Labeling in ArcGIS 10.2.1

I am really new to Python and do not understand VB. I need to convert this VB script to Python. I think it may take me a few weeks to figure out but if someone helps me I would be grateful. The code ...
0
votes
1answer
90 views

Weighted Overlay - passing parameter as text error?

For some reason when hardcoding the save path for the wieghted raster just before runtime it works perfectly. Like such... arcpy.env.cellSize = "90" arcpy.env.workspace = r'G:\Xcel\Route ...
0
votes
0answers
22 views

gdalwarp hdf problem

I am working with some hdf files. The following command works on my Mac. command = gdalwarp -of GTIFF -tr 1000 1000 -tps -s_srs "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs " -t_srs ...
0
votes
0answers
11 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 ...
11
votes
2answers
649 views

Why learn/use Python Toolboxes over Python Script Tools?

I've written a few Python Toolboxes (which are new at ArcGIS 10.1), but am yet to decide whether/when I should write them rather than Python Script Tools in a standard toolbox. I thought the Online ...
1
vote
0answers
14 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 ...
1
vote
1answer
34 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
58 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)) ...
0
votes
1answer
226 views

visualize bounding box to a polygon

I try to make plugin in QGIS that compare 2 bounding box data, ex: (-32.61442167739459, -32.017601026186576, 13.015663782506067, 13.428145228091406) and (-38.6102467739459, -38.017601026186576, ...
2
votes
1answer
124 views

Error with da.UpdateCursor and SDE feature classes

I am making my first attempt at editing an ArcSDE feature class with python through a da.UpdateCursor. I'm essentially taking code I've written for a file geodatabase feature class and applying it to ...
2
votes
3answers
77 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 ...
2
votes
1answer
33 views
0
votes
2answers
229 views

Python Geoserver gsconfig create resource from Postgis store table

I've working Workspace and PostGIS store in GeoServer. I would like to use python and gsconfig to create new resource/new layer from existing PostGIS table, with: computing bbox, adding abstract, ...
6
votes
2answers
465 views

How to write scripts that can call on both Arcpy and PyQGIS?

I have spent quite a bit of time looking for a clear answer this topic and have still been unable to really accomplish my goal of accessing PyQGIS in a stand alone script. Parts of answers have been ...
3
votes
2answers
55 views

PyQGIS: Speed up for adding features and attribute arrays?

Context: I'm writing a dynamic import tool for QGIS (2.2 to 2.5) with python. Datatype: Binary Datasets with environmental simulations from HPC which might contain millions of features and terabytes ...
2
votes
2answers
45 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 ...
2
votes
1answer
131 views

calling gdal_merge.py into another python script running GDAL processes

Good Afternoon All, I am wanting to use gdal_merge.py to merge a series of .tif files prior to clipping the merged file to a shapefile boundary, but want to do so as part of another larger script ...
1
vote
1answer
152 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
75 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
16 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 ...
1
vote
1answer
115 views

Importing file geodatabase (GDB) to table of contents (TOC) of ArcMap?

I have a geodatabase with several feature dataset and feature classes associated with it respectively. I would like to create a .mxd where the Table of contents consist of group layer and each group ...
0
votes
0answers
34 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
69 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 ...
11
votes
9answers
7k views

Python GDAL package missing header file when installing via pip

I asked this question on Stack Overflow before I realised this site existed. As this site it more appropriate, I'll ask it here too. I'm trying to install gdal from pip pip install gdal inside a ...
0
votes
0answers
23 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
21 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
428 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
236 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
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
71 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
278 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 ...
-5
votes
0answers
27 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 ...
1
vote
1answer
37 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
499 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
39 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
31 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
43 views

Error creating polygons with ArcPy [closed]

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 ...
1
vote
1answer
93 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
210 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
25 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
510 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 ...