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

learn more… | top users | synonyms

2
votes
1answer
382 views

How to interpolate GPS data correctly?

I'm working on a project that involves using linear interpolation to fit lines to lat/lng points. I'm pretty new at scientific programming related stuff, and I was wondering if people could steer me ...
2
votes
1answer
315 views

Search cursor stops selecting after two iterations

I have a script which selects an extent from a grid and exports the data frame. import os, arcpy mxd = arcpy.mapping.MapDocument('CURRENT') df = arcpy.mapping.ListDataFrames(mxd,"Layers")[0] ...
2
votes
1answer
252 views

Writing python plugin: How terminate plugin from script without closing QGIS?

I'm writing a QGIS conversion plugin in python to be able to create Obstacle-files for a model from shapefiles. What I want to do now is just to close the plugin cleanly. This means, to close the ...
2
votes
1answer
149 views

Script to either rotate existing text element or insert graphic element

I have about 300 maps that contain a text element that needs to be rotated. I am pretty new to python but I have heard how great it is. This seemed like the perfect task for python but I have had no ...
2
votes
1answer
467 views

How to add one or more points to an existing polyline or polygon?

Using the following code, I make a polyline with two points. vl = QgsVectorLayer("LineString", layerName, "memory") pr = vl.dataProvider() vl.startEditing() fet = QgsFeature() ...
2
votes
1answer
388 views

View HTML field data with QT4 browers as a QGIS Run Feature Action Tool

I've successfully populated a sqlite table with an HTML-encoded-table as a field attribute, and so there is literally a Table within a single field value in sqlite, for each record. This is going to ...
2
votes
1answer
390 views

need help for script checking topology using ogr in python

My main goal is to create a new feature indicating if the line features intersect each other as well as if they are not connected to a feature. My problem is how to identify the intersecting and not ...
2
votes
1answer
286 views

OGR CreateLayer returns TypeError

I'm trying to create a shapefile layer based on the spatial projection of an already existing raster. (Ultimately, this will be used in gdal.Polygonize to get a shape from my raster data.) However, I ...
2
votes
1answer
160 views

Can not import qgis.core in python

I installed OSGeo4W. I have no other Python version on my computer. I can import osgeo. But when I try to import qgis.core I am getting the error: >>> import qgis.core Traceback (most ...
2
votes
1answer
455 views

How to transform KML from lon-lat to UTM (E-N), using Python?

I have a lot of KML files set as lon-lat (geographic coordinates) and want to set them as UTM (E-N) and WGS84 with Python (using arcpy, ogr, or gdal) Does anyone knows how to do this?
2
votes
2answers
108 views

How do I create a network from connected links

I have a bundle of links in 'some' networks. I need to find out which ones are connected to each other i.e. I need to find out which links are not connected to the 'main' network. I have been working ...
2
votes
1answer
903 views

how to add a query layer to a mxd in a python script

I want to add a query layer to an arcmap document so that whenever i have a db data update, it is reflected in my ma and I can update my service through python script. This is my script so far... ...
2
votes
1answer
438 views

Intersection of convex polygons on a spherical surface

There are a number of algorithms available for the intersection of two convex polygons, but I am interested in an algorithm to find the intersection of two convex polygons on the surface of a sphere, ...
2
votes
1answer
211 views

ArcGIS Desktop's registry value under “software” key[CLOSE] [duplicate]

Possible Duplicate: How can I programmatically get the path of “Python.exe” used by ArcMap I am trying to get some information from registry about ArcGIS. I am using ArcGIS Desktop 10.0 and ...
2
votes
1answer
514 views

Update Layer with python, error attribute renderer

I am attempting to automate symbology using python, and ArcMap 10.0. I am importing this script into a toolbox, which I run from arcmap Currently I am getting two errors: 1) LayerObject: Set ...
2
votes
1answer
468 views

How to re-project the EASE (Equal Area Scalable Earth) grid with a ~25 km cylindrical projection to WGS84 0.25 degree?

I have nc files ,here is one file https://echange-fichiers.inra.fr/get?k=LUfqiyO1Dl7az5bihnS. from the metadata ,the projection is cylindrical and the resolution is 25 km: ...
2
votes
2answers
374 views

How to add an image to an existing data frame using Python?

This is the first time I am using Python on my own, and I have searched for this answer for a few hours with no luck. I am wanting to take a .JPG image and put it in a data frame. The image has to ...
2
votes
2answers
560 views

Using reader Feature Type Name as Writer Feature Type Name in FME

I've search and searched for a way to do this, but no method seems to work. Basically I want to use the input feature class name (feature type in FME) as the output name. This normally works, ...
2
votes
1answer
335 views

Getting SAGA-GIS Python Bindings without compiling from source

I am very new to SAGA-GIS, but I recently developed a workflow using SAGA for processing LiDAR data. Now I need to batch the process using Python. I installed SAGA from the Windows installer and I ...
2
votes
1answer
266 views

automate color palette generation?

I frequently am in need of color gradients that aren't readily available through ArcGIS or the ColorBrewer add-in. I find the process of manually creating gradients in Arc very tedious: saved custom ...
2
votes
1answer
114 views

How to get empty gdb using python

I have one gdb with lots of layer (~500) and to receive empty gdb I delete all records from layers. I Use deleterows / TruncateTable but for one layers take abaut 1-3 minuts. Is better way (faster) ...
2
votes
1answer
381 views

How do I select * rows of multiple columns in one query using Select by Attributes within ArcMap?

I am trying to convert a psql query string into arcpy formatting for an UpdateCursor where expression parameter: '''SELECT ...
2
votes
2answers
653 views

Python: “Import Script” greyed out

I have a tool that I created from a Python script which I update from time to time. Usually I will right-click the tool and choose Import Script, but lately this has been unavailable, as shown below: ...
2
votes
1answer
308 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 ...
2
votes
1answer
251 views

Cannot add layer to map in arcpy

This is related to my question ArcPy replaceDataSource, but can anyone explain to me why the following code fails to add a valid layer from a .lyr file, and I get the same problems as in that question ...
2
votes
1answer
66 views

Collector cable optimizer

I'm hoping to find some pointers for a project that i'm supposed to be working on as part of a team. We're going to create an extension within ArcMap that uses python to process information within a ...
2
votes
1answer
175 views

How to construct a line from points in pyshp?

I am reading a shapefile for a pipeline and what I've noticed is that if I just draw a line from one point to the next (in the order I read them), there will be points where the line terminates, and ...
2
votes
1answer
340 views

Can I Dynamically Update Symbol Ranges?

Background: I'm currently trying to dynamically change the ranges for a layer with new style graduated symbology. Problem: I thought it may be as simple as updating the ranges for the existing ...
2
votes
1answer
2k views

Mapping x, y pixel coordinates to latitude and longitudes on the WGS84 datum

Apologies in advance for the long question, I am fairly confused at this point and I figure if I show my thought process any flaws early on in the piece can be more easily pointed out. I have a grid ...
2
votes
2answers
690 views

Updating polygon geometry: deleting inner rings with python

I've searched, but can't find clear explanations how can I simply delete inner rings from existing polygons with python or extract outter rings and overwrite the geometry. Seems GDAL/OGR should be the ...
2
votes
1answer
806 views

How to split geometry collection into its items using Python and QGIS API?

I'm getting some geometries via intersecting lines by polygons (somewhat blindly - I don't really know if intersection exists and actually I don't need to know) using python and QGIS API: ...
2
votes
2answers
467 views

Using osgeo modules in ArcGIS10.1 and QGIS 1.8 python shells

This is related to an old question of mine - Issues with osgeo - qgis.core and arcpy modules Now in new versions of all the software QGIS Lisboa (1.8), ArcGIS 10.1 and pyScripter 2.5.3. They all use ...
2
votes
3answers
290 views

Simple script in ArcPy to analyze building proximity to restaurants

I am trying to make a script that will go through buildings in a shapefile row-by-row and do a count of points within .25, .5,...1 mile of it. The other points are restaurants. import arcpy ...
2
votes
1answer
285 views

How to manipulate OpenStreetMap schema to be useful in ArcGIS applications?

I have a shapefile of OSM data. I plan to use the data for an ArcEngine application, and I was wondering if there are any existing solutions to getting the data's schema into your typical GIS format. ...
2
votes
1answer
264 views

Creating a model to run a complex query

I'm just a rookie when it comes to creating models in ArcGIS. I have two shapefiles from which I need to calculate an AVG and a MAX erosion rate for individual properties. The two shapefiles are: ...
2
votes
1answer
409 views

How to create new layer within a DXF file?

Using OGR in Python, I'd like to create some geometries within a DXF file, but not in the "0" layer, but in new ones. I tried with: import ogr, os, osr, sys ds = ...
2
votes
1answer
1k views

Add AutoCAD .dwg annotation file to Arcmap using python (Same as +ADD Data button)

I would like to add an AutoCad .dwg file to Arcmap using python the same way that the +ADD Data button does. I can add an Annotation layer with python but only as a feature layer not as an annotation ...
2
votes
1answer
579 views

How to include mapnik lib in python 2.7

I am using python 2.7 now in want mapnik to be included in python. I have use exe file to include other library file like GDAL, and other. But for Mapnik can any one suggest me any exe like that so it ...
2
votes
1answer
116 views

Generate a global view Image of where a Lat-Long location is

I would like to automatically generate an image which highlights a location from a global view. Here is an example of what I would like to achieve: I am debating using python utilities such as ...
2
votes
1answer
626 views

How to display local file's geometries as rubber bands in QGIS

I'd like to get geometries from a local file (e.g. GML) displayed as rubber bands (QgsRubberBands) in QGIS. However, I wouldn't like to load the layer into the map because in the real scenario there ...
2
votes
1answer
150 views

Any reason NOT to convert to a single projection when loading GIS data?

I have been given the task of: Loading a list of properties with lat/long coordinates into a SQL Server 2008 database. Loading points and areas (polygons) of interest from a variety of shapefiles ...
2
votes
1answer
936 views

How to use SQLite db with QGIS plugin?

Hi I would like to use SQLite for storing some information in my plugin for QGIS. I have a problem: if I put the db let say test.db among the resources as file, after compilied the resorce.qrc file, ...
2
votes
1answer
359 views

How to add Real Attributes to Shapefile using pyqgis?

I created the Qmarxan plugin using the fTools plugin as an example base. When I create a new shapefile using the QgsVectorFileWriter function I don't have any difficulty specifying a "Real" field with ...
2
votes
1answer
518 views

Removing duplicate features in PyQGIS

I'm trying to remove duplicate features from PyQGIS. Manually I can do it by using "Edit -> Merge Selected Features" and then "Multipart to Singlepart" from fTools in QGIS, but can this functionality ...
2
votes
1answer
814 views

How do I change a raster's geotransform with GDAL?

I'm trying to use GDAL to set the geotransform of a new raster that I've created by following the steps outlined in the GDAL API Tutorial. # create the new dataset driver = ...
2
votes
1answer
214 views

clipped data not going into the folder

I created a model in python that clips and converts different data sets into DWG based on the the grid number. I will like the DWG data (Output) to go into the folder I created as part of the ...
2
votes
1answer
670 views

How to save and reload legend settings using Python?

Maybe you can help me with maybe a strange question. I know how to change settings of a legend individually by arcpy (like: Patch, Title, Items, Columns, Frame, Element Size&Position, etc.), but ...
2
votes
2answers
487 views

QGIS 1.7.3 and pyqt4 version mismatch

I installed QGIS 1.7.3 using OSGeo4W installer.I have python 2.7 and pyqt4-py2.7 installed on my system.My system paths are: ...
2
votes
1answer
524 views

The minimum bounding circle of geometry that crosses the 180th meridian

Background: I've been given a task where I have to calculate the minimum bounding circle of Alaska (for the purpose of running a Roeck test). I'm using the Census' state level geometries available ...
2
votes
1answer
2k views

how to calculate RMS 2D and RMS 1D, using python?

I would like to calculate: RMS 2D: standard deviation for the two coordinates of flat (67% confidence level) and RMS 1D: standard deviation for height (67% confidence level) What is the formula and ...