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

learn more… | top users | synonyms

3
votes
0answers
59 views

Field Calculator convert text to integer then populate new field with sum [closed]

I have a .dbf with about 50 text fields containing numerals, I would like to convert those to integers and then sum them all in a new double field I created, is there an easy field calculation that ...
2
votes
1answer
46 views

How to know if two geometric figures are approximately equal?

I would like to know how to determine if two geometric figures (the_geom) are approximately equals. By the way, I'm working with Python, PostgreSQL and Postgis I have the following geometries: ...
1
vote
1answer
26 views

Time.Sleep between arcpy.mapping.ExportToTIFF in Data Driven Pages

I'm building a code in Python to export in geotiff my imagery. I need specific spots so I created a Data Driven Pages with polygons. Everything works fine, except that my imagery layer takes a long ...
0
votes
0answers
39 views

arcpy fails to retrieve queried data from a layer using arcpy.da.SearchCursor

I am attempting to retrieve rows of data from an attribute table using arcpy. I have used a definition query on the data in ArcMap so that only one feature is present in the attribute table. I then ...
0
votes
2answers
42 views

Using Arcpy to search geodatabase for feature with smallest number of rows and export as .SHP

I have created a bunch of grids for a city boundary area. I would like to know how to use the Arcpy module to look through a geodatabase and find the grid with the smallest number of rows (assuming ...
0
votes
1answer
27 views

How to pass value of a band to and other band and change its value?

Using gdaldem hillshade, I get a one-band hillshade (download here, 2MB) : gdaldem hillshade crop_xl.tmp.tif Shadedrelief.tmp.tif -s 111120 -z 5 -az 315 -alt 60 -compute_edges I currently can ...
8
votes
2answers
270 views

Migrating from ArcGIS to gdal

I would like to collect a table of equivalent or close enough gdal based functions to replace ArcGIS functions (esp in spatial analyst). Are there functions available using gdal to perform the ...
1
vote
1answer
74 views

How to get path for layers listed in a combobox?

I want to get the path of a layer in my plugin, in the console it works fine but in my plugin it gives me the error AttributeError: 'NoneType' object has no attribute 'dataProvider' def run(self): ...
0
votes
1answer
47 views

Using arcpy.mapping.ListLayers() with no filter, but some layers are missing in list

I am trying to use arcpy.mapping.ListLayers() to access and change some of the properties on specific layers in my mxd prior to printing to PDF. Here is a screen cap of my layer list: When ...
0
votes
1answer
51 views

Creating multiple fields with ranks using ArcPy?

While figuring out what I have to do, practically creating a field for each arrondise, and in each, rank each FID (which are part of the respective arrondise) by the size of its shape area. ...
1
vote
0answers
50 views

How to use d.* from a python/bash script in GRASS GIS 7.0?

Do d.* commands from GRASS GIS 7.0 run from a python script? I'm trying with this code: import grass.script as grass grass.run_command('d.mon', start="wx3", resolution = '1') ...
2
votes
1answer
150 views

Processing plugin Python error on startup of QGIS 2.8.1

I've been running QGIS with no issues for several versions now, but after I upgraded to 2.8.1 Wien I had trouble running two plugins: qgis2leaf (which I believe depends on Processing) and Processing. ...
0
votes
0answers
24 views

install python packages for qgis? [duplicate]

I need the twisted framework (Python) for a qgis plugin on Windows 7. I installed it with the pip installer. When I want to start the plugin it doesn't find twisted. When I start a python interpreter ...
1
vote
1answer
58 views

How to remove “ERROR 1” messages from a standalone QGIS script?

I am running a standalone script for QGIS which creates a high resolution grid and clips shapefiles onto it. Works perfect if the cell width and height have a high values (in my case, >200m for both). ...
1
vote
1answer
53 views

Change layer datasource in qgis project with python

I have different qgis project with some layer and their datasource like ../my_path/my_file.shp. I need to insert this shp file to a remote db. For do it i use shapefile from PGeo module and it's work ...
3
votes
1answer
68 views

How to create a virtual field in QGIS by Python Console?

Is there any example about how to create a virtual field and subsequently change the attribute of a non-virtual field without wiping out the virtual field? Both are required to be done in the Python ...
1
vote
2answers
137 views

Generate PNG/JPG maps from multiple ASCI/GeoTIFF in Python/GDAL

I need to generate maps (saved in PNG, JPG or PDF) from raster files (for each file - one map) which meets following criteria; * each map has exactly the same color pallette, so that it will be easy ...
0
votes
1answer
81 views

How to change output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script found in this post? import_path = r"..." # Path of .mxd ...
1
vote
1answer
75 views

Trying to use Tkinter to open dialog box in ArcMap

The following script works great from the command line but crashes from the pythonaddin: import Tkinter import tkFileDialog root = Tkinter.Tk() root.withdraw() pathtest = ...
0
votes
1answer
51 views

Extracting from attribute tables by arcpy

I'm having some trouble connecting ideas on how to solve a problem. What I have is a shapefile from which I have to extract from one field, which contains 3 types of attributes (BS, RS, BRN). For each ...
0
votes
1answer
111 views

Python geoprocessing tool for ArcGIS online

I am looking to create a geoprocessing tool using python in arcGIS 10.2 that will be used in the ArcGIS online web app builder. This will be my first tool for a web application and I would like some ...
1
vote
0answers
91 views

Import shapefiles into PostGIS using Python with psycopg2

I want to import shapefiles to PostGIS using Python with arcpy & psycopg2 to connect to PostGIS. I don't want to use the existing shapefile loader nor ogr, just write my own import tool. My steps ...
0
votes
0answers
36 views

How to customize and add additional features in GeoNode

I need some advice on how to start customizing my GeoNode installation. I tried reading up on GeoNode documentations on how to do it but it always boils down to customizing or adding to the Django ...
2
votes
1answer
178 views

Convert coordinates to differnt Spatial Reference System in Python

I am trying to convert co-ordinates (-33.75, 150) from epsg:3857 to epsg:28356 in Python. Using both of the examples in post How to convert projected coordinates to lat/lon using Python?, I get the ...
1
vote
1answer
78 views

QGIS processing script: Move points by specified distance and add segment

I try to move points (they come as WGS84, but I'm not sure if it works with unprojected CRS) by a specified distance and connect original and new point with a line segment with the below script, but ...
1
vote
1answer
36 views

Unable to execute a python script that was exported from ModelBuilder

I have a model that copies a single F.C form SDE geodatabase to a scratch geodatabase then copies it back with a new name to the same SDE geodatabase again. And this works perfectly form the model. ...
0
votes
0answers
14 views

Using a layer file to apply symbology to shapefile [duplicate]

I have code that doesn't work at the moment: # Import arcpy module import arcpy # Script arguments Input = arcpy.GetParameterAsText(0) if Input == '#' or not Input: Input = "frame" # provide a ...
1
vote
0answers
25 views

Action on group of features from layer in QGIS?

I need to implement a rename action on a selected group of features in a certain order. The idea is that I would rename one feature and then select the features that are 'next in line' and execute a ...
1
vote
1answer
44 views

How to convert from .shp to .csv using python and either gdal_translate of ogr2ogr

I am trying to convert .shp files to csv using either gdal_translate or ogr2ogr and python but its not work. if i run the following from qgis its not giving an error but at the same time its not ...
1
vote
1answer
61 views

why does my script not save a layer when it encounters a “ \” character in the string

i have some code that takes a field and finds every unique value in that field. it then creates a layer for each unique value. The code is working ok , but it is failing when there are \ characters ...
1
vote
0answers
40 views

Are there any conditions that could break the creation of an arcpy.Polygon object?

I have a script that generates a mesh network from vertex and centroid inputs, and it works for almost all my points. But for some records that get created in the feature class via the script, their ...
0
votes
2answers
73 views

Writing out comma separated values inside a single cell in a spreadsheet using python [closed]

Please excuse the long subject header. I have gotten pretty good at writing data out to csv files but i seem to have stumbled into this block. Anytime a ',' (comma) is used to join values, it shifts ...
0
votes
1answer
50 views

Combining and extracting attributes from 2 columns to populate a third (Concatenate)

I am working with a FEMA flood zone shapefile which contains a FIELD_ZONE field and a SUBTY field. I created a third field called ZONE_TYPE that needs to be populated by combining or extracting ...
1
vote
0answers
100 views

How to control QGIS from within Anaconda's Spyder (Continuum Analytics Python distribution) in Windows

I would like to control QGIS from within Anaconda's Spyder, in particular use the QGIS core modules. My config: Windows 7 Anaconda 64x for Python 2.7 Spyder 2.3 Postgresql 9.4 PostGIS 2.1 QGIS 2.8 ...
2
votes
0answers
66 views

How to access Landsat bucket from Amazon?

I tried to access amazon Landsat S3 bucket with the following python code import boto import boto.s3.connection from boto.s3.connection import S3Connection access_key = <userid> secret_key = ...
0
votes
0answers
20 views

Closest raster VALUE to a given x,y point [duplicate]

Is there a way in ArcGIS to find the closest VALUE in a raster to a given x,y point? There might only be NoData at a certain point, in which case I want to find the closest pixel value. I cant seem ...
0
votes
1answer
40 views

Intermediate files disappear in ArcGIS 10.1

I am working with ArcGIS 10.1 creating some slope and aspect files. I do this: DEM_park = ExtractByMask(mosaic_name, park_area) and it creates the DEM_park file in a default gdb with a default ...
1
vote
1answer
52 views

What defines where the files will be saved?

Hi I have a script I am using to save out layers automatically I have posted another question here ArcGIS creating individual layers for unique attribute in a given feild. Limitations of Where ...
2
votes
1answer
320 views

Change field names automatically

I have an attribute table with over 2500 fields. About 2000 fields start with the name "All_txt_" (eg "All_txt_Watermelon"). Is there a way to remove this "All_txt_" from all the fieldnames ...
0
votes
1answer
76 views

How to read landsat images from Amazon S3 using python?

I would like to read and process landsat images from Amazon using pyton thanks,
1
vote
1answer
37 views

Using pyQGIS transform a layer of polygons into a layer of holes inside a bbox

I'm using python in QGIS. I have a layer of polygons (its a result of some earlier dissolving and has no overlapping polygons but some holes and islands in holes etc). I want to build a new layer ...
1
vote
2answers
51 views

Identify Census blocks inside urban areas (using pyshp or similar)

I am trying to find the Census blocks that are inside specific urban areas or urban clusters. The Census Bureau provides a list of urban areas/urban clusters with the following information: | ...
2
votes
2answers
54 views

Controlling default value of arcpy.AddField_management

I have a large collection of shapefiles that use text fields to hold numerical values. I have created new fields, and populated them with the numerical equivalent of the text field. When adding the ...
0
votes
1answer
97 views

OSGeo4W and GDAL - gdal2tiles.py error

Wondering why gdal2tiles is throwing errors, I've added the gdaldata and gdalplugins environmental variables and my python is at Python27/ArcGIS10.3/, and am wondering if that is messing with the ...
0
votes
0answers
59 views

UpdateCursor not iterating as desired, updating erroneously

(EDIT BELOW WITH WORKING CHANGES) I have a script in which I am trying to compare attributes in row n to row n+1. If all the attributes match, I want row n+1 to have a field ([Modifier]) updated to ...
1
vote
1answer
35 views

Cleaning shape file with multiple boundaries defined more than once

I have a shape file which contains a lot of polygons which define airspace. These polygons overlap and this is fine (e.g. different airspace configurations for the same airport). My problem is that ...
3
votes
4answers
260 views

How to get values of last row in table with ArcPy/SearchCursor?

I would like to base my query on the last row of a table? I know the basic syntax/functionality for my search cursor, how do I query only the last row; Below is an example of my search criteria, ...
0
votes
0answers
44 views

ArcGIS creating individual layers for unique attribute in a given feild. Limitations of Where Clause

I am putting together some code that makes a layer for each unique attribute within a given field. So if I had a shapefile that contained point data for locations of say postboxes in every city , for ...
0
votes
0answers
29 views

Arcpy MakeGraph “Parameters are not valid”

I have a Python add-in that should create a graph based on the location ID of a water quality testing station. The user clicks on the point and a relevant graph should be created in the layout window. ...
0
votes
0answers
59 views

how to compile a python script (proxy.cgi) in ubuntu?

I want to know please how to compile a python script ubuntu 14.10, I have a file proxy.cgi I want to compile in order to access to the geoserver. when I type localhost/cgi-bin/proxy.cgi, it displays ...