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
37 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 ...
0
votes
0answers
7 views

Check if point is within radius of another point with Shapely

I've successfully used Shapely with python to check if a point is within one of a set of polygons in a .shp file but now would like to check if a point is within a circle of radius x miles from ...
1
vote
0answers
13 views

Different results from GDAL raster attribute table command on mac and windows

I am trying to get the raster attribute table of the following file: Shift_cult_past_current_prediction_20160107_gr1DD.tif available here: ...
1
vote
0answers
27 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 ...
3
votes
1answer
18 views

Errror using the Simplipy QGIS plugin: 'QgsRasterLayer' object has no attribute 'selectedFeatureCount'

I am adding a raster in QGIS 2.14.1 and get this new error: AttributeError: 'QgsRasterLayer' object has no attribute 'selectedFeatureCount' I am not programming, just using a QGIS menu. I am using ...
1
vote
0answers
20 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 ...
2
votes
1answer
16 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
207 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 ...
1
vote
0answers
16 views

How do I change the pixel values of raster data from QGIS python plugin

I have been trying my hand at a QGIS plugin. The plug in reads raster layer data into an array, pipes the data to a C++ program, does processing over there, and pipes my results back. After a couple ...
2
votes
0answers
22 views

Match polygons of two independently created shapefiles to create dataframe

I have two independently created shapefiles A) shapefile 1 lists the german postal codes and can be downloaded from ...
2
votes
1answer
42 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 ...
1
vote
0answers
19 views

How to incorporate QgsCollapsibleGroupBox widget into plugin?

Developing a plugin with Qt Designer for QGIS 2.14.1-Essen and having trouble inserting the QgsCollapsibleGroupBox widget. I receive the following error: ImportError: No module named ...
-3
votes
0answers
20 views

GIS selection of dummy variable [on hold]

I'm trying to select values from different Columns - but I'm trying to do it in a aggregated way , meaning if these 4 variables are = 1 , then select if not don't - I did it by hand in excel by hand I ...
2
votes
1answer
26 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 ...
14
votes
1answer
722 views

ArcGIS Cost Path Analysis - How Is Arcpy Cost Path Analysis Tool So Much Faster Than ArcObjects

Although I love slinging some python to create geoprocessing scripts/services, I was under the impression that using ArcObjects to do the equivalent operation(s) will have better performance. I've ...
1
vote
3answers
87 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
6 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
20 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 ...
0
votes
0answers
26 views

How to add dynamic text in standalone PyQGIS to reflect iteration of layer names

I am working with a standalone PyQGIS script below (that was given as an answer to How to iterate over layers and export them as PNG images with PyQGIS in a standalone script). The script exports the ...
4
votes
1answer
462 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 ...
3
votes
1answer
50 views

Bold and Italic layer labels with Python in Qgis

I'm trying to apply some labeling properties to a layer using Python. Everything went fine, except the way I tried to apply the Bold and Italic settings. Here is a part of the code: ...
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
38 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
18 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
41 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
50 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
197 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
15 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
49 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
197 views

Error Opening OpenLayers plugin in QGIS [on hold]

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
13 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
194 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
25 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
46 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 ...
1
vote
2answers
102 views

Scripting (Python) Feature Class content into Shapefiles following an UTM data structure

Consider a Feature Class and two of its fields are "UTM_grid" and the "OID". Scripting with python 2.7 for ArcGIS 10.3. "UTM_grid" field contains the geographic info (e.g. B1SD40B) and was broken ...
3
votes
1answer
62 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
52 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
15 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
245 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
45 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
476 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
424 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
47 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
71 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 ...