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

learn more… | top users | synonyms

6
votes
1answer
119 views

PostGIS polygon edge analysis (orientation, edge length)

I am rather new to the world of GIS and especially PostGIS, so please excuse me if the answer seems evident... I would like to do analysis on a number of buildings. One thing I am interested in is ...
0
votes
1answer
39 views

UnicodeDecodeError: 'utf8' codec- arcpy

I work with arcmap 10.3 and python 2.7.8. I have more than 500 shapefiles that located in many folders and subFolders. All Sub Folders are located in one large directory. I try with arcpy to detect ...
0
votes
1answer
21 views

Query table names

I want to query a table in my postgis table named Seg_060_2009 using psycopg2 and cant seem to get my query to execute. The query will execute if I name the talbe layer. Are there restrictions on ...
3
votes
2answers
87 views

Field Calculator Script

I am looking to check how up-to-date a feature class is by using our latest parcel update. I am wanting to check "owner" field with "Owner_1"...I am using field calculator to grab the last name in ...
1
vote
1answer
28 views

How apply error messages to a python toolbox that prevent my tool from running with bad parameters?

This is a continuation of my question here: Point and Polyline I tried making this question easier to follow. My tool accepts two main parameters - a continuous centerline and a table (or a feature ...
0
votes
2answers
69 views

Create a script to add delimited text layer in QGIS

I'm trying to use QgsVectorLayer() function to add delimited text layer in QGIS. So I have a txt file (T_1999_1_2.txt) in path: "D:\PATRICIA\DOCUMENTOS\ESTACOES METEOROLOGICAS\DADOS METEOROLOGICOS\T" ...
-1
votes
1answer
32 views

I want to reclassify a raster in one folder, rename it and put it in new folder using Python

I've been combing stack exchange and I cannot figure it out. I have a raster "slope_tif_18TXK030910", I want to reclassify it, rename it and put it into a new folder. this is what I have and it works ...
0
votes
1answer
31 views

QGIS / Python: Fill new field with values based on other fields and lookup table

I am trying to use Python for QGIS to add values to new fields in an attribute table based on existing fields and values in a lookup table. Attribute table I wish to modify (with example rows): farm ...
1
vote
1answer
12 views

qgis script in external IDE fails [closed]

I'm new to Qgis. I have a script that runs successfully inside the Qgis editor, but it fails outside. It returns the alghelp, but fails on running the actual tool so it seems I have the external IDE ...
2
votes
1answer
62 views

How to efficiently use a Postgres DB with Python

I have a Postgres DB with a lot of lines that are too long and so now I want to split those lines into smaller ones. This is why I started writing a little python script for that job. Basically it ...
0
votes
0answers
40 views

Printing layers with Python script and QGIS - refresh problem

I have got a series of layers to be printed (grouped by pair). I am using QgsComposerMap. I iterate over the groups to just show the layers of the current group, zoom to its extent et print it. ...
0
votes
1answer
35 views

How to convert date field value returned by REST API to correct date? [closed]

I performed a query on this USGS feature service of Airport locations: Click for query And the value for the field LOADDATE is: LOADDATE: 1411380301000 However, when I pull the layer into ArcMap, ...
2
votes
1answer
118 views

Using Python to select random location from shapefile?

I have multiple shapefiles with bars names and location attributes and I want to create a script which asks the user for the area or shapefile name where they want to go and then prints a random ...
0
votes
0answers
30 views

Making shapefile from Pandas dataframe?

I´d like to construct a shapefile from a Pandas Data Frame using the lon & lat rows. I have got a csv file and I process it with pandas to make a data frame which is easier to handle Is it ...
0
votes
0answers
19 views

Creating a field calculator function that can cast string to a percentage value in a related field?

I am having issues trying to create a field calculator function based on a coded domain string parameter combined with a numeric field to obtain a percentage output. The example in question is as ...
0
votes
0answers
18 views

Automatically export a schematic dataset to a file geodatabase

I'm working with ArcGIS Schematics on a schematic dataset with several diagrams which requires quite a lot of manual editing. Since during testing Schematics managed to utterly destroy the schematic ...
0
votes
1answer
20 views

Batch reclassifying rasters in folder using ArcPy?

I am very new to python. I am using ArcGIS 10.0. I am trying to batch reclassify rasters in a folder and put the outputs into the same folder but with a new name(trying to do this using outputPrefix). ...
-1
votes
1answer
18 views

Load multiple layers into multiple maps - python

import arcpy import arcpy.mapping import os import sys from arcpy import env #import string env.workspace = r"G:\GIS" mxds = arcpy.ListFiles("*.mxd") lyrs = arcpy.ListFiles("*.lyr") for maps in ...
1
vote
2answers
32 views

How to add an image to canvas?

I am trying to make a QGIS plugin using Python. Right now I need way add an image to canvas but I don't want that image to be a new layer in qgis project. Is there a way to do it? Now I have: ...
0
votes
0answers
33 views

Qgis 2.8, gdal python scripts gives error at end of process

I am using Qgis 2.8.1 64-bit (Standalone installer) which also packages a number or other applications, like OSGeo4W Shell, Saga GIS et.c. In the OSGeo4W Shell I am encountering a problem with some ...
0
votes
3answers
28 views

Cropping a Shapefile into a Rectangular Box with Python pyshp

Using 'pyshp' I am hoping to reduce the set of US highway shapefiles to only those in Puerto Rico. The idea is very easy since I only need those pieces which fit into the window. >> import ...
1
vote
1answer
66 views

Unable to add attachment to ArcGIS Online feature service using Python and REST API

I am attempting to use Python to add attachments to an ArcGIS Online hosted feature service, but I'm getting an 'Unable to add attachment to the feature.' message when I run the following code: ...
3
votes
2answers
67 views

Accumulated value from many rasters python/arcgis10

I need to calculate an accumulated value of temperature (as an additional raster) from many rasters. Is there any option to do this in ArcGIS 10 or any hints for a python script?
1
vote
1answer
24 views

Find and Replace shapefile source script not working

I'm very new to python so please forgive me if this is a simple error. I have quite a few MXD's in which each have a few layers referencing the same source. However I have since moved this data to a ...
0
votes
1answer
36 views

gdal_array.SaveArray() leaves dataset open in Python

When I use gdal_array.SaveArray() to create a raster, the newly created dataset appears to stay open in Python, preventing other processes from working with it. For instance, consider the following ...
0
votes
1answer
58 views

How to delimit point distances in ArcGIS for Desktop per thiessen polgyon

I have 2 shapefiles. The first set contains xy pair for 1100 hospital locations. The second pair contains xy of villages about 7000 that are served by the hospitals. This means each hospital serves ...
1
vote
1answer
15 views

How to Convert db.ListProperty(GeoPt) to GeoJSON Polygon

My Python Google App Engine (no tag?) app has a datastore model of an Area of Interest, simplified as import geojson class AreaOfInterest(db.Model): name = db.StringProperty(required=True) ...
0
votes
2answers
378 views

Convert code VB to Python

I need to convert this code to be used by python in ArcGIS if [Field_1] < [Field_2] : pd = [Field_1] else: pd = [Field_2]
0
votes
0answers
17 views

Error 010240 when calculating mean of a list of rasters - Cell Statistics

I'm trying to calulate the mean value of a list of rasters but I am always getting the following error: RuntimeError: ERROR 010240: Could not save raster dataset to < value > with output format ...
2
votes
1answer
19 views

Unable to compile using make test in Linux

While trying to compile my test plugin I encounter this error, for the moment I can't figure out why, last week I had some issues on windows but eventually solved them via OSGeo Shell but this time ...
0
votes
0answers
50 views

How to write features in file geodatabases (FileGDB) with GDAL and Python?

I am trying to copy features from a spatiallite database to a filegeodatabase. The target FileGDB already exists with the required feature classes. I am using the FileGDB-API 1.4 on Ubuntu and Python ...
0
votes
2answers
90 views

How to automate specific workflow best (QGIS 2.8)?

For a project of mine, I'd like to solve a spatial analysis using QGIS. Until now, I have never automated anything GIS-related except for some rather easy steps in ArcGIS using the model builder, so ...
0
votes
1answer
42 views

address standardizer code in python for street featureclass

In my system I have featureclass Street and having fields. Featureclass : Street Input fields: NAME;STREET_PREFIX;STREET_NAME;STREET_TYPE;STREET_SUFFIX output fields: ...
0
votes
0answers
23 views

How to publish a IDW GP service with python in ArcGIS 10.1?

I know someone has ask a question about how to publish a gp service with python.And the answer is using arcpy.CreateGPSDraft. But My geoprocessing tool is IDW, and I find the return value isn't a ...
1
vote
1answer
76 views

Map automation to iterate through attribute table using ArcPy?

I have a python code which iterates through all attribute fields and creates a map for each field automatically. However, in the code I have to specify each attribute manually which was fine so far. ...
-2
votes
0answers
27 views

Field calculator language [duplicate]

I am trying to edit an column of numbers in to texts. For example, if the SITE TYPE is 2 then the site_type (an added field which is blank) is Industrial. If there a way to use python to make it work? ...
1
vote
0answers
58 views

open-source code for the map matching algorithm

For map matching of the GPS data to the network data, there is a algorithm from Schussler, N. & Axhausen, K. (2009a). Is this algorithm released under open-source license ? Where can I find this ...
0
votes
2answers
54 views

Python Crashes when Running ArcPy's ExportToPDF(), ExportToPNG(), ExportToJPEG()

I am attempting to loop through a folder of ~400 .mxd's and save each to a .pdf in another folder. All tested arcpy.mapping export functions (pdf, jpeg & png) kill python without a chance to ...
4
votes
2answers
108 views

How to Parse Unique Address Data

I'm trying to parse some funky address data into separate fields either using ArcMap's Field Calculator or a Python Script. Currently, my address data including street number, street name, and ...
1
vote
1answer
42 views

QGIS crash when using args=0 with qgsfunction

I am trying to define a custom function in QGIS 2.8.1 that takes no arguments. from qgis.core import * from qgis.gui import * @qgsfunction(args=0, group='Custom') def test(value1, feature, parent): ...
3
votes
4answers
86 views

Python Script create spreadsheet with exception

In the following Python Script, I would like to create a spreadsheet (Excel would be fine) with the Exception results instead of just printing "There was an error--->..." to be able to keep track of ...
0
votes
0answers
25 views

batch save MXDs to group layer files using ArcPy

Does anyone have / know of a script that converts all the MXD`s in a folder to individual group layer files ? It needs to use the MXD name as the group layer file name.
1
vote
1answer
63 views

Extract data from netcdf using a shapefile polygon in python

I need to subset data from a NetCDF using a specific shapefile. The data are sea surface temperature and ocean color at 1/4 degree resolution. I have 4 polygons describing the US. Northeast ...
1
vote
0answers
57 views

Compression Algorithms output files larger than the originals. Why?

I'm currently attempting to write a script that will compress a few hundred .tif files. I've tried two approaches, first I wrote a script in Python using CopyRaster_management() function and the ...
0
votes
2answers
40 views

Error msg “Name is not defined” when trying to populate a field with the shape file name

I am trying to populate a field with corresponding file name. For example, if the file name is Route1.shp then the field value will be Route1 as well. However my code is not working. Can you please ...
1
vote
3answers
45 views

Generate a string based on an integer range

After some initial research, I was unable to find a solution for the following issue. I'm sure there's an answer to this question already floating around here somewhere, but hopefully someone can give ...
0
votes
0answers
20 views

GDAL Python and postgis raster?

I'd like to create a postgis raster using GDAL and python. I can get the driver easily: drv = gdal.GetDriverByName("PostGISRaster") But how can I create a new raster table? I can't find any ...
-2
votes
0answers
44 views

Calculating the shortest distance along a given line using python

I want to calculate the distance among different points along a given road line using python script instead of Network analyst.Please note that the distance is along the road line ,not just the Euclid ...
3
votes
1answer
67 views

How to remove a specific unique value with arcpy

using arcpy, i would like to remove,from 50 mxd files, a specific unique value called "residence a" (exist in 3 layers) from the table of content. so i will get this result: The value of ...
0
votes
0answers
17 views

How to access Amazon S3 bucket using python? [duplicate]

I have an account in s3, installed boto package in my system and tested its working fine. I would like to access the account using my credentials with the following code and end up with the below ...