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

learn more… | top users | synonyms

6
votes
2answers
2k views

Is there a way to use ArcPy module in the python shell that is not with ArcGIS?

I have ArcGIS 10.2 installed on my machine. When ArcGIS was installed, python 2.7.3(32 bits) was also installed. I need python 2.7.5 64bits for some gdal functions. So I installed python 2.7.5 64bits ...
3
votes
1answer
58 views

Installing third party python libraries in ArcGIS location

I'm running ArcMap 10.2.2 for desktop and have Python 2.7 installed as part of the software package. I'm trying to get the pyexcel and xlutils libraries installed. I ran a script to find the path of ...
1
vote
0answers
37 views

Creating an ArcGIS toolbox with an R script

I posted this over on another website but since I think it might be an issue with ArcGIS, I decided to post it here also. So I have the following script in R. in_params[[1]] represents the input CSV ...
1
vote
0answers
27 views

Help with Python shapefile Union Program

First I am a Python noob... I have searched the database for this answer, found a few that might be the answer, just way over my head (I am signed up for a intro python class this month, to help ...
3
votes
1answer
41 views

How to create dataset in python with creation options like in ogr2ogr with -dsco options

In ogr2ogr there is dsco option (data source creation option). e.g. ogr2ogr -f DXF -dsco trailer=trailer_buildings.dxf -dsco header=header_buildings.dxf out.dxf test_buldings_shp.shp. It works well, ...
1
vote
2answers
218 views

QGIS Deployment in Citrix XenApp - How to Remove Pyramids from the image “properties”

I'm working on deploying QGIS 2.4 into a XenApp 6.5 desktop environment. We've tested QGIS to see if it will run in our environment on a test server and have found that building Pyramids with ...
2
votes
1answer
56 views

Python Geocoder w3w

I am trying to use w3w API with this python geocoder correctly. http://geocoder.readthedocs.io/index.html It works fine when I use it with google and bing maps import geocoder ...
2
votes
1answer
35 views

PostGIS query to get a list of points

I have a PostGIS road network layer (all features are linestrings) which I am accessing in Python and would like to get the geometry for each feature as a list of points. Something like ...
1
vote
3answers
88 views

32-days composite using LST 8-days Data

I want to make a 32-days composite from 8-days LST data by taking its average value, but I am facing a problem in checking QC-day, the other thing is, due to data gaps (missing DN values) we cannot ...
1
vote
1answer
11 views

How do I correct the GeoTransform of a GRIB dataset if I scale/crop the data?

I have modified the GRIB2 data to be cropped and a different size. I'd like to create a new GRIB2 file which contains this modified dataset. How do I calculate the new GeoTransform and create it using ...
3
votes
3answers
3k views

using Python to calculate NDVI, output as a Geotiff

I need a script that can calculate NDVI from two separate input Geotiff files, then output the results as a Geotiff. I wrote following script, most of which is borrowed from various on-line sources ...
0
votes
0answers
24 views

Python module for counting ratios from SHP attributes

Using OGR, I am supposed to create a Python module that finds out which specific administrative region of a country has the highest density of roads. I have two input shapefiles: roads connected ...
4
votes
1answer
477 views

How do I link OGR with spatialite?

Problem & Evidence: I'm trying to create a spatialite file with the code snippet below. However the outDataSource object gets assigned NoneType and all subsequent (unshown) code fails. I'm ...
0
votes
2answers
1k views

Unable to delete .lock files within geodatabase using Python

I am having problems with lock files while deleting and copying geodatabases for backup purposes. print "Now backing up your Geodatabase" distutils.dir_util.remove_tree ...
7
votes
3answers
7k views

How to create lines from points pair coordinates with arcpy?

I've got some points pair coordinates (start and end points) which I have to transform into lines. Until now, I used an append of both the coordinates in a pippo.Point(), a pippo.CalculateGeometry() ...
1
vote
3answers
49 views

Fiona error adding property to shapefile

I'm getting the following error when trying to add a property to a .shp file using fiona in python: Traceback (most recent call last): File "<ipython-input-38-5f04c3b56601>", line 17, in ...
1
vote
0answers
24 views

Export multiple Layer Definition Files (qlr)

I have a postgresql database with approximately 400 tables. I need to generate Layer definition files (qlr) in QGIS for each individual table. Making this manually would take huge amount of time, so I ...
16
votes
3answers
8k views

How can I iterate over map layers in QGIS python

I'm having trouble figuring out how to iterate over map layers. I can access the currently highlighted layer in the table of contents via iface.activeLayer() but I want my code to operate on all ...
1
vote
1answer
45 views

Merge points from multiple features that share common attribute

I have several point feature classes that all share similar attribute structure. How might I extract the points from all 9 feature classes that share a specific attribute? Background: There are 9 ...
1
vote
1answer
55 views

Why does joining all layers in a group not work?

I am attempting to re-join all layers within a group to another layer ("Main.shp") outside of this group. The idea is for users to change values in one of the group's layers. As these layers are ...
7
votes
1answer
208 views

gdalwarp producing empty rasters when called from python script, but not via command line

I'm trying to aggregate some raster data (all .tif) up to a coarser resolution (from .05 degree to .25 degree) using gdalwarp in python, but the command is not working. Instead of getting an output ...
0
votes
0answers
17 views

OGR WFS - GetNextFeature() - cannot parse - element arg attribute name had invalid value TYPENAMES

I am new to Python and OGR, and i try to follow advices given by Gene in ouvrir un WFS - debutant, but it fails... from osgeo import ogr driver = ogr.GetDriverByName('WFS') wfs_ds = ...
2
votes
0answers
51 views

Deployment of optical fiber QGIS Python

The subject that I’m working on is the deployment of optical fiber . I have a shapefile which represents a country containing homes. And I have another shapefile representing an infrastructure plan of ...
6
votes
4answers
2k views

Matching GPS tracks

I'm looking for a proper way to process multiple GPS tracks (so time ordered list of lat/lon points) and match/classify that segments, that are covered by multiple tracks: So it's not about ...
1
vote
1answer
255 views

Error Opening OpenLayers plugin in QGIS [closed]

I have installed version 2.12 of QGIS and I have installed the OpenLayers plugin. However, when I try to add a basemap through Web > OpenLayers plugin I get the following error message "An error has ...
5
votes
1answer
2k 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
0answers
32 views

numpy.unique: ValueError: all the input arrays must have same number of dimensions

I'm trying to get the unique values of an array but am getting an error that doesn't make any sense. Here is my pseudo code: import numpy as np import gdal # I have a .tif file, call it ...
5
votes
2answers
234 views

How do I include 64 bit python with ArcGIS 10.4 install?

I recently updated to 10.4 and was hoping the 64 bit python install was automatic, but apparently it isn't. I can't remember what I did in 10.3.x to get the 64 bit python. Does anyone know how to ...
0
votes
1answer
51 views

owslib - geonetwork - Failed to establish a new connection: Connection refused

i am tring to search for a specific record in geonetwork with owslib, according to documentation in https://geopython.github.io/OWSLib/. but it fails : >>> geonetwork = ...
1
vote
1answer
55 views

Python Script GetParameterAsText?

I am writing a python script to be added to a toolbox and I do not know how to call an existing tool to be a parameter. import geocoder ##geocoding library import csv import arcpy ...
3
votes
1answer
72 views

Clip raster by mask layer returns error “wrong number of parameters”

Using Python for QGis 2.14 Essen i try to clip a raster by a Polygon, as indicated here: http://docs.qgis.org/2.6/de/docs/user_manual/processing_algs/gdalogr/gdal_extraction/cliprasterbymasklayer.html ...
3
votes
1answer
70 views

Memory error in python when reclassifying array

I have a .tif that I read into an array (call it tifArray), and I would like to classify the array based on set of conditions: Where 1200 <= tifArray <= 4000, outputArray = 1 Where tifArray ...
0
votes
1answer
24 views

owslib - ValueError: All strings must be XML compatible: Unicode or ASCII

i try to use owslib to search metadata in geonetwork, and a i have problems when the string contains non ascii characters. geonetwork = ...
1
vote
1answer
263 views

how to find that two polygon boundaries are connected?

I am working on a Geo database where there is a layer with many polygons. i want to find that which polygons boundaries are connected so that i can create new layer from that polygons and which ...
3
votes
0answers
54 views

Approach to controlling which layers display in a QgsComposerLegend

I've tried 2 approaches to control what shows up in print legends. Neither of them work which is troubling because other than pruning the layerRootTree in advance of composer.addItem(legend), there ...
1
vote
1answer
487 views

Error in Select Numeric type column in pyodbc with ArcCatalog?

I created a python script that uses "pyodbc" plugin to connect a SQL Server database and write out data. It was imported in an ArcGIS 10.1 tool and run from there. try: arcpy.AddMessage('FLAG 0') ...
3
votes
1answer
436 views

WindowsError: [Error 32] The process cannot access the file because it is being used by another process

I am reading images (through Python) and do something. These images are placed in a temporary file, through: tf = tempfile.mkdtemp(filename) I use gdal to read the images (short part of code): ... ...
1
vote
1answer
56 views

Point otbApplication for python to the relevant OTB DLL's

I installed the latest OTB and Monteverdi on a Win 7 machine. Via osgeo4w I downloaded otbApplication for python, without any dependencies. Python, gdal, numpy scipy and so forth was custom build ...
3
votes
2answers
88 views

GDAL/OGR ogr.Layer.Intersection fails when producing mixed geometry results

I am trying to intersect layers using the ogr.Layer.Intersection method, in Python. This works fine for pairs of polygons, but I have found intersecting two linestring layers containing matching ...
1
vote
2answers
48 views

Select by attributes on PYQGIS 2.14 Essen

I'm trying to make a selection by attribute with python on QGIS Essen, but it looks like I am making a mistake on the script and I can not find it. Can somebody tell me what I have made wrong, or how ...
3
votes
1answer
42 views

Generate 1 shape out of many GPX files

I have many GPX files and i want to show them as layer on mapbox tiles. I managed to create "simple polyline" from gpx and then build GeoJson which include many features. That GeoJson is pretty big, ...
1
vote
3answers
72 views

Multiple python import from feature class into feature dataset in geodatabase

Is it possible to create a python script to import shapefiles/feature classes, from different sources into specific feature datasets in geodatabase, but in one script? I managed to write the script ...
1
vote
0answers
48 views

Getting started with GeoJSON using Python [closed]

I am a GIS analyst who knows ArcGIS and Python pretty well and have used QGIS. I am attempting to learn about GeoJSON and web-mapping. I am looking for suggestions on tutorials explaining GeoJSON, and ...
0
votes
1answer
961 views

ArcPy SelectLayerByAttribute Error and how to control GP output layer name

I have a rather long script that first references an SDE feature class (non-versioned) to perform an attribute selection based on a SQL selection. I've been unable to figure out why the script will ...
1
vote
1answer
81 views

Writing result of PyQGIS to shapefile

I try to perform some zonal statistics on a shape- and rasterfile and write the output to a completely new shapefile! import sys # where is the module ...
4
votes
2answers
187 views

How to render layer into png in a standalone application?

I would like to use standalone appliction to apply .qml style to a layer and use QgsMapRenderer() to save it as image on a hard disk. The are a lot of questions like mine at this site and it seems ...
2
votes
2answers
46 views

Sort Column and Sequentially Number Separate Column

I am trying to sort (alphabetize City) a column, and sequentially number a separate column for the purpose of labeling and creating a map key. What is the best way to do this?
0
votes
1answer
77 views

Compare features attribute

I have a polygon layer and each polygon has the MEAN elevation as an attribute. I want to write a python script to loop through each polygon and compare its elevation with its neighboring polygons. If ...
0
votes
1answer
82 views

How to delimit point distances in ArcGIS for Desktop per Thiessen polygon

I have 2 shapefiles. The first set contains x,y coordinates for 1100 hospital locations. The second pair contains x,y coordinates of about 7000 villages that are served by the hospitals. This means ...
2
votes
1answer
45 views

Drivers of Fiona

What drivers does the python package fiona have? When I check the manual it says [...] and the possible formats are enumerated in the fiona.drivers list. However, when I type in python from fiona ...