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

learn more… | top users | synonyms

-1
votes
2answers
11 views

How to use raw_input() with while-loop?

my task is to execute multiple buffers with the list-loop! import arcpy arcpy.env.overwriteOutput = 1 arcpy.env.workspace="C:\\salzburg.gdb" sbgRivers="sbg_rivers" buff_name=raw_input("Please ...
0
votes
1answer
29 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
0answers
10 views

Problem with polygon overlay in raster stats using gdal

I am using the raster_stats module in python to calculate the mean carbon value for different sets of polygons. Here is the code that I am using: africa_sat = ...
1
vote
1answer
38 views

My class using ogr to calculate distance is returning incorrect results away from the equator

In an answer to this question ustroetz kindly provided some sample code for use of ogr to do lat/lon distance and point in polygon calculations. I've created a Python class based on his example to do ...
0
votes
1answer
20 views

Calculate text field based on codeblock query of numeric field

I am trying to populate a field with a L/R bank designation based on a route measure (as part of a larger script), but I am struggling. I have a shapefile created (tir_pts_lyr), I have a blank column ...
1
vote
1answer
31 views

Excel/Google Docs > Plss Map [on hold]

Is there a way to map out PLSS (Public Land Survey System) TWP (township),RNG (range) and Section based off a field in google docs? I was thinking if you had your first column with the PLSS area in ...
5
votes
2answers
50 views

Python resource for remote sensing?

I am looking for a good resource (MOOC, book, etc..) to teach Python for remote sensing applications. I am already familiar with http://www.rsgislib.org/ - are there any other resource out there for ...
3
votes
1answer
54 views

Unable to get python-qgis-common on Kubuntu 14.04

just upgraded my Kubuntu from 13.10 to 14.04 LTS and lost all plugins. Found out that "python-qgis-common" is not installed. Tried to install it but was told that it depends on "sip-api-10.1" which ...
-1
votes
0answers
37 views

How to return value into a python list using search cursor [on hold]

I would like to retrieve the temporary value which are done from searchCursor. I want those values to be stored inside an array (preferably a 2D array, as i have to store objectid,x,y , also there is ...
3
votes
1answer
43 views

Are the functions in OGRPolygon accessible through the python bindings?

I'm currently trying to use the OGR python bindings to process some shapefiles. I want to obtain the number of interior rings in a polygon feature. Unfortunately I'm unable to use the documented ...
0
votes
0answers
19 views

MODIS images set CRS and reproject

I am developing a plugin which reads MODIS images, and I know that MODIS images are in sinusoidal projection and I need to set that CRS and project the image to WGS84 (epsg 4326) in python. I search ...
0
votes
0answers
20 views

What is the Python numpy equivalent of the IDL # operator? [on hold]

I am looking for the Python numpy equivalent of the IDL # operator. Here is what the # operator does: Computes array elements by multiplying the columns of the first array by the rows of the ...
-1
votes
0answers
33 views

I am trying to clean up my data that I created but it is not stripping anything [on hold]

I am trying to strip <br> among other things but when I print it out or look in my text file, nothing happen. The code runs without any error but it will not strip <br>. import urllib ...
0
votes
0answers
14 views

runCommand in pymongo

I run the following query on my mongoDB console: location = db.BLR_all.findOne( { $and: [{"geom.type":"Point"},{"REGION": "KORAMANGALA"},{"E_NAME": "RAILWAY BOOKING CENTER"}] }) db.runCommand({ ...
4
votes
2answers
68 views

Bulk convert DBF to CSV in a folder ArcGIS 10.1 using Python

I would like to convert 1000 dbf files to CSV. All dbf files are in one folder and they have sequential names (S:\output_tables\tcb1.dbf, S:\output_tables\tcb2.dbf, S:\output_tables\tcb3.dbf, up to ...
0
votes
0answers
12 views

QgsGeometryAnalyzer.dissolve problems

I am completely new to the QGIS python api and I am running into an error which I cannot solve when trying to use the dissolve class. I used the basics of the PyQGIS Cookbook. In my understanding ...
3
votes
2answers
119 views

Converting Vertices of Polylines and Polygons to Points and Maintain Attributes

I'm pretty sure someone has done this before, but I'm having no luck. I'm using ArcGIS Standard version 10.2.1 and I want to convert all the vertices of a polyline or polygon to points. Essentially, ...
0
votes
1answer
19 views

USGS Earthquake GPS Metadata: Buffer Zones & Python

I'm making a python web crawler that gets USGS earthquake GPS data, and I'm wondering how I should process the latitude longitude pairs to see if it falls within a specified radius of a specified GPS ...
0
votes
0answers
17 views

custom toolbar combobox: issues with adding functionality

I've added a combo box to my custom toolbar in QGIS (based on this thread QGIS - Add a combobox to a toolbar), but it doesn't populate unless I reload the plugin. def __init__(self, iface): ... ...
2
votes
2answers
44 views

Shapely: Round Polygon Corners?

I use the python module "shapely" to make Polygons (like below). Can I convert the sharp edges of a polygon easily to round edges? Such that when I have unified some polygons I could issue a command ...
0
votes
2answers
56 views

using Python to calculate NDVI, output as a Geotiff

I need a script that can calculate NDVI from two separate input Geotiff files, then output the results as a Geotiff. I wrote following script, most of which is borrowed from various on-line sources ...
0
votes
1answer
39 views

Conducting geographically weighted regression on a raster

I have a relatively big raster file on which I want to conduct geographically weighted regression. Size of raster ~ 2 GB and number of rows is around 100,000 One way might be to convert from raster ...
1
vote
1answer
39 views

Problem with Intersect_Analysis : too long path? [on hold]

I made a python code for Arcgis 9.3. to intersect 2 features. The problem is that code works when the files are on my desktop (for example) but not when they are in a long path on another disc. Here ...
0
votes
0answers
15 views

Error while running OSGeo4W setup

i'm not sure if i got a problem with osgeo4w or with python. but i get an error message if i run setup: C:\>setup C:\>Exception in thread Thread-5: Traceback (most recent call last): File ...
0
votes
2answers
24 views

How to plot geo-data using matplotlib/python

I am trying to plot a polygone on python, using different libararies, but no one of these worked with me. I tried vincent ,Shapely , .. and now matplotlib. I don't wanna use softwares like qgis I ...
0
votes
0answers
15 views

QgsMarkerSymbolLayerV2 not rendering

For the life of me I cannot get a custom vector layer symbol to render. Following is the code I am using, as fas as I can tell renderPoint is never called. Is there something I am missing here. The ...
3
votes
0answers
57 views

After ArcGIS 10.2.1 update, Arcpy 64 bit import Error

I've updated my ArcGIS desktop version from 10.2 to 10.2.1 and have noticed that when I run the 64 bit version of IDLE I now get an error when trying to import arcpy: Python 2.7.3 (default, Apr 10 ...
0
votes
1answer
24 views

How do I check spatial reference on all parameters during Tool Validation?

How do I check spatial reference on all parameters during Tool Validation? Just looking for recommendations. Here is what I have already. This must work with existing validation. import arcpy class ...
3
votes
3answers
353 views

Python - Find the largest extent in a list of extents (tuple format)

I am trying to find a way (simplest is the best) to retrieve the largest extent in a list of tuple extents in python. The list is looking like that: extents = [(-180.0, -90.0, 180.0, 83.624), ...
0
votes
0answers
11 views

ogr: confusing results from `SetSpatialFilter()`

My layer is derived from a data source like this: l_131 = bounds.ExecuteSQL("select * from 'nam_l' where 'ND_5'= 131 ") feat = l_131.GetNextFeature() feat.GetFeatureCount() >>> 200 It is a ...
0
votes
1answer
15 views

Point z value Return 1.#QNAN while set before

I am makin a python code for ArcGis 9.3. The code is as following : rowsLine = gp.updatecursor(line_Feature_Class) count = 0 rowLine = rowsLine.next() rowsPoint = ...
0
votes
1answer
36 views

How to copy attribute values of fields in selected features of one layer to another Qgis programmatically?

I am trying to get the values of attributes of the selected features of a layer field by field and copy to another layer that I created in qgis with pyqgis. Is here a example for this. Every example ...
1
vote
1answer
63 views

How to get Z attribute of point using Python and ArcGIS Desktop 9.3?

I am making a python code for arcgis 9.3. In this code i create a new point with x,y and z attributes as following : rowsLine = gp.updatecursor(line_Feature_Class) rowLine = rowsLine.next() ...
0
votes
0answers
25 views

Help with scripts for processing raster files with the raster calculator in QGIS

I am trying to process some raster files using python scripts in Qgis 2.20, and I have been having trouble finding any documentation on using raster calculator in scripts being run in the processing ...
1
vote
1answer
36 views

Why does Animal Movement toolbox give SyntaxError: invalid syntax?

I found a complete toolbox (Animal Movement tbx, by Regan Sarwas) for my tasks and I tried it. I had a systematic problem with the codes for all tools (line 1), for exemple: Executing: ...
2
votes
1answer
26 views

How can I extract only band 4 from a geotiff multi bands to create geotiff or AAIgrid with this band using Python?

I have a geotiff file with many bands... I will like to create a .asc file or tiff file by converting only one band from the geotiff file. I don't find the solution by using python... With ...
0
votes
0answers
21 views

Add existing QGIS plugin button to custom toolbar

Is it possible to add an existing plugin's button to a custom toolbar? I've succeeded in adding core actions such as shown below, but am wondering if it would be possible to integrate another plugin ...
0
votes
0answers
30 views

Have I created a valid Spatialite database?

I didn't manage to find the better way to populate the exisiting Spatialite database with new computed data than just creating new columns and filling them in the Python script. You can see that the ...
0
votes
0answers
21 views

Mapnik: GeoTIFF flipped (mirrored vertically)

I generated a GeoTiff using the QGIS HeatMap plugin and want to render it on top of some OSM data. The problem is that the raster gets rendered upside-down in the output. Can someone point me in the ...
0
votes
2answers
29 views

Get srid from a shapefile using ogr

I'm writing a script to import shp to postgis, using python, osgeo and psycopg2 ( see my previous question: Import shp to Postgis using Python and ogr ) I'd know if there is a way to get by osgeo ...
0
votes
0answers
27 views

How to add the attributes of selected features to my new layer in pyqgis

I am trying to create a layer from the selected points coordinates. I am drawing a circle to the coordinate of selected points. I also need to add initial attributes of my selected features to my new ...
1
vote
2answers
70 views

How can I group Points to make polygon via Python

I have an array of coordinates Point= [lat,long] ListPoint= [[38.203655,-76.113281],[38.10,-76.12],..] I wanna make a polygon that contains all these points ? There is a project developed by ...
3
votes
1answer
25 views

Why is Mosaic or Mosaic To New Image causing a 1-pixel gap between adjacent images?

I have a series of adjacent PNG images, and I'm trying to merge/mosaic them into a single seamless image. The images have clean "cuts" between them, with no overlaps. However, when I use either the ...
1
vote
0answers
42 views

How do I smooth edges of polygons in QGIS?

Is there a built in function or plugin I can use to achieve smooth lines for my polygons instead of the blocky ones I have now?
2
votes
1answer
23 views

Using Python to create new point location based on various azimuth and distances

I have a feature class with thousands of points. In the same table with these point locations, I have two additional fields. One for azimuth, and one for a length (or distance) to move along that ...
1
vote
1answer
39 views

How to call ogr2ogr from command line with Python 2.7 from ArcGIS 10.2 for Desktop?

I am trying to access ogr2ogr in the command line, and this is the message I receive: 'ogr2ogr' is not recognized as an internal or external command, operable program or batch file. This is ...
0
votes
1answer
44 views

Parsing field in field calculator using Python

I have field1 which has a values of "A_B" (example). I created two fields out of this, values to the left of the underscore go in fielda and to the right of the underscore go in fieldb. I used the ...
3
votes
4answers
134 views

How to convert all values in all fields of table to upper case using ArcPy & Python?

Does anyone know how to use the .upper() in a stand alone python script so it can be used to change all characters in a table into UPPER case? I don't want to use the field calculator since I have ...
2
votes
2answers
69 views

Using Python to shorten polylines of varying lengths by 44% of their original length (or by a value contained in a field)

I have a feature class containing tens of thousands of polylines of varying lengths that were constructed from only a start and end point (of note, they are all at different angles, and many lines ...
-2
votes
0answers
40 views

intersect zip python

I try to change the python script ExtractData to do the intersection., but until now I fails to do so. i change the funtion : clip_analysis by intersect_analysis. i change also the parameters: ...