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

learn more… | top users | synonyms

2
votes
1answer
233 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 = ...
-3
votes
0answers
61 views

How can I create a text file or a shapefile in python?

I want to create a shape file in the end of this process. How can I do it? please respond if anyone knows this question. import os, sys, numpy, scipy, osgeo.ogr from scipy import * from ...
0
votes
2answers
38 views

It's possible to use gdal_calc.py with an entire path of rasters?

I try to use gdal_calc.py to scale and transform a time-series of MODIS images. I've done that when i worked with a single image in the -A variable and a mask in -B, but i need to work with a ...
5
votes
2answers
2k views

Automating batch load of multiple GPX files into PostGIS

I've got 50+ GPX files that I would like to "batch load" into a PostGIS database. All of the track_points data would be loaded into a "track_points" table (with typical GPS fields like lat, long, ...
1
vote
4answers
58 views

ArcGIS 10.2.1 arcpy handling quote mark styles

I have been asked a question that I believe is due to a mix a quote marks however I cannot specifically say why this is so in the example below. I wondered if anyone has had a similar issue. A small ...
0
votes
1answer
38 views

ArcMap 'in_memory' trouble?

Being new to ArcMap, and ArcPy I have a problem with a script including several geoprocessing functions. The number of functions inspired a search for a means to save outputs (subsequent inputs) to ...
0
votes
1answer
44 views

Dose pyModis work with “ModisSwathTool” too?

I am going to use pyModis to work with MODIS data, Since I am quite new to Python, before starting to learn and use pyModis, I have a question for those who are familiar and using pyModis, right ...
2
votes
1answer
27 views

PyQgis - saga:catchmentareaparallel parameters

in PyQGis i want to use saga:catchmentareaparallel algorithme, in the parametres there is an optionnel arguments , and i don't want to use theme , what is the value should i put on the argument?? i ...
1
vote
0answers
36 views

Algorithm for re-numbering duplicate feature IDs based on distance along line (PyQGIS and QGIS 2.8)

I've got something working for QGIS 2.8 using Python 2.7 on Windows 7, but I am missing an important part of the puzzle. I'm trying to develop an algorithm to number homes. I've now come to a point ...
0
votes
2answers
51 views

CRS problem between QGIS and fiona / OGR

I have a really annoying problem working with QGIS for visualization and python (fiona / OGR) for the actual operations. I am, by example, doing a simple dissolving operation with fiona. The input is ...
1
vote
1answer
146 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 ...
0
votes
1answer
50 views

Reversing polyline direction based on raster value using ArcPy?

I am trying to create an ArcPy script that will read a raster cell value at the start point and end point of a polyline, and flip the line based on those values. I do not want to create another ...
1
vote
2answers
55 views

Access individual bands and use them in map algebra

I have a list of multiband rasters, consisting of: Red=Band 1, NIR=Band 2, SWIR1=Band 3 and SWIR2= Band 4. What I want is to access only the red and NIR bands and save it to new file. Then, I'll be ...
0
votes
1answer
27 views

Custom Script Tool - Raster Index

I am still somewhat raw with python, although I am learning and trying to develop some tools. What I do need help with is a script tool which creates an index of rasters. It was created by someone who ...
0
votes
1answer
146 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 ...
1
vote
1answer
55 views

Clipping a tiff image using another tiff image using python

I am working on a code to clip a raster with another raster. I have a forestcover.tiff image and i want to clip it by using other image clip.tiff which extend lies within it. I dont want to use arcpy ...
0
votes
1answer
40 views

Trying to use a python script to manipulate a value from attribute table

I am using ArcGIS ArcMap 10.2 and I am trying to learn how to write a python script to use a value from an attribute table and perform some checks to it and assign an output value. At this moment all ...
3
votes
2answers
152 views

Dissolve polygons based on attributes with Python (shapely - fiona)

I have been trying to create a function that does basically the same thing that the QGIS "dissolve" function. I thought it would be super easy but well apparently not. So from what I have gathered ...
4
votes
1answer
176 views

What's the most efficient way to load feature attributes into a numpy array?

I am currently working on an add-on that relies on the user choosing fields of tables (that can be from shapefiles, csv or dbf) that are open in QGIS and then making computations with such data. ...
0
votes
1answer
240 views

Get shape file polygon attribute value at a specific point using Python (e.g. via PyShp)

I have a shape file comprising multiple polygons. These polygons have attributes. I am trying to write a script in Python that takes a co-ordinate point, determines in which polygon it falls, and ...
1
vote
1answer
53 views

CalculateField with variables

I'm trying to make a python script on arcmap 10.2.2 which will copy values from an old field (selected by the user) and paste them in an new field (named by the user). I wrote that: fc = ...
1
vote
1answer
35 views

Does arcpy have any tools for transforming field values in a fieldmapping?

I built my fieldmappings and, for the most part, everything is working. I recall reading somewhere that I could also use fieldmappings to transform field values during the import process. ...
0
votes
2answers
25 views

Easy Data Source Removal

I am trying to remove anything in a map that has "DI" in the source path. I have a test mxd with one df and 2 lyr's. The lyr data sources are: ...
3
votes
2answers
110 views

ArcGIS tool for graph analysis

I have a road network shape file. After creating Network dataset I get a graph with vertices and edges. I need to create a tool for ArcGIS (through a Python code) which enables to calculate depth of ...
0
votes
0answers
16 views

Join based on approximate area

I am trying to join information from a table to information from a feature class based on "approximate area". I have drawn (on-the-fly) building footprints, multiple footprints per parcel. I have ...
1
vote
1answer
36 views

