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

learn more… | top users | synonyms

1
vote
0answers
35 views

point in polygon starting with csv and shp in python

I have a csv file with two sets of lat/lon points - the first set of points is represented by columns V1(lon) and V2(lat), and the second set of points by V3(lon) and V4(lat) (the csv does not have ...
2
votes
0answers
35 views

Non-zero error with ImportFromEPSG() in GDAL/OSR/Python

I'm currently getting an error when testing ImportFromEPSG() on my GDAL. import osr testSR = osr.SpatialReference() testSR.ImportFromEPSG(4326) #this returns value of 6 print testSR.ExportToPrettyWkt(...
3
votes
1answer
45 views

How to get connection info from an .ags connection file?

I am working on a Python script to manage ArcGIS Server services (publish new services, update existing services, delete old services, etc.) in batch across multiple environments (e.g. dev, test and ...
0
votes
1answer
37 views

Fiona does not specify CRS

I try to write a geoJSON from a shp with the fiona package. Works, but fiona does not include the CRS information. with fiona.open(path) as shp: takeCRS = shp.crs takeSCHEMA = shp.schema ...
1
vote
2answers
54 views

Latitude/Longitude to city and zip, batch convertion

I have ~10 mln lat/lon points, and I need to extract city and zip code from them. I can do this with OpenStreetMap using the Nominatim API (using something like http://nominatim.openstreetmap.org/...
3
votes
0answers
62 views

Render Vector & Save as Raster

I am working with ENC files from noaa, specifically S57 format or ".000" to be as specific as possible. I am trying to render a layer or even the entire thing in a window but have had no luck. ...
2
votes
1answer
50 views

How do I use geometry object in processing.runalg()

I am trying to clip a polygon (large road network) with every row in another polygon (district polygon) using PYQGIS. layer_adm_level = QgsVectorLayer(base_path + adm_level + ".shp",'adm_level','ogr'...
2
votes
1answer
274 views

Generalization algorithms [closed]

Does anyone have the proper codes for line simplification and smoothing algorithms which is good to implement instead of ArcGIS algorithms? For example any of these: Visvalingam–Whyatt Reumann–...
0
votes
0answers
43 views

PyQGIS + Django Web Server — Not Working the Second Time Code Is Run

We are trying to create a standalone application on our local Django web server that uses PyQGIS to generate a series of maps based on a user's input. The user enters parameters on a web form and and ...
2
votes
1answer
51 views

Python module pyGTiff aligning data

I have been working with pyGTiff for a while and it works great. However my gis data does not have the same projection and extent. I saw that in the repository a a jupyter notebook with a test ...
1
vote
0answers
54 views

Using Python-Flask-MongoDB with Geolocation field running on App Engine?

I'm trying to write an app which would act as a address caching API, so basically it needs to store addresses (geolocations) and later on I could query on a random address and radius and get all the ...
3
votes
0answers
64 views

How to generate static heat maps server side?

I've been searching a way to generate server side static maps using Python (or any other languages, doesn't matter) I can create the maps I want with Qgis (And they look really great) but I don't ...
0
votes
1answer
88 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 ...
5
votes
0answers
98 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: https://www.dropbox.com/s/fmomfpro3j6dmz8/...
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
29 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
57 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 ...
3
votes
1answer
53 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
0answers
38 views

How to incorporate QGIS custom widgets into plugin? [duplicate]

Developing a plugin with Qt Designer for QGIS 2.14.1-Essen on Windows 7 and having trouble inserting the QgsCollapsibleGroupBox widget. I receive the following error: ImportError: No module named ...
2
votes
1answer
42 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 [(lat1,lon1),(...
2
votes
1answer
75 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 g=geocoder.google('...
1
vote
1answer
12 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 ...
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
72 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 ...
3
votes
2answers
91 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 ...
3
votes
0answers
29 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 ...
0
votes
0answers
42 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 "...
1
vote
3answers
58 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
1answer
62 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
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 ...
0
votes
1answer
111 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 = 'http://geonetwork-...
4
votes
1answer
121 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: layer....
0
votes
1answer
47 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 = 'http://geonetwork-mshe.univ-fcomte.fr:8080/geonetwork/srv/fre/...
3
votes
0answers
59 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 ...
3
votes
1answer
80 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 ...
1
vote
2answers
59 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 ...
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 ...
2
votes
1answer
54 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 ...
3
votes
2answers
111 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
0answers
25 views

QGIS cannot load macro function?

This has me stumped. For some reason, I can no longer run a function from a project macro even though macros are enabled (from Settings > Options > General > Enable macros > Always). Just ...
0
votes
0answers
39 views

How to georeference *.tiff to a given feature geometry automatically?

I´ve got the task to georeference an tiff image to the referencing polygon footprint (Polygon). I have found a lot of ways to do get the footprint from a raster but I could not find a way to use ...
0
votes
0answers
24 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 = driver.Open("...
8
votes
3answers
201 views

Increase Tiles Caching Speed (TileStache)

I am serving vector tiles using TileStache, I have everything set up like I want. My data is stored in Postgres and I am using the VecTiles provider to serve GeoJSON tiles. I want to cache all my ...
2
votes
0answers
32 views

Reading raster attribute table using gdal in python

Is there a GDAL function that can read in a raster attribute table? Something functionally similar to this function in pygeoprocessing: pygeoprocessing.geoprocessing.get_rat_as_dictionary_uri(...
1
vote
3answers
100 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 ...
0
votes
1answer
101 views

How do I convert a DEM GeoTIFF to Contour Shapefile

I have a digital elevation model as a GeoTIFF and I'm looking to generate a Shapefile of contours with 5m bands on the command line. Is this possible? Ideally using GDAL and Python.
3
votes
1answer
94 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 &...
4
votes
1answer
82 views

Can't delete features from layer using QGIS' Python API

I've only recently started using QGIS and it's Python API. Currently I've loaded two OpenStreetMap datasets. I would like to remove lines with from the second set where the name is already present in ...
0
votes
1answer
72 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 inputRaster:...
1
vote
0answers
60 views

QGIS 2.14.1 Processing Plug-In does not work anymore (Python error)

I did not change anything and started QGIS 2.14.1 today and was greeted with the following error message. So the Processing tab is missing and I cannot activate it. The error: 2016-04-26T17:58:43 1 ...