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

learn more… | top users | synonyms

0
votes
0answers
193 views

Issues when importing line shapefiles into NetworkX

Note that although I am using Python Console from within QGIS for this, I don't think it's a QGIS issue. Below is the difference of how NetworkX is dealing with 2 line layers created by the same ...
2
votes
3answers
668 views

How to get index number of list item using Python?

this gives me a list of all 55 layers in my mxd import arcpy mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd, "Layer")[0] for lyr in arcpy.mapping.ListLayers(mxd, ...
4
votes
1answer
300 views

Python - ArcMap: Fastest method to loop over Mxd's

I am attempting to find the fastest method for looping over multiple map documents while keeping memory resources down. I'm running this script outside of Arcmap 10. I have 5 map documents which are ...
1
vote
1answer
466 views

Attribute error:'NoneType' object has no attribute

I tried to run a python script for getting the coordinate system of a feature/shapefile as follow >>> import arcpy >>> from arcpy import env >>> ...
2
votes
0answers
31 views

How to include checkbox or radio button in python script for arcgis tool? [duplicate]

I created an arcgis custom tool for converting an excel file to both kml and shapefile . Now I want to include radio button or checkbox to select according user interest for either kml or shapefile.
3
votes
0answers
272 views

Configure Python with Geoserver

I am developing a WebGIS application with: Openlayers 2.12 PostgreSQL 9.2 with PostGIS 2.0 extension Geoserver 2.2.3 Apache 2.0 configured with Tomcat 7.0.35 PROBLEM One of the services of the ...
10
votes
2answers
1k views

What software to use for making digital elevation models from UAV aerial imagery?

I have a an unmanned aerial vehicle (UAV, also called a drone) and would like to use it to create a digital elevation model and orthomosaic over a smaller area (10 km2). My platform will be able to ...
7
votes
1answer
214 views

Is Python essential for working in QGIS?

I am a beginner in QGIS. I Generally have a doubt: to work in QGIS is it necessary to know Python? whether i am asking we should know to write python programs to make certain modules run?
1
vote
0answers
57 views

Ubuntu Raring - Openlayers Plugin 1.8 or 1.9 Master

Relative newbie to Ubuntu and QGIS. Many questions are posted relating to the Openlayers plugin. It works fine in windows but I cannot get it to work or even appear in either 1.8 or 1.9. The "fetch ...
-1
votes
1answer
380 views

how to run an aml in python

I am trying to run a aml in a python program I am writing and haven't been having much luck figuring out the correct way to run the aml. The aml requires workstation to be in grid mode. Any tips? I am ...
1
vote
1answer
70 views

Get the ID of polygon in edition sessions of QGIS?

I did a Qt custom form for QGIS which contain a QlineEdit that must get the ID of the current polygon in edit session. For example, I start edit sessions I draw 3 polygons when the Qt form is opened ...
0
votes
1answer
34 views

Points Solar Radiation reformat problem

I am trying to produce a set of monthly solar radiation maps based on a monthly parameterization of the diffuse proportion and transmissivity (i.e. new values for both parameters each month). The ...
4
votes
2answers
705 views

Is it possible to route shapefiles using python and without ArcGIS, QGIS, or Pgrouting?

The question is pretty much in the title. Is there a way to route through a road line shapefile using python and some library without having to resort to converting the data into PostGIS/pgrouting or ...
8
votes
2answers
2k views

How to read an Excel sheet in ArcPy script

I'm writing a python code to convert X,Y points in excel to shapefile. In this process i have toread xy points from shhet1. What is the step i have to include in my process to read data from sheet1 of ...
4
votes
3answers
468 views

Checking if python script is run from ArcGIS (arcmap or on server) or a stand alone python script

For debugging purposes I have created a hardcoded conditional that checks it the script is run as stand alone or as an ArcGIS tool. Is there anyway to fugure this out at run time? e.g. some ...
9
votes
6answers
427 views

How to programmatically check if the number of shapes = number of table records?

I have a handful of approximately 1000 shapefiles that are corrupted (see attached error message). The shapefiles were generated from eCognition Developer 8. There is a script tool that seems to ...
0
votes
0answers
71 views

How to export png to file system with python?

I use python to make a plugin that contains shape file,color_bar,time_bar 3 items above now I want to export my result to a png image After I find the method to do it I find a similar way to ...
2
votes
2answers
514 views

Python script to read coordinate system of an input feature class? [duplicate]

How to read the coordinate system of an input feature class in python script. How we can use "Describe()" function and tool validator for that purpose
1
vote
1answer
89 views

How to set parameters for Describe() function?

I developed one tool in arcgis using python code, in the process i used Describe(feature class) function to know the coordinate system of input feature class. I got success while compiling code, But ...
-1
votes
1answer
195 views

Raster produced by Con expression not saving

I cannot get a Con expression to work. Or, if it is working, I cannot get the raster produced by the Con expression to save. I have two rasters and I want the positive difference between the two, and ...
2
votes
2answers
452 views

How do I prevent Qgis from being detected as “not responding” when running a heavy plugin?

I use the folowing line to inform the user about the status: iface.mainWindow().statusBar().showMessage("Status:" + str(i)) The plugin takes about 2 min to run on my data set but windows detects ...
3
votes
1answer
292 views

Programmatically manipulate GPX data

I need to do the following in Python open OSM & GPX files (I have packages for this) transform points from GPX (like stick a track to roads) calculate the results (distances, cumulative ...
1
vote
1answer
956 views

ArcGis File Geodatabase with Null values (Field Calculator)

I want to use the field calculator to get the sum of a couple of columns. The problem is that some of them has Null Values. I am not able to find a solution. I tried this Python functions: stack( ...
2
votes
2answers
106 views

Why does QgsSpatialIndex::nearestNeighbor(point, 1) sometimes return 2 lines?

I'm trying to get the closest line to a point using pyQgis in a plugin. The active code file is this: http://pastebin.com/TDzmsKVM When I request the closest line (only 1) nearestIds = ...
2
votes
1answer
703 views

How to install shapely on Ubuntu 12.10

I have tried to install shapely on Ubuntu 12.10. Therefore I installed libgeos-c1, pip and shapely with $ pip install Shapely. The shapely files are now in /home/user/build/Shapely. When I try to ...
3
votes
1answer
249 views

Is there an online reference available for the Fiona and Shapely libraries?

Is there an online reference available for the Fiona and Shapely libraries? I'm thinking a real reference, beside the tutorial-style documentation: http://toblerity.github.io/shapely/manual.html ...
0
votes
0answers
53 views

Arcpy - loop through subfolders and change mxd settings [duplicate]

I'm trying to run a python script that uses arcpy and os.walk modules. The aim is to find all mxds by specyfying top workspace level only and for the tool to loop through all subdirectories and locate ...
7
votes
2answers
437 views

How can I speed up my arcpy script?

I have written an application that does a lot of geoprocessing using arcpy. Once started, the application itself runs at an acceptable speed, but it is very slow to boot. It can take 30 seconds or so ...
1
vote
1answer
125 views

ArcPy - Dividing every raster cell value by the maximum cell value

I want to divide every cell of a raster by the raster's maximum cell value using ArcPy. Here is what I have done so far. densityRaster = LineDensity(shapefileName, None, "", "", "") maxVal = ...
0
votes
1answer
359 views

Python Script for shape file to layer conversion

What is the python Script for Shape file to Layer Conversion? I tried the following... import arcpy from arcpy import env env.workspace="working path" ...
1
vote
0answers
127 views

Python Script Producing Empty Cost Path Rasters

I'm trying to run a script that will create cost paths for a large number of randomly generated points then assign the cost to those points. But my script is beginning to create cost path rasters ...
1
vote
1answer
510 views

importing osgeo module in ubuntu 10.04

I have problem with importing "osgeo" module in ubuntu 10.04; I have installed GDAL 1.7 from source ( 1)./configure 2)make) however, still in python I cant import osgeo module. I appreciate any hints. ...
2
votes
2answers
351 views

How can I perform an inside clip on a raster file based on another raster file?

I have a raster file that I would like to use to perform an inside clip on another raster file. I have tried using the extract by rectangle tool, but it gives me values ranging from 3.40282e+038 to ...
1
vote
0answers
288 views

Install shapely for QGIS on Mac

I know there are a number of similar questions, but none of them have answers that allow me to use shapely in QGIS. In particular I am trying to install the Contour plugin, but this fails with the ...
1
vote
2answers
178 views

How to modify the results of a geological dataset from vertical to horizontal?

I have a 3-D point shapefile of a geological fault dataset consisting of x,y, and z columns. I need to create a raster dataset from this point dataset. I have been trying to do this in ArcGIS; ...
0
votes
2answers
276 views

Where to find the variables of QgsPolygon and QgsPolyline?

now I want to use QgsPolygon (and Qgspolyline,too) class in python I have a example by using QgsPoint but I don't know how to use in QgsPolygon following is my Qgspoint example feature = ...
1
vote
0answers
96 views

Subset a GeoTIFF image into regular grids and extract mean latitude, mean longitude, and mean RGB for each grid

How can I subset a GeoTIFF image with 1000 by 1000 pixels into regular square grids of 50 by 50 pixels (400 grid objects in total); and calculate mean latitude, mean longitude, and mean RGB for each ...
0
votes
1answer
460 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 ...
19
votes
4answers
4k views

Python Script examples for geoprocessing shapefiles without using arcpy

I would like to use a Python script that is not based on arcpy to do things like query a shapefile by attributes, create new layer from selection, and calculate areas of a polygon and convert ...
4
votes
1answer
355 views

How can I create a new layer from the currrent selection?

Is it possible to create a duplicate layer, only displaying the selection from the layer you are duplicating in QuantumGIS? Simular to ArcGIS -> Create Layer from Selected Features. I looked at "How ...
1
vote
5answers
680 views

String variable substitution in selection expression

I'm trying to put a variable into a string used to do a selection. At the moment it's like this... expression = "'No_Props' > 5 AND %s < 200 AND 'ST_Ori' >60" % metres_field ...
1
vote
3answers
204 views

Center of a bounding box

I have bounding box coordinates of my shapefile (fetched from layer.GetExtent() Python with GDAL/OGR): (-38.6102467739459, -38.017601026186576, 33.01563382506067, 33.624945228091406) So I assume ...
1
vote
2answers
85 views

To select one stream segment at a time for processing

I have attached my stream order network image. I have five different order streams. There are several segments in each order. Now my problem is to select one segment of stream at a time for the ...
6
votes
4answers
463 views

Is there any way to get an email when ArcGIS Server services are stopped/down?

Occasionally, but all too often unfortunately, my AGS services just stop for no reason. I don't usually notice this until the users call me and ask why their maps have no data. Is there any way (I ...
2
votes
1answer
2k views

How do I select by location based on selected features with Python?

Is there a way with Python to do Select by Location with the Use selected feature option? I'm trying to automate a process and am running into barriers. I need to be able to select the 2 lines ...
3
votes
1answer
767 views

Python: Change SDE data source for mxds in specific folder

I've searched all the forums and help and have made progess but recently got an error that has thrown me for a loop - also some mxds are not being changed at all! What I'd like my code to do: Iterate ...
2
votes
1answer
181 views

Need a Python field calculation that works like the DatePart( ) VB Function

I have a field called Abandoned Year (short integer data type) that I am trying to populate with a four digit year from a column called Decommission Date (Date data type). I have done this in the ...
0
votes
1answer
288 views

AttributeError when I execute a python script

When I execute a python script to assign my database in postgres, I get this Error !! "AttributeError 'psycopg2._psycopg.cursor' object attribute 'execute' is read-only " def ma_fonction(d): # ...
0
votes
1answer
84 views

Anyone recognize this (reference-system related?) pattern of distortion?

I'm new to GIS and was making some progress until getting rather stumped on this one. I've imported what I believe to be lat/lon data based on US FIPS county codes in weather alerts (NOAA SPC). When ...
0
votes
1answer
79 views

Need to teach myself Python, looking for some suggestions [duplicate]

I am a bit behind the curve here but I am going to teach myself Python, for better or worse, and am looking for any suggestions inre: books, blogs, websites etc. I have little to no experience in ...