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

learn more… | top users | synonyms

0
votes
0answers
15 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
34 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
31 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
76 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
31 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
102 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
66 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
52 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
24 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
21 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
804 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 ...
2
votes
1answer
62 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
31 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
23 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 ...
1
vote
1answer
96 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
76 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
109 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
36 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
24 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
30 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
76 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
64 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
39 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';" ...
-2
votes
1answer
92 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
31 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
53 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
29 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 ...
3
votes
0answers
53 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
40 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
19 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
32 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
24 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
263 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
56 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
37 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
50 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
42 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
89 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
52 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
49 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 ...
2
votes
1answer
45 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
77 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 ...