Tagged Questions

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

learn more… | top users | synonyms

2
votes
1answer
63 views

Changes not persisting in ArcGIS server from ArcPy script

I have a ArcPy script (10.2) which connects to an ArcGIS server (10.0) versioned geodatabase, via an .sde connection file in the Database connections directory through direct connect on a Microsoft ...
3
votes
2answers
44 views

shapefile record has no attribute named bounds

This is the code that I am using to print the bounds of my shapefile. import fiona import shapely import shapely.geometry fc = fiona.open("filename.shp") shapefile_record = fc.next() shape = ...
2
votes
0answers
26 views

How to move feature using python console in qgis

i am building a qgis plugin that can create as much copies of a selected feature as i want and paste it to my required place.I have code to copy and paste feature select = ...
2
votes
1answer
41 views

Subset multiband tiff file using Python in ArcGIS for Desktop?

I have a multiband (1140) raster file in tiff format that I want to subset. Each band represents a prediction of monthly rainfall (12 bands for each year) over a 95 year period (12*95=1140). I need to ...
3
votes
3answers
79 views

Proj4 String for NAD83(2011) / Louisiana South (ftUS)

I am trying to convert NAD83(2011) / Louisiana South (ftUS) coordinates on survey maps to lat/lon using Proj4 in Python. Could someone please point me in the right direction? I have verified the ...
3
votes
1answer
53 views

How to automate the execution of Python console in QGIS?

I want to automate the execution of Python console in QGIS. When QGIS start, Python console starts at the same time, and Python predetermined code wants to be executed. Currently, in order to ...
2
votes
0answers
37 views

Kartograph - AttributeError: _Shape instance has no attribute 'parts'

