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

learn more… | top users | synonyms

0
votes
0answers
37 views

Python snippets from QGIS

Out of curiosity and perhaps for practical reasons, is there a way to obtain Python snippets from QGIS 2.8 the same way you do in ArcGIS? Please don't redirect me to some other question that looks ...
0
votes
0answers
44 views

ArcPy: execute code for each feature in a dataset

Is there a way in ArcPy to iterate through a dataset and do something with the current feature without having to manually select that feature? Two examples for clarification: - export each feature as ...
4
votes
1answer
149 views

Why can't I copy values from a virtual field to a non-virtual field using PyQGIS?

Using the python console, I am trying to copy values from a virtual field into another non-virtual field. Both fields are integer types but I get NULL in the non-virtual field. I followed the answer ...
0
votes
0answers
18 views

How to sort points in a proper order using arcpy? [duplicate]

As the picture shown in below that i have bunch of points distributed in an area. Its location is no problem, but their attribute records of each points is not in a proper order as u can see in the ...
1
vote
1answer
26 views

Adding feature class into ArcGIS 10.3 mxd using python script [duplicate]

I am trying this simple task to add a feature class to an mxd (ArcGIS 10.3) but getting few errors. Here are two options I tried. 1) Preferred option - adding feature class itself into a active ...
0
votes
1answer
60 views

Arcpy: MakeFeatureLayer_management: Where is the file?

I am trying to understand arcpy/python, and am confused about where a layer file is located during the process. This is my code: import os, sys import arcpy gdb = "C:\\Example.gdb" featureClass = ...
1
vote
1answer
59 views

How to create a line between a point and nearest neighbour using python (template included)

I have 2 shapefiles - one is a series of points, the other is a polyline. I want to draw a straight line between each point to the nearest point on the polyline. This question has already been asked ...
-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 ...
1
vote
1answer
111 views

Problem with Memory storage type in PyQGIS when updating with auto form

I have a layer of "Memory storage" type (Memory provider) which I created with Python. When editing=on and updating values using the attribute table interactively everything works as expected, i.e. ...
0
votes
1answer
41 views

How to place an numpy array into GeoTIFF image using python-gdal

I am attempting to export data of varying scales into GeoTIFF images...a new method for me. The problem I'm running into is when using the GDT_Byte pixel type, data values < 0 and > 256 are not ...
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 ...
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 ...
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 ...
3
votes
3answers
110 views

How to calculate path length of each point from the start using arcpy?

As shown in the picture below I would like to calculate the path length of each point from the start. Can anyone give me some help in writing this in python for ArcGIS?
0
votes
2answers
50 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
0answers
35 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
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
43 views

pyQGIS version of the arcgis tool dice

I'm using QGIS and I have some large features that need to be diced up into features with less vertices. If I were using arcGIS I could use the dice tool If I were only interested in lines I could ...
0
votes
1answer
42 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 ...
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 ...
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
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 ...
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 = ...
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: ...
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. ...
3
votes
2answers
145 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 ...
0
votes
1answer
26 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 ...
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
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 ...
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
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 ...
1
vote
0answers
17 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", ...
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 ...
1
vote
0answers
33 views

How to “output to a raster file” in a standalone app based on a composition?

In a standalone app I want to create a print composer with the map, a legend and a scale bar. I try with different codes but without success. I search in several foruns but I didn't find an answer. ...
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 ...
3
votes
0answers
50 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
2answers
68 views

Arcpy - Calculate total time, last value minus first value

For the script tool I've written (below), one of the things I want to do is after user input has pulled tabular data (into a feature class) I want to take the last value of the 'logdt' and subtract it ...
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
63 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 ...
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: ...
-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
0
votes
0answers
14 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 ...
4
votes
2answers
139 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... ...
1
vote
1answer
71 views

Python heatmap from data

Is it possible to make something like this using python ? How should i best structure my data in order to make this map and what should i use to draw it. Code is not necessarily required. I just need ...
1
vote
0answers
43 views

Remove Frame Border from USGS scanned images in ArcGIS

I have a couple of USGS scanned maps like I want to remove the frame border from these images so that I can use them in ArcGIS. Is there algorithm or python script that I can run to remove the ...
0
votes
0answers
63 views

Error in python code for map automation (loop)

I try to make this code work but I cannot find the error (not very familiar with python) The code should basically run through a file GDB where all the feature classes are stored. It then should ...
1
vote
0answers
64 views

How to create line segments between pairs of pixels in a raster?

I want to draw several lines between pixels (please see the image below) according to some criteria : First Criterion: The distance between 2 pixels is less than 2000m and greater than 500m ...
3
votes
4answers
113 views

Workflow for identifying gaps in polyline shapefile

So I have a polyline shapefile showing the border of a city, however there are multiple gaps in the shapefile ranging from ~2m to well over 1km that are almost impossible to see when viewing the area ...
0
votes
2answers
36 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 ...