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

learn more… | top users | synonyms

0
votes
1answer
72 views

Python Script to Select records based on user input

I am running Arc 10.3 in a versioned environment. I am attempting to write a simple code that will select service records coming from Oracle CRM to a separate feature class containing only records ...
2
votes
1answer
132 views

How to create a plugin GUI for QGIS 2.8.2?

I create a pluging with the pluging builder in Qgis 2.8.2. I went to the folder of my pluging : C:\OSGeo4W64\apps\qgis\python\plugins\yu in order to visualize al the files that the pluging builder ...
1
vote
1answer
35 views

How to search for fields in a GDB and add them if they don´t exist with arcpy?

I have a list of files that need to be present in my featureclasses - myFields[]. I need to add these fields if they are not present in my FeatureClasses. import arcpy myField="Field01" myFields = ...
0
votes
0answers
23 views

Python Error when I start Qgis

Thank you for the comment for this post: QGIS 2.8 starts with an error and I am not able to run Python console I have run yum search yum search qtwebkit and I got it that is installed. ...
1
vote
1answer
40 views

Parsing path and calculate value in model builder

I am experiencing an issue with the model only tool calculate value. I am attempting to use the parse path and calculate value model only tools to force a feature dataset into the create topology ...
2
votes
1answer
82 views

How to use %i%“.csv” in arcpy to name an output csv file?

I am using arcpy to describe datasets and output the results into a csv file. I am doing this via a script in arctoolbox and would like to save the file in the same folder as the file being analysed. ...
1
vote
2answers
106 views

Using Google API within Python and applying to ArcMap?

I am currently doing a practical project at university (MSc in GIS). I have to develop a python script and the functionality of this script has been left very open other than we have to use Python ...
2
votes
1answer
75 views

Polygon found with search cursor, but not update cursor

Here's my issue. I am doing two things with arcpy: 1) I search a feature class using arcpy.da.SearchCursor() and pull out a UID field and the geometry in WKB format for all polygons in the file, ...
1
vote
1answer
68 views

How to use gdal.FillNodata in python?

I am trying to use gdal.FillNodata in python on a ".tif" raster. The nodata value is set to -3.402823e+38. Here is my code : import gdal from gdalconst import * ET = ...
0
votes
4answers
175 views

Is there a site with templates for Arcpy where I can just fill in the blanks?

I have a Shapefile containing near 7000 pour points across the globe (GCS, WGS84). I'm using the following model to select the first feature point of the Shapefile, copy the selected feature in a new ...
1
vote
1answer
121 views

Performing image segmentation in QGIS?

I have been trying to learn to work with QGIS (open-source GIS software) through some tutorials available online for classification of image for land cover. These tutorials used a dataset from Landsat ...
0
votes
0answers
43 views

Image formats to use for land cover classification in Python? [duplicate]

I am supposed to classify images for different land covers or land uses in Python. I read somewhere that the spectral module of Python is required to do the processing of Hyperspectral image data. ...
0
votes
1answer
60 views

Grid-type shapefile from raster GeoTIFF

I need to produce a shapefile from a raster. I need to be able to specify either an interval, or manually define the intervals. The input file is a GeoTIFF. I would like to use GDAL and/or Python. ...
1
vote
2answers
47 views

Replacing shapefiles in MXDs using only Python options available prior to ArcPy?

I am trying to come up with a python script that will go through a designated folder, locate all MXD files within the folder, and then check each MXD to see if it contains a specified shapefile, which ...
1
vote
1answer
382 views

Interpolation grid for scattered data having (latitude, longitude) coordinates

I've got some scattered data in the form of (latitude, longitude, someParameterValue). I'm using inverse distance weighting interpolation method to interpolate them in a rectangular grid of pixels. ...
1
vote
1answer
54 views

set the transparency layer group with Python

How can I set the transparency for all layers within a group of layers? I assume this will require the use of a FOR loop in the Python Console. Based on How to set the transparency for multiple ...
1
vote
1answer
44 views

extract substring after first number

Suppose I have a field titled NAME1. Examples of what is in the field appear like this: Fox Lake 1 WABASCA 166 TSU TUE 196G YELLOW QUILL I.R. 90-8 POUNDMAKER INDIAN RESERVE NO. 114-17 CROSS LAKE ...
0
votes
0answers
24 views

