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

learn more… | top users | synonyms

1
vote
2answers
31 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
30 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
25 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
61 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
33 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
14 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) ...
1
vote
2answers
371 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
18 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
48 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
82 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
40 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
70 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
48 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
52 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 ...
0
votes
0answers
47 views

Changing data source using ArcPy?

I have a oracle enterprise GDB (SDE_GDB). I need to change the DS so as to point to a featureclass in a differnt sde user. The following pictures describes how this can be done in arcmap.. This is ...
4
votes
1answer
101 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
39 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
55 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
54 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
42 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
18 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
42 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 ...
0
votes
0answers
14 views

Defining 'os' in geonode custom installation?

Can any body teach me how to resolve this GeoNode problem? I tried following Geonode's documentation on installing it in development mode which was successful however when I tried changing its default ...
0
votes
0answers
33 views

Looping over array of type float with interval of float (NDVI) using Python?

I am stuck with my Python Script. The case is, I have an array of floating numbers from 0 to 1 (NDVI values). I want to loop over my array with an interval/step of every 0.025. Every interval/step I ...
1
vote
1answer
36 views

Export attributes of shapefiles into text file

I'm trying to export attributes of multiple shapefiles a text file. I am multiple getting errors when I run my code not sure what the issue is. Any direction as to where to start to fix this would be ...
2
votes
1answer
27 views

Setting Two Definition Queries as Parameters in Python Script tool causes: RuntimeError: LayerObject: Set attribute definitionQuery does not exist

I created a script that adds definition queries to every layer in an mxd depending on the layer name. This worked fine as a stand alone script, but when I try to use it as a script tool with ...
1
vote
1answer
75 views

Getting index of active data frame in ArcPy?

I am a little surprised to see that there seems to be no way to get the index of the active data frame in ArcPy, or did I miss something? For example, what if you want to add a tool’s output to the ...
0
votes
2answers
56 views

ArcGIS Python if statements say field not nullable?

I am creating a new field - let's call it A (SHORT INTEGER) in shp file using Modelbuilder and I need to fill it it with the values from two different fields. First step is to fill field A with the ...
1
vote
2answers
49 views

Can you access all tools in python/arcpy regardless of license level?

Is it possible to write a python script using arcpy that is for a tool not included in the current desktop license level? For example, write something using the Identity Tool when you only have a ...
0
votes
1answer
30 views

Python Script to batch compress .tif files using LZW compression

I am currently trying to batch compress a folder of .tif files using LZW compression in order to free up storage space. I've been using this script in ArcMap's python window, adapted from here: # ...
2
votes
2answers
97 views

Trying to re-project a folder of shapefiles using Python Script

I am trying to reproject multiple shapefiles in a folder. When I run my program this is the error I am getting: line 8221, in Project raise e ExecuteError: Failed to execute. Parameters are not ...
1
vote
2answers
61 views

Python Script to Add Multiple Fields to Feature Classes

I am trying to add 2 (multiple) fields to each feature class in a gdb. I based the script off of Python Script to Add Fields to Feature Classes. I feel like I am missing something and can't figure ...
0
votes
1answer
23 views

How to combine two rasters based on the relationship to a polygon mask?

I am looking to combine two single-band, 1-bit rasters of the same spatial extent based on their relationship to a polygon (mask). The image shows a polygon displayed with a cross-hatch and the two ...
2
votes
1answer
49 views

Gdal_calc works but I get a pyhon error at the end of each process

I have a problem while using gdal_calc by a .bat file. Here is the code : call "C:\OSGeo4w64\bin\o4w_env.bat" gdal_calc ...
0
votes
0answers
19 views

mbutil export of mbtiles png files are all corrupt

I have an mbtiles file that I created with MapBox studio from a GeoTIFF source, and when trying to export the mbtiles with mbutil, all the images are corrupt, no matter if I try png or jpg. Has ...
1
vote
1answer
54 views

Combine multiple shapefiles python

I'm pretty new to working with shapesfiles. I'm trying to create a spatial index of addresses in NYC. I completed it using an rtree but have only done it for Manhattan. To complete the other counties ...
1
vote
0answers
19 views

Setting up PyCharm CE 4 to work with PyQGIS library in Mac OS

I am trying to set up pycharm to work with pyQgis library but with not success till now. I am using PyCharm CE v4 and QGIS version 2.8 I have tried to implemnte the instructions of several posts like ...
17
votes
3answers
793 views

Is it possible to look at the contents of Shapefile using Python without an ArcMap license?

I wondered if it is possible to look at the contents of a shapefile using Python without having and ArcMap license. The situation is that you can create shapefiles from many different applications, ...
-4
votes
1answer
72 views

Copy\ Paste folders and subfolders with python [duplicate]

continuously to How to copy a fgdb using Python? , i work with arcview 10.3 and ptyhon 2.7.8. I try to copy a folder (dir_src) that divided into a lot of subfolders (all subfolders contain files and ...