When building fieldmappings, how do I handle the SHAPE field?

I have a collection of hundreds of shape files and a python dictionary mapping the input field to the output field. I'm building my fieldmappings dynamically using this dictionary since it already ...
0
votes
0answers
59 views

Arcpy strip '{ and ]' from list return

I have a static list that I would like to pull values from and use in a query. I can populate the list dynamically from the data but the set is quite large and I think having a static list from a csv ...
3
votes
1answer
39 views

How to access CRS of shapefile in standalone script?

I'm trying to access the CRS of a layer and use this to create a grid. I followed the answer in this post which works great in QGIS but I would like it to work in a standalone script. Here is a ...
8
votes
2answers
584 views

How to create a solar intensity map for a garden plot?

I'm interested in creating a raster surface that depicts the average solar intensity per unit area for a small garden plot. I imagine the inputs into the model would be the following: Plot ...
1
vote
0answers
21 views

GRASS and SAGA CentOS Linux release 7.1.1503 (Core)

I have a problem. I am developing a standalone app using QGIS but my script imports GRASS nad SAGA plugins and I have error to create the maps. I have CentOS Linux release 7.1.1503 (Core). SAGA is ...
2
votes
0answers
43 views

QGIS not interacting with iface from python class

So I'm working on something where i need to use threads from python console of QGIS. The following line of code adds layer successfully iface.addVectorLayer("D:\ArcGIS Misc\Atlas\points.shp", ...
0
votes
0answers
21 views

How to change sql (or filter) in QGIS with Python script

I am trying to render to images, a series of maps based on a series of data (status over time). Currently I am using QGIS (so far I have only used it for 1 day but it is really amazing) to pull in my ...
1
vote
1answer
348 views

How to export a set of layers into multiple PDF(orAI)files, one layer at a time?

I am completely NEW to PYTHON(only took a 3-hr entry course in ESRI tutorial. I have a dataset contains files named as "1_A, 1_B, 1_C....12_A,12_B, 12_c,....200_A, 200_B, 200_C..etc." I need to export ...
3
votes
2answers
188 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 ...
1
vote
1answer
152 views

QGIS (2.6.1) Processing Toolbox InitGui error after changing /Users folder on Mac OSX

Using: Mac OSX 10.9.4 QGIS 2.6.1 I had previously installed QGIS and had everything running fine. My home directory was /Users/rowanbado, but for another application I had to add an ...
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 ...
5
votes
2answers
175 views

GDAL (or other open-source) equivalent of Arc's Point To Raster Tool

I'm trying to convert a python script that relies on arcpy into one that only relies on open source modules, but I'm having some trouble. The bulk of my processing lies in one Arc tool "Point to ...
2
votes
1answer
135 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, ...
3
votes
0answers
51 views

Publishing a geoprocessing service that imports modules besides arcpy?

I'm trying to publish a geoprocessing service (10.2.1) that will be used to generate a PDF from a webmap using an MXD layout as a template. The problem is that if I try to import any module besides ...
1
vote
1answer
45 views

Country border between two points

I am trying to extract country borders between two points, using Python. The border is a Shapely Polygon.exterior or LinearRing, the start and end points are Shapely Points. My idea is the following: ...
2
votes
2answers
563 views

How to re-project the EASE (Equal Area Scalable Earth) grid with a ~25 km cylindrical projection to WGS84 0.25 degree?

I have nc files. from the metadata ,the projection is cylindrical and the resolution is 25 km: indrical NC_GLOBAL#ease_resolution=25 ...
6
votes
4answers
548 views

Python resource for remote sensing? [closed]

I am looking for a good resource (MOOC, book, etc..) to teach Python for remote sensing applications. I am already familiar with http://www.rsgislib.org/ - are there any other resource out there for ...
2
votes
3answers
428 views

How to increase raster extent by filling extent with no data using ArcGIS Desktop without Spatial Analyst?

I am using feature to raster to rasterize water polygons. It only makes a raster the extent of the features in the polygons, whereas I would like it to be the extent of another existing .tif image. ...
4
votes
1answer
1k views

How to create mask bands in GDAL and Python?

I have small program in Python that uses gdal and numpy to perform a logarithmic scale of some data into the RGB 0-255 range. Now this input data has a nodata value set to mask the valid values, and ...
0
votes
1answer
25 views

Python brkLyr.supports (“dataSource”) Error

This is supposed to loop through a directory of MXD's and look for broken links and create a report. I am getting an error, an exception I believe, on one of the data sources. In the MXD it shows a ...
0
votes
1answer
66 views

Convert length in decimal degrees to feet

I've got attributes for a length that the Near tool calculated, and it gave them to me in decimal degrees. I need them in feet. Is it possible to do this with the Calculate Field tool? I tried ...
-5
votes
1answer
40 views

Field calculator with next() function? [closed]

I want to do calculate with script, field - field.next () with incrementation of 2 rows
3
votes
2answers
1k views

Check if field value for selected features is null using ModelBuilder

My feature class contains two fields: an identifying field U_ID, and a descriptive text field DESC. This field currently has <Null> for all features. I would like to select all the features with ...
4
votes
2answers
143 views

3d vector and geometry operations in open-source GIS

There is some really good open-source software available to work with 2D vectors. For example QGIS has operations like buffer / clip / dissolve / select by location / join attributes by location... ...
0
votes
0answers
15 views

build and installed QGIS 2.6 from source but its not loading layers with error “ minidump written to /some directory/”

After successful build and install it was showing me many .dlls missing and i have tried to copy .dlls from apps forlder in OSGEO4W folder and it solved but latter after launching the gui of qgis ...