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

learn more… | top users | synonyms

3
votes
1answer
56 views

Error when using arcpy.ArcSDESQLExecute() to connect to SQL Server - ArcGIS 10.4

I am able to connect to a MS SQL Server 2012 geodatabase with the arcpy.ArcSDESQLExecute() when using the .sde connection file pre-created in ArcGIS. I am not able to connect to a MS SQL Server 2012 ...
1
vote
1answer
41 views

tiff to shapefile using GDAL - slow speed

I am converting a 500MB .tif file to .shp file using GDAL. I am using the following: gdal_polygonize.py .tiff file -f “ESRI Shapefile” out.shp However, I abandoned the first attempt as in 12hrs it ...
3
votes
0answers
24 views

GDAL gdal_polygonize.py TypeError

I am using GDAL to convert a .tif to .shp file. gdal_polygonize.py input.tif -f “ESRI Shapefile” out.shp However this does not work and results in: Traceback (most recent call last): File ...
1
vote
0answers
34 views

Is there any way to connect features (entities) of dxf to database in python?

I'm using gdal, ezdxf, sqlite python packages and sqlite ODBC driver. They work fine, and in AutoCAD I can easily manually connect to my dbase.sqlite (read only) using _DBCONFIGURE and _DBCONNECT ...
3
votes
2answers
76 views

How to add support for FileGDB (Esri file gdb API) driver in fiona?

There has been a tons of questions on that but none of them solved my problem. I have a machine with: Windows 7 x64 Python 3.4.3 x64 gdal installed: gdalinfo --version --> GDAL 1.11.4, released ...
3
votes
0answers
47 views

GDAL RasterIO performance in C++ vs ReadAsArray in python/numpy

I'm currently writing optimisations for a raster viewer program which uses gdal as it's base. It's currently written purely in python, and has some major speed issues which cause problems when we are ...
1
vote
0answers
20 views

Nominatim address locator does't give longitude

I'm trying to geocode my addresses based on this tutorial: http://www.digital-geography.com/geocoding-addresses-in-arcgis-the-other-approach/#.VzMq_IR97Rb But Whenever I use Nominatim geocoder it ...
0
votes
0answers
38 views

Drawing contour with python QGIS?

I have one point layer and one contour layer and I was trying to draw a line around one contour, making a circle but not a uniform one, it has to have an irregular shape. I cannot find a tool that ...
0
votes
0answers
28 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
28 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 ...
3
votes
1answer
32 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
26 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
42 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 ...
3
votes
0answers
53 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
49 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 + ...
2
votes
1answer
258 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 ...
0
votes
0answers
30 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 ...
1
vote
1answer
34 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
34 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
53 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
49 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
86 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
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 ...
2
votes
0answers
31 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
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
0answers
36 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
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 ...
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 ...
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 ...
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
58 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
1answer
57 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
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 ...
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
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 ...
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
50 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 = ...
4
votes
1answer
88 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
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 = ...
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 ...
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 ...
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 ...
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
44 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
87 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
22 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
35 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
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 = ...
8
votes
3answers
181 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 ...