I am new to GIS and open source tools so bear with me. I am attempting to convert a shapefile to svg by running kartograph as a python module. My source file (provided by the local GIS ...
1
vote
0answers
22 views

How to freeze basemap using cx_freeze

I am working on script and I´d like to freeze it for use in computers who haven´t got python installed- The script is running fine but when I freeze it using cx_freeze an error appears. at the end ...
3
votes
1answer
61 views

How to interpolate point set into value contours?

The task at hand is creating 'isobar' value contours that are interpolated from a point field of either the x/y or lat/lon type. I really have no idea where to begin mainly because this needs to be ...
1
vote
1answer
35 views

Why does QGIS 2.4 prematurely terminates on startup at “Starting Python”?

After reinstalling Python (3.4) as well as OSGeo4W and the QGIS Standalone, my QGIS always crashed when "Starting Python" on my Windows 7 64 Bit environment. It simply did not proceed to the QGIS-GUI ...
2
votes
1answer
47 views

How to highlight a selected feature in qgis plugin using python [duplicate]

I am working on a plugin that would highlight selected features by changing its color. Can anyone help me regarding this? The plugin searches for required features and once found, I want that those ...
2
votes
1answer
46 views

Grass python shell can't find my data

I have a problem, the grass 7 python shell can't find my rasters. When I try to use the python shell to set the region I get "region not found". I can set the region in the grass shell (and other ...
3
votes
0answers
59 views

How to use Python's subprocess module in a for loop ArcGIS?

I am new to scripting with ArcGIS. Although this might be an easy thing for those that know Python well, I haven't figured out how to use the subprocess module in a script. I actually think I'm ...
3
votes
1answer
31 views

Fast editing in raster calculator — adding lots of images together

I need to add pictures together to make one raster. In one session there are about 150 - 200 images (named randomly - see syntax example) There are about 50 sessions (named randomly) Is there any ...
1
vote
0answers
21 views

Error message retrieval in grass.read_command

I am writing a script in python and would like to get the error messages of the function grass.read_command for seeing why it is not working. I found a webpage ...
2
votes
0answers
35 views

Validating whether PDF file Uploaded as part of Geoprocessing Service of ArcGIS for Server?

I'm developing a Python Script that will be a Geoprocessing Service in ArcGIS Server. The Script has a Button for Users to OPTIONALLY Upload a PDF. If the PDF is Uploaded it gets inserted into the ...
2
votes
2answers
62 views

Delete Files in a folder and disregard an existing folder

I did a lot of geoprocessing steps and now I like to delete all files including result, result, _join, _interand reclass in their name. I can do this with the following import glob import os for fl ...
2
votes
0answers
60 views

Setting up pycharm and pyqgis

I wanted to set up PyCharm the way this blog post explains: Setting up PyCharm for PyQGIS and Qt. I did everything as instructed but when it comes to adding project interpreters I got this error ...
1
vote
1answer
87 views

GDAL Merge Py on ubuntu many tif tiles into one

Trying to batch mosaic 1000 Gtiff rasters (all in one folder) into 1 tif file via gdal merge on linux ubuntu. Having trouble with the linux command to bring in all files in a folder into the output ...
1
vote
0answers
39 views

Clip Management won't work outside of ArcMap/Catalog

Okay so I have a short script that works great when copied into the python window in ArcMap or ArcCatalog, but refuses to work in an IDE for whatever reason. The error that is thrown is: Start Time: ...
1
vote
0answers
27 views

PyQGIS add WMS layer with CQL_FILTER

Dear PyQgis developers! I'd like to add a wms layer through my QGIS plugin with custom CQL_FILTER parameters. My problem is, that the CQL_FILTER parameters are not passed to the GeoServer (I can see ...
2
votes
1answer
75 views

PostgreSQL PL/Python Function for “IF” condition

I am using OSM data to run pgr_dijkstra() for weighted-path calculation. But after importing OSM data using osm2pgsql I populated some additional columns into my ways table. So now it has gid serial, ...
2
votes
1answer
70 views

Georeferencing a raster using GDAL and Python

I want to georeference a raster using python and GDAL. My current approach is to call gdal_translate and gdalwarp using os.system and an ugly list of ground control points. I'd really like a way to do ...
0
votes
2answers
100 views

How to replace “NULL” value with Zero in geodatabase table

I am having some difficulties to change "NULL" values to zero in geodatabase. I have tried the following python code in ArcGIS 10.1 ("Field Calculator") to change it but did not work. Pre-Logic ...
2
votes
2answers
65 views

ArcGIS Field Calculator passes European-formatted floats as tuples

I have the problem that the ArcGIS Field Calculator doesn't read a float number when it is included in Python by referring to the field that contains it, in this way: def giveResult(floatValue): if ...
0
votes
2answers
70 views

How to calculate cumulative decreasing sum in ArcGIS-10.2

I need to calculate the cumulative decreasing sum as a field in a rasters attribute table. The cumulative decreasing sum is the accumulation of the last values to the first, so it is basically the ...
2
votes
2answers
92 views

Is there function to know raster's size (KB) with python?

I am doing a script with python. There I have many raster in canvas (qgis) which I would like to know size in MB. I am searching function in python that give me this result. Anyone can help me? Thank ...
0
votes
0answers
17 views

DeleteFeature work very slowly with a MemoLayer

I have a python custom geoproccess wich use osgeo.ogr with a 'Memory' datasource. It work pretty fast except in one point where I need to delete feature known by id in a list. duplicated.sort() #list ...
0
votes
1answer
23 views

How do I define 'KrigingModelOrdinary'

How and where do I define the KrigingModelOrdinary Here is the code: rasterKrig = "run{}_Krig_{}".format(counter, field) outKrig = arcpy.sa.Kriging(Stations2010o3Data__2_, field, ...
1
vote
0answers
22 views

Adding features in the layer with reference to another layer

I have built a tool for creating line in the exact center of two selected lines through this code: import math def mainCl(): ftr_geom = [] select = iface.activeLayer().selectedFeatures() ...
2
votes
1answer
84 views

'QgsVectorDataProvider' object has no attribute 'select'

I want to create a tool layer in QGIS 2.4 that will select any vector features that intersect with that point. In my script I tried the following function: def selectFeature(self, point, button): ...
1
vote
1answer
50 views

Calculate azimuth of vector for QGIS 2.0 Python plugin

I calculate the azimuth of a vector and update a field in my QGIS 2.0 Python 2.7 plugin. This works currently, but it takes much longer than i'd like to. I believe it is because i'm querying the data ...
7
votes
2answers
156 views

Calculate Date Field - today's date from datetime.date.today

I'm working on part of tool that will use arcpy.CalculateField_management to add the current date to the attribut table. I've wandered far and wide on the interwebs and can't seem to find the ...
1
vote
4answers
164 views

Arcpy: what tools are most suited for this job?

I'll try to be as much detailed as possible but please let me know if anything is missing: I'm trying to get the number of lines in layerA that intersect with each line in LayerB and stores that ...
2
votes
2answers
62 views

Reclassify rasters using GDAL and Python

Using @SS_Rebelious very useful answer, I am trying to reclassify rasters using GDAL and Python. I have a grayscale raster (with values ranging from 0 to 255) and I want to reclassify it to a binary ...
1
vote
1answer
18 views

Feature Layers for Subsets

I need to create a subset of data based off their distance from particular points in ArcMap. Is it possible to create Feature layers that have a defined buffer, that only show data within that buffer? ...
4
votes
1answer
47 views

Installing scipy.spatial with ArcPy gives DLL load failed error on import?

I am running python 2.7.6 from an ArcGIS installation. I have tried to install scipy from the Python Exchange Packages here, using the scipy-0.14.0.win32-py2.7.exe executable. I get no error importing ...
1
vote
0answers
37 views

Esri Python Toolbox(pyt) corruption in ArcToolbox.dat

Symptoms: Open ArcCatalog and all tools within Python Toolbox(pyt) have a red-x error next to them claiming that "Arcpy module has no attribute Parameter" Close ArcCatalog Delete ArcToolbox.dat file ...
2
votes
1answer
157 views

Plotting elevation maps and shaded relief images from latitude, longitude, and elevation pairs

I have a set of latitude, longitude, and elevation pairs (roughly a grid of such values, though it is not uniform), and I'd like to be able to plot an elevation map and perhaps also a shaded relief ...
2
votes
1answer
32 views

How to use grass.script in MacOS

I have installed Python and Grass6.4 using Macports. When I tried to use "import grass.script" in python environment, it gives "no module found" error. I'd spend much time to fixed it but could not ...
0
votes
0answers
22 views

Can I invoke MapWindow GIS software from python,.net or any other scripts language

I am interested in working with MapWindow GIS. Is it possible to invoke MapWindow GIS from scripting (like external python).
2
votes
2answers
81 views

Returning value from other field, using FieldCalculator

I am very new to Python and need what I believe is a very basic script in order for my field to represent another fields' input, if the field's value is 0. I tried to search for this, but gave up ...
1
vote
1answer
43 views

How to get coordinates of line

I am working on Qgis python console. I want to draw a line in the center of two parallel lines..For this purpose firstly i have to store the coordinates of those two lines in a variable so i can apply ...
0
votes
0answers
15 views

PyQGIS: Coordinates to TextBrowser

I'm doing tutorial: http://www.qgisworkshop.org/html/workshop/plugins_tutorial.html#tie-qgspoint-output-to-the-gui Right now I at the "Tie QgsPoint Output to the GUI". I did everything similar to ...
3
votes
1answer
126 views

Shapely/ Python looping through a number of polygons

I am trying to loop through a set of polygons in shapely so using python) to determine whether they overlap or not. I do not want to do it manually as later i want to generalise the procedure and do ...
4
votes
1answer
67 views

Is there a public API that can be accessed with Python and will geocode Points of Interests?

I recently downloaded tagged hospital data from OpenStreetMaps.org using the API. Some of the data have a 'node' tag which are attributed with a lat/long while other data are tagged as 'way' format ...
3
votes
2answers
79 views

Extract values from raster based on points and pixels adjacent to the point

I have an issue. I have a set of points (n=~2000) and I would like to extract the pixel values from multiple rasters (a single-raster solution is also ok) for location of that point as well as that of ...
1
vote
1answer
46 views

how to open shp file which created by using python-ogr in qgis?

I have done following steps, so how I open that created shp file in Qgis driver=ogr.GetDriverByName('ESRI Shapefile') out=driver.CreateDataSource('pts.shp') ...
0
votes
1answer
38 views

Arranging elements horizontally in ArcGIS tool

Is it possible to arrange multiple check boxes horizontally in a tool and changing the parameters dynamically (adding/removing) based on user selection of check boxes?
2
votes
1answer
33 views

Cut polygon shapefile with 2 parallel lines to derive new inside polygon?

Using Python scripting: How can I clip a polygon shapefile with parallel lines (polyline shapefile) to derive new inside polygon?