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

learn more… | top users | synonyms

3
votes
1answer
66 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
15 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 ...
1
vote
0answers
176 views

WindowsError: [Error 32] The process cannot access the file because it is being used by another process

I am reading images (through Python) and do something. These images are placed in a temporary file, through: tf = tempfile.mkdtemp(filename) I use gdal to read the images (short part of code): ... ...
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 ...
3
votes
2answers
847 views

How to debug 'Layer is not valid error' from Python plugin?

I'm trying to understand what goes wrong with a QGIS python plugin. Basically I'm trying to render a series of POINT. The query works fine, at least giving it by hand from inside PostGIS DB: "SELECT ...
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): ...
2
votes
1answer
222 views

How to use SAGA ShapesToGrid via Processing in a Python plugin?

I run these lines in my code: vectorlayer_vector = ftools_utils.getVectorLayerByName(inputLayer) Elevation = self.lineAttrib.currentText() cellSize = int(self.linePix.value()) outPath = ...
13
votes
1answer
967 views

How can I utilize NumPy arrays to optimize big data geoprocessing?

I'm interested in learning how to utilize NumPy arrays to optimize geoprocessing. Much of my work involves "big data", where geoprocessing often takes days to accomplish certain tasks. Needless to ...
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 ...
3
votes
1answer
517 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 ...
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
1answer
121 views

Arcpy MakeFeatureLayer won't loop

The arcpy snippet below is intended to generate a list of technicians scheduled to work, and then generates a unique feature layer for each one's stops. fcStops = "TaskRoute1016" with ...
0
votes
1answer
295 views

Orthographic reprojection with mapnik

I am trying to create a google earth like wep application. My problem is that I can't get to render a full view of the earth. The zoom_all() function generates the following error : RuntimeError: ...
0
votes
1answer
141 views

Weighted Overlay - passing parameter as text error?

For some reason when hardcoding the save path for the wieghted raster just before runtime it works perfectly. Like such... arcpy.env.cellSize = "90" arcpy.env.workspace = r'G:\Xcel\Route ...
2
votes
1answer
85 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. ...
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 ...
1
vote
1answer
126 views

Arcpy addin editable textbox on tool bar

I would like to add an editable toolbox on an arcpy addin toolbar. This would be used to change values of a threshold but I don't think this is currently available. (What I would really like is a ...
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 ...
4
votes
1answer
63 views

Dump a GeoJSON FeatureCollection from Spatialite query with Python

Given a Spatialite database, holding a table with a geometry column and some other attribute columns. I want to query that table in a Python script and get a GeoJSON FeatureCollection string in return ...
0
votes
0answers
21 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 ...
2
votes
4answers
2k views

Possible to add multiple fields in single arcpy statement?

I'm trying to add multiple fields to a table using arcpy and am wondering if it's possible to have multiple fields declared in the AddField management, and their values, separated by commas or ...
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 ...
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 ...
-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
1answer
123 views

Loading Oracle Spatial Layers in standalone python qgis

I used below script to connect to postgres and load layers successfully.I want to aceive this using Oracle Spatial for both vector and raster loading.How can I achieve that?In other words what is the ...
0
votes
1answer
171 views

Adding layer into ArcMap via Python - .pyt versus .py

In the final step of a script I've built, I'm trying to add a layer into an empty blank map document. This is my block of python code below that adds the layer. Everything works fine if its run from ...
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
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.
3
votes
3answers
92 views

Using Python to count records and show difference

I'm trying to find an example of a python script for ArcGIS 10.1 that will get count of a FC in my SDE and get count of a FC in an incoming FGDB update and then write the difference to a log file. We ...
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
1answer
31 views

GDAL2Tiles crash

GDAL2Tiles seems to crash after generating tiles and no google viewers are generated, but only openlayers. This is the code I run: os.system("gdal_translate -of VRT -a_srs EPSG:4326" + ...
1
vote
1answer
4k views

Using the arcpy.UpdateCursor to delete rows doesn't delete based on counter?

I am trying to delete rows from a shapefile using arcpy.UpdateCursor. The first thing I did was get a unique list of values from the key field "PolyGUID", then I iterate that list doing a ...
1
vote
2answers
209 views

How to plot Storm Prediction Center (SPC) Shapefile using python

I am trying to make a plot of the SPC's thunderstorm outlook using Python. I have downloaded the shapefile from this website http://www.spc.noaa.gov/products/outlook/day1otlk.html. Then I use this ...
0
votes
1answer
305 views

Polygon Neighbors Analysis script (ArcPy 10.1) producing erroneous results?

I'm struggling with a python script that is supposed to calculate a field for a polygon feature class. The calculation is of the average of a field value (P_TOT_DEV) for each of a given polygon's ...
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 ...
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, ...
-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 ...
7
votes
1answer
845 views

Meaning of exclamation mark in Python parser of ArcGIS Field Calculator?

In the following line, I don't understand what those exclamation marks mean? And why put everything in quotation? I don't understand the purpose of the variable expression, please explain to me as I'm ...
8
votes
3answers
856 views

Are there any training resources in SQL and Python as applied to GIS database management? [duplicate]

I've taken ESRI database courses, which have been helpful to my work. But I also need training in SQL and Python as applied to GIS database management. There are lots of suggestions for Python ...
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 ...
2
votes
0answers
55 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
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 ...
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
32 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 ...
0
votes
1answer
743 views

Geographic Transformations using ArcPy vs. Coordinate Systems used by ArcGis online basemaps

I have three shapefiles with undefined projection, but I know which one was used (Lisboa_Hayford_Gauss_IPCC). I need to first Define Projection. It works. I then need to transform it to WGS_1984, so ...
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 ...
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 ...
2
votes
1answer
67 views

DBSCAN gives “AttributeError: NoneType has no attribute issparse”

I am running a Python script invoking the DBSCAN tool to cluster feature points. When I open ArcMap, load the feature layer, and run the script, it works the way I expect it to. But if I run it ...
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 ...