Finding distance to travel along a linestring from current point

I am using Spatialite. I represent roads using LineString. When the user is on the road, I am interested in calculating the distance to travel to one of the ends of the road. I find this a fairly ...
1
vote
0answers
178 views

ImportError: No module named sip

I have been trying to write a custom application to generate contour from QGIS. This is my starting code: import os; from qgis.core import *; This is the error i am getting: Traceback (most recent ...
3
votes
3answers
194 views

Is there a better way to compare lists in arcpy?

I simply want to create a script which compares a list with the field names of a featureclass and if the fields do not exist in the featureclass add them. My code works, but is very inefficient. How ...
1
vote
1answer
42 views

Using Advanced Python Calculator in QGIS Modeler

I'm trying to create a column with integer values based on a small function that basically uses conditional statements. In short, a reclassification. My attempt below: def getValue(Etat): if Etat ...
0
votes
1answer
157 views

Extract multiple tar.gz files [closed]

I'm new here and in the world of Python scripting mostly with the arcpy module. I hope you can help me with the trouble that I have. I'm trying to develop a script to extract or uncompress multiple ...
0
votes
1answer
36 views

projection for high accuracy small areas

I need to convert (lat,long,height)points into a cartesian system for an area as small as 40kmx40km or even 10kmx10km. I'm currently using the UTM projection, but there are some issues regarding ...
-4
votes
1answer
90 views

How to convert inp to shp with Python? [closed]

How would I convert an EPANET .inp file into python lists in order to convert it to .shp files?
0
votes
1answer
55 views

Arcpy scripts run time dialog keeps deactivating tkinter window

I'm using tkinter in my scripts to get field names of the user in case the hard coded field names were not found in the target feature. it runs from python IDE, but when run from arcmaps toolbox the ...
1
vote
1answer
38 views

How to remove group filter applied via Python-console (setSubsetString) of QGIS?

I need to quickly applie (and then change/remove) the same filter for about 100 layers in my QGis project (all put together in one group). Since there is no implemented solution right now (a feature ...
2
votes
0answers
37 views

Create a sript for “point sampling tool” of QGIS

Is there any way to create a python script to the "point sampling tool" plugin from QGIS? I have a very large number of Netcdf files which I want extrat the values from pixels to a irregular points ...
1
vote
1answer
27 views

Workflow for updating raster using polygons of different attributes

I require a specific output but it is proving difficult for me to work out a workflow. I have: 1) polygons of new housing developments (356, non overlapping) 2) a 25m raster of land cover I want ...
1
vote
1answer
105 views

Value Error with Float/Integer/double Fields in Python?

When running this Code: import arcpy from arcpy import env import os #Specify the map document and the data frame mxd = arcpy.mapping.MapDocument(r"G:\\PythonCode\\mxd_test.mxd") env.workspace = ...
0
votes
1answer
50 views

Modify File Name with Python

How would I change the following code (outJPEG section) if d like to have the original attribute table name (eg Adress) and the attribute fieldname (eg ZipCode) as file name? (Adress_ZipCode) The ...
1
vote
1answer
52 views

how install shapely on windows so it can be imported from matlab?

i'm on windows 7/64. shapely doesn't offer windows installers on their pypi page, even though they seem to have recently (github issues 104 and 109 -- i don't have the rep to post links. their pypi ...
1
vote
1answer
94 views

How to create empty polygon shapefiles with the same field names using python?

I'm new to python scripting in GIS and I have a list with species names, for every species in the list I want to create an empty polygon shapefile with the same fields inside the attribute. I read How ...
1
vote
1answer
172 views

Calculate Field and Python Expression

i know to you my question sounds ridicoulus ... but i ask anyway ;-) i want to populate a field with a new value. If the field has a value of 1 it should get the new value of 15. If the field is 0 ...
0
votes
0answers
42 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
51 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
168 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 ...
1
vote
1answer
62 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
220 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
91 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 ...
1
vote
1answer
121 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
88 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
75 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
30 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
48 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
145 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
64 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
42 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
69 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
48 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
49 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 ...