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

learn more… | top users | synonyms

0
votes
2answers
121 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
48 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
25 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
110 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
100 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
71 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
124 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
59 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
101 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
29 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
121 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
69 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 ...
1
vote
2answers
49 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
52 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
23 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 ...
3
votes
1answer
78 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
23 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
43 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
38 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
47 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
111 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
82 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
59 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
52 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
132 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
76 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
27 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
70 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
49 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
64 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
33 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
872 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
102 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 ...
2
votes
1answer
65 views

SelectLayerByAttribute and Where Clause

I'm trying to select the minimum value from a field to select and export that one feature to a temp shp so I can copy the field data from the point to a line. So far I have this: import arcpy from ...
1
vote
1answer
42 views

How to detect that QGIS is shutting down in a plugin?

I built a plugin in QGIS and needs to stop it when user wants to exit to remove signals and close properly. How can I get an event when QGIS is exiting ?
0
votes
0answers
26 views

Uploading raster to ArcGIS Server dynamically

I am building an new web tool related to agriculture research, this tool is linked to another backend GIS process done in c# and ArcObjects. I want to find a way to visualize this backend output ...
2
votes
1answer
174 views

Can we avoid using SIP library when writing standalone QGIS python script

I wanted to write a small custom python script using QGIS functionality. So I started with the QGIS documentation on the custom application section. After having some troubles with the import ...
3
votes
2answers
82 views

Looping field name change

I need to alter all of the field names through multiple feature classes. I have a pretty good idea of which tools to use but I'm not sure how to loop them through each feature class and each field. ...
4
votes
2answers
119 views

How to randomly move points?

I have a feature class with a large amount of points. My purpose is to randomly move these points to see what happens as a result. Are there specific tools or Python programming methods to accomplish ...
0
votes
0answers
40 views

Error when kriging: “output variance prediction raster”

I am trying to run a python script for kriging, but keep getting a following error message. It doesn't make any sense as the output variance prediction raster is optional. The code: # Create ...
2
votes
0answers
34 views

How to run Focal Stats on specific values in python

I'm a beginning programmer and am new to the site but it has helped me quite a bit so thank you! I'm trying to recreate a raster calculator operation using python scripts but am having a hard time ...
1
vote
1answer
32 views

ArcCatalog and python crash when running ConvertTimeField_management

I have a script which reclassifies a tif file, adds a new field to the tiff, and is supposed to parse the date from the filename and add it to the new date field. Everything works as it should, ...
1
vote
1answer
106 views

PyQGIS - load PostGIS layer as editable

I can load a PostGIS layer on QGIS' map canvas but "Toggle Editing" button comes "inactive". How can I load vector layer as editable? The code given below loads PostGIS layer on map canvas & ...
0
votes
1answer
70 views

Geocoding arcpy slow startup time

When scripting with arcpy.GeocodeAddress_geocoding (http://resources.arcgis.com/en/help/main/10.2/index.html#//002600000006000000), there's always a major lag to start up the geocoder. The issue here ...
0
votes
0answers
44 views

Perfom SQL queries in Python and process the result

I query column names from a PostGIS table with following Python code: colnames = [] sql_getcolumns = "select column_name from information_schema.columns where table_name='shp2py';" ...
-3
votes
1answer
104 views

Python script with ArcPy cursors won't stop looping?

I am running my script in ArcGIS 10.2 for Desktop and it doesn't stop processing. The process is overwriting itself because I have to shut down ArcMap manually. How can I stop the overwriting as its ...
1
vote
0answers
55 views

Calculating Climate Suitable Days using netCDF4 and Python?

This is a follow up to netCDF4 Python climate algorithm I’m relatively novice in using netCDF files, so I’m wondering if someone can check my logic on my process of delineating what has been defined ...
0
votes
1answer
76 views

Python script for calculating the area of a polygon

I am looking for a python code for this polygon. I need to calculate the area inside this polygon and I am new to programming. (Very new). Can anybody assist me with this? I have to use a python ...
0
votes
0answers
41 views

gdal_merge.py import gdal error

normal Gdal utilities work. gdal utilities with .py extension do not. they had worked very recently, within the last two months. checked the path variable and python version called from the command ...