Tagged Questions

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

learn more… | top users | synonyms

0
votes
0answers
182 views

SEXTANTE runalg and QgsVectorLayer issue

I'm trying to make a script for converting polygons to lines. But I'm having some issues while generating temporary layers. In this script, I iterate through all the features of the input layer to ...
1
vote
1answer
361 views

Python GDAL/OGR: WGS84 & meters units

I'm dealing with shapefiles projected in: GEOGCS["GCS_WGS_1984", DATUM["WGS_1984", SPHEROID["WGS_84",6378137,298.257223563]], PRIMEM["Greenwich",0], ...
3
votes
1answer
968 views

How to use a feature set as an output parameter in a Python Toolbox?

I'm having trouble setting a "Feature Set" output parameter from a .pyt .. I'm using ArcGIS 10.1 SP1. Here’s a short script that can be invoked either from a classic toolbox (thru the main() ...
1
vote
1answer
351 views

How to add layer/raster with specific position in the QGIS layer list?

I use addRasterLayer(rast,'Name') but this adds the raster to the top. It is possible to set position when I add raster at once? Is it possible??
2
votes
0answers
384 views

Use GDAL/Python to add rasters (tiff) to an ESRI File Geodatabase

I'm using GDAL python to create a bunch of tiff files from a netcdf file. def modelout_to_geotif(netcdfile, outdir, VarName): """ Given the path to the netcdf output, produces geotiffs for ...
1
vote
1answer
326 views

Creating an Origin/Destination (OD) cost matrix using ArcPy

I have created a python script that runs an OD cost matrix over five years from 1999 to 2004. I have set up an OD cost matrix for each year, which I think is very cumbersome. Is there someone who can ...
0
votes
0answers
292 views

Create a polygon shapefile using point as boundary

Following have two problems: I am now have 4 point in a shapefile and I want to set the point's coordinate for boundary of a polygon The points are xmin, xmax, ymin, ymax that can just be a ...
1
vote
0answers
300 views

Python Addin toolbar- Environment mask parameter not being recognised?

I've created a button on a python addin toolbar which uses the selected features from the selected layer in the TOC, creates a feature layer from that selection and uses that feature layer to set the ...
2
votes
2answers
98 views

How to reproject all featureclasses in a database to another database?

I am very new to arcpy and have ArcGIS 10.0 I would like to make a script where I would only have to change two variables in a script (database_input and database_output) so that I can reproject all ...
2
votes
1answer
189 views

How to store attributes of a large shapefile in a list?

I am trying to store the attributes of a shapefile into a list. With following code it works for smaller shapes: addA = [] While provider.nextFeature(feat): attrs = feat.attributeMap() for ...
1
vote
1answer
706 views

Python GDAL: degrees to meters without reprojecting

I am trying to get senseful results in my Python script. I want to measure distance between features in a shapefile. I'm working with the SRS: GCS_WGS_1984, so my units are in degrees. But for the ...
0
votes
0answers
158 views

Dynamically generating data for map tiles from Python function

I'm brand-new to GIS and relatively new to web services. I've found a ton of great resources on the web, but I'm having trouble addressing one specific issue: One of the data layers on my planned map ...
0
votes
0answers
84 views

Sextante script for statistic info

I want to generate a script for getting statistic information window from selected feature. For example i have two layer building(polygon) and railway(linestring). By using this tools i got a window ...
1
vote
1answer
438 views

ARCGIS Python script (needs a raw input line to let the user choose the output file name)

I just need a quick fix here. Having trouble finding a way to allow the user to input the new output file name (the one that is created after the buffer function completes). Any ideas? I am also not ...
20
votes
3answers
5k views

Simple thematic mapping of shapefile using Python?

I wish to visualize geographical data in Python, without using ArcGIS/ArcPy, and make a map. On the internet I found how to make a thematic map using Python: Here is some code that I tried: ...
1
vote
0answers
309 views

How to write vector layer to csv file with geometry by PYTHON?

I use Python try to write vector layer file to csv file with this code QgsVectorFileWriter.writeAsVectorFormat(mylayer, r'c:\temp\xyz.csv', "utf-8", None, "CSV") It can export to xyz.csv but only ...
1
vote
1answer
218 views

how to loop grass command in python and put variable in output file

anyone, first day Grass programming with python scripting; first prob; simple I want to reclass the same raster several times; and save the file with the value loop variable at the end ... can not ...
0
votes
1answer
298 views

Apply Symbology to a group layer

I currently have around 200 features that all need have the same symbology applied to them. I have used the ApplySymbologyfromlayer_management however this takes much to long to process, at least a ...
4
votes
1answer
669 views

How to set up Python 2.7 to work in both QGIS and ArcGIS?

I have both ArcGIS 10.1 and QGIS 1.8 installed and both include Python 2.7 in slightly different setups and in different folders (c:\Python27\ArcGIS10.1\ and c:\Program Files (x86)\Quantum GIS ...
1
vote
1answer
156 views

How to iterate all input folders (containing coverages) using Python with ArcGIS 9.3?

I'm trying to write python scripts to batch convert thousands of coverages to shapefiles in arcgis 9.3. The coverages files are in different folders: d:/area_A/building d:/area_B/building ...
1
vote
1answer
182 views

How to set a spatial filter with Python/GDAL?

Is there a way with GDAL (Python) to set a spatial filter (bounding-box) on a raster before I process it? I want to read it as an array. BandReadAsArray(band, xoff=0, yoff=0, win_xsize=None, ...
6
votes
4answers
1k views

How to check via Arcpy if ArcMap is currently in an edit session or not?

I've created a Python add-in button that helps speed up my coworkers workflow by copying one feature class attribute to another. It uses the arcpy.UpdateCursor function to update a row in the target ...
5
votes
2answers
336 views

How to create a point along a line given a distance from another point

I'm trying to figure out a point(D) on B-C that is a specific distance from A. I really don't have any idea on how to proceed with the ellipsoidal math so I figured I'd ask here. How would I figure ...
1
vote
1answer
200 views

OD cost matrix Arcpy [closed]

I'm trying to create an OD cost matrix python script. I'm doing an OD cost matrix analysis. I'll find out the average time with patients to hospitals over 10 years. When I do this analysis, the ...
2
votes
2answers
380 views

Python Code: “Compare two fields and select missing records”

The code I wrote is not right!! It's selecting more than what is actually missing. I think I'm wrong on the matched code line. I need the script to make a list of the "FLAG" field and a list of the ...
2
votes
3answers
800 views

Efficient algorithms to split and join lines?

Referring to the Figure below: How to efficiently join segments into lines? How to efficiently break lines into segments? The above will be applied million times.
3
votes
1answer
167 views

ArcObjects (VB.Net) Python Integration with object passing?

This link illustrates one method for calling python scripts from within an ArcObjects environment. The results of these tasks are returned as strings. I wonder if it is possible to call a python ...
1
vote
0answers
150 views

Change ArcGIS License using Script [duplicate]

I am using ArcGIS Desktop 10 and we have three different servers for accessing concurrent use licenses of ArcView, ArcEditor and ArcInfo. So, whenever I need to switch to other product, I have close ...
2
votes
1answer
328 views

Combining polygon geometries with python and QGIS segfaults

I am trying to combine polygons, using Qgis 1.8, and every time I run this script in the python console, I get a segmentation fault. Here is the script: from PyQt4.QtCore import * iface = ...
0
votes
0answers
36 views

How to change value of an Line edit dynamically

I create a form in QT4 and compile with pyuic4. it create an form.py I want to modify the value of the line edit dynamiclly with code. I put this code in the form.py but never happen: ...
0
votes
1answer
90 views

Make many lines in one layer (Python)

I what to create many lines with this code: v_layer = QgsVectorLayer("LineString", "cable", "memory") pr = v_layer.dataProvider() seg = QgsFeature() ...
8
votes
1answer
180 views

Difference between python window and toolbox

Are there differences in performance or other potentially critical area between running a python script in the python window versus running it from the toolbox in ArcGIS 10.0? I am asking in cases ...
5
votes
1answer
870 views

Python - OGR: Transform coordinates from meter to decimal degrees

I have a point in a shapefile. The shapefile is in a WGS_1984_Web_Mercator Projected Coordinate System. I want to get the coordinates of that point in decimal degrees with GDAL/OGR in Python. I am ...
0
votes
2answers
83 views

Python to get ids from shp dont return all records

I have some Python code to get the ids and georeference from a shapefile: canvas = qgis.utils.iface.mapCanvas() allLayers = canvas.layers() nos = QgsFeature() for i in allLayers: if ...
0
votes
1answer
101 views

How to convert geometry of SHP to decimals

I try to create a line with two points. These points are obtained in a SHP layer. How can i convert that points to decimals? Thank you
13
votes
1answer
318 views

Watermarking photos using their geotag and create a shapefile

I have geotagged photographs and I would like to place a watermark of the photos location on the front for easy reference as well as creating a shapefile from the coordinates. Does anyone know of any ...
0
votes
0answers
214 views

python script to calculate and return values based on several conditions

I need to calculate and return the value "continuous" to those records in a polygon feature class with species records aggregated to a UTM grid considering the attributes are species name, grid code, ...
1
vote
1answer
834 views

How to use CURRENT map document in Python tool?

I am attempting to use this code in a tool that I am working on: mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd)[0] XMIN = df.extent.XMin YMIN = df.extent.YMin XMAX ...
0
votes
0answers
29 views

How to get Perpendicular cross section along the river using python and Arc Map 10? [duplicate]

I need to draw the perpendicular line segment along the river at a regular interval. How can i obtain like this output using Python and Arc Map 10 ? I would be very grateful if you give some idea..
4
votes
2answers
256 views

Python split table by “State” field and export to individual tables?

So I have never posted here before. I have used the site a lot for help so many thanks to all the great contributors. So, I have used ArcGIS online to perform batch geocoding (18,000) records and it ...
0
votes
1answer
175 views

QGIS Python - Convert geometry from Postgres to QgsPoint()

I have made a query in Postgres to get some points to use with python. This points are in geometry data. How can I convert that geometry in decimals to use QgsPoint() in python? Thank you
-1
votes
1answer
699 views

How can i draw a perpendicular line in a stream segment in a regular interval of 30m? [duplicate]

I have a stream segment which is polyline feature. Now I want to draw a line which is perpendicular to stream segment at a interval of 30m. How can i do it using python ? Do you have idea on this .
1
vote
1answer
192 views

Can I open a form in layer action?

I want to open a form (made in QTDesign) in the layer action. It is possible?
4
votes
2answers
212 views

Accessing arcpy functions from IronPython

I made a few python scripts to automatically optimize and publish my data.. Now i'm thinking about writing a .NET program to manage and run these scripts: the obvious way is invoking them in a ...
0
votes
1answer
712 views

How to insert values from one table into another?

I am trying to write a script that iterates through each row of a table, calculates for this row something. The result of this calculation is finally stored in another table (with just one row). Now I ...
0
votes
0answers
18 views

QGis non blocking notifications with pyqgis [duplicate]

I'm searching for the way to use the new QGis non blocking notification system with the QGis python wrapper. I found informations on this fonctionnality but nothing on how to use this especially with ...
2
votes
2answers
277 views

Tabulate Area crashes Python and ArcGIS

I have a script that runs Tabulate Area on a single feature class multiple times with different rasters. In total Tabulate Area runs 5 times. 2 of the input rasters are provided as arguments to the ...
2
votes
1answer
237 views

Arcpy Network Analyst solver error

Hello GIS Stack Exchange, I am finding it difficult to load locations to sublayers using python in ArcGIS 10.0 network analyst Vehicle routing problem. I'm also having some trouble debugging my ...
0
votes
0answers
29 views

using python and arcpy , how can I compute the direction and angle of a line segment? [duplicate]

if start_point_x < end_point_x and start_point_y > end_point_y: slope = ((end_point_y - start_point_y)/(end_point_x - start_point_x)) radian = math.atan(slope) degrees = ...
1
vote
0answers
349 views

Calculating the Centroid of polygon in modelbuilder (VBA to Python) [closed]

Got an easy one, that's got me stuck. I'm moving some models that were created in 9.3.1 to work in 10. Part of the model is calculating the X coordinate of a polygon to a specified field. The code ...