Re: [gdal-dev] gdalwarp resampling_method option

2017-10-05 Thread Mike Toews
Hi, I requested this feature 2 years ago: https://trac.osgeo.org/gdal/ticket/6015 I probably had some workaround in Python, but I can't recall any details. Cheers, Mike On 6 October 2017 at 00:59, sujankoirala2 wrote: > Hi there, > I was wondering if it would be

Re: [gdal-dev] Improve clipping of shapefiles

2017-09-11 Thread Mike Toews
On 11 September 2017 at 21:09, Paul Meems wrote: > I have a large shapefile with over 2.8 million shapes (fishnet) and I have a > border file with only 1 multipolygon. > > I'm trying to clip the fishnet with the border. > Using code is takes about 5 min. using command line

Re: [gdal-dev] gdal on freebsd

2016-11-07 Thread Mike Toews
On 7 November 2016 at 21:33, Jyrki Von Karkki wrote: > Hi all > > I'm having a bit of an issue with the postgresql/postgis driver on freebsd. > It simply does not appear installed. How did you install GDAL? The PostgreSQL driver is not always available since it not

Re: [gdal-dev] Simple circle in OGR

2016-11-02 Thread Mike Toews
On 3 November 2016 at 09:46, Renison wrote: > Hello all, I am trying to create a simple circle geometry in OGR. My approach > so far has been something like this: > > SpatialReference defaultGeoSys = new SpatialReference(""); >

[gdal-dev] VRT raster for reading formatted files?

2016-06-25 Thread Mike Toews
Hi all, I've been using the VRTRawRasterBand feature of the VRT format to read unformatted (so-called "BINARY") 2D grid data, which has been very successful to adapt to obscure formats. However, I would like to know if there is a similar feature of the VRT format to read formatted values

Re: [gdal-dev] Hard coded Pi constants

2016-03-03 Thread Mike Toews
This is not just a MSVC issue. M_PI and other constants are not part of the ISO standard, so if you try: $ gcc --std=c99 small_program_with_M_PI.c you will get "error: ‘M_PI’ undeclared" I'm not sure if you can compile GDAL with `--std=c99`, but I don't see any compelling reason to remove #ifndef

Re: [gdal-dev] RFC 61: Call for vote on adoption

2016-02-10 Thread Mike Toews
On 11 February 2016 at 01:31, Even Rouault wrote: > Le mercredi 10 février 2016 13:05:20, Peter Halls a écrit : >> ESRI handle this in a non-intuitive way: XYM is supported, but Z >> always has a Measure, so is XYZM! The formal definition is here: >>

Re: [gdal-dev] RFC 61: Call for vote on adoption

2016-02-10 Thread Mike Toews
On 11 February 2016 at 02:05, Even Rouault wrote: > Would someone looking at this discussion and having access to ESRI software be > willing to generate tiny (meaning just one single shape, with the smallest > number of vertices) shapefiles of type PointZ, ArcZ,

Re: [gdal-dev] EPSG:6933

2015-11-10 Thread Mike Toews
On 11 November 2015 at 02:33, Even Rouault wrote: > Long answer: > This CRS probably didn't exist in the EPSG database v8.5 that was used the > last time the proj/GDAL derived EPSG database was generated. And I see that > the ellipsoidal Lamber Cylindrical Equal Area

Re: [gdal-dev] Gdal_calc.py with more than 26 input files

2015-07-16 Thread Mike Toews
On 17 July 2015 at 11:13, Even Rouault even.roua...@spatialys.com wrote: But when you have more than 26 input files, it is dubious that you really want to individually identify them with a particular letter/name. As in one of the examples, you likely just want to apply a global operation on

Re: [gdal-dev] gdal_rasterize with text attributes.

2015-06-27 Thread Mike Toews
Rasters can only store numeric types, not strings. But you could either rasterize the primary key, or reclassify the strings into a so-called lookup table of ID and string (e.g. 1=green, 2=blue, etc.). And then you could look-up the text from a raster using the common integer ID. -Mike On 27

Re: [gdal-dev] Design for sub-second accuracy in OGR ?

2015-04-06 Thread Mike Toews
On 6 April 2015 at 09:39, Even Rouault even.roua...@spatialys.com wrote: I should have mentionned what currently exists indeed : struct { GInt16 Year; GByte Month; GByte Day; GByte Hour; GByte Minute; GByte Second;

Re: [gdal-dev] OGR: How to access Coded Value Domains in File Geodatabases?

2015-01-06 Thread Mike Toews
Hi Stefan, I found this issue too and wrote an enhancement ticket: http://trac.osgeo.org/gdal/ticket/5741 The only workaround appears to be lots of work. The GDB_Items table (a0004.gdbtable) can be read with OGR, where the code/value pairs are in attributes of XML code, which can be used to

Re: [gdal-dev] gdal_calc.py: produce median raster

2014-11-26 Thread Mike Toews
Hi Simen, Try this: gdal_calc.py -A rgb.tif --outfile ouput.tif --calc median(A, axis=0) The axis=0 parameter is to perform a median calculation along the first dimension, which is the band dimension. Lean more here: http://docs.scipy.org/doc/numpy/reference/generated/numpy.median.html -Mike

Re: [gdal-dev] Call for discussion on RFC 51: RasterIO() improvements : resampling and progress callback

2014-11-25 Thread Mike Toews
On 25 November 2014 at 05:34, Even Rouault even.roua...@spatialys.com wrote: Otherwise I have not much to say about this RFC. Blurring has two r's, Fixed Gaussian blur also has another complexity, since it's output dimensions depend on the fftconvolve mode (using scipy.signal docs

Re: [gdal-dev] Questions about polygonization

2014-08-19 Thread Mike Toews
Hi Jack, I'm not sure if I understand the description of the shapes you see. Can you provide the WKT for them? I seem to get two polygons that look like they should: import numpy as np import rasterio.features from shapely.geometry import shape ar = np.ones((6, 5), 'B') * 11 ar[2, 2] = 12 gt =

Re: [gdal-dev] [BULK] Re: Dissolve shapefile using GDAL/OGR

2014-07-14 Thread Mike Toews
The path strings are not escaped, so dissolve[13] is '\a' or '\x07' and not 'a', which makes the path invalid. For Windows paths, the best practice is to either use forward slashes (like unix), or use raw escape with r as a string prefix, e.g. dissolve = r'C:\OSGeo4W64\apps...' On 12 July 2014

Re: [gdal-dev] Add to PythonGotchas: saving and closing raster datasets

2014-05-27 Thread Mike Toews
Thanks Even and Sean for the input. I'll proceed to add this to the wiki when I have an extended moment. I think I'll rephrase this gotcha to also apply to OGR datasources, where the API reads you should always close any opened datasource with OGR_DS_Destroy() that will ensure all data is

Re: [gdal-dev] compiling without writing permission - problem gdal-1.10.1

2014-05-06 Thread Mike Toews
On 6 May 2014 21:01, Margherita Di Leo direg...@gmail.com wrote: I have a problem compiling gdal-1.10.1 on a Linux system for which I'm not administrator. In the configure I use the --prefix and --bindir options. Everything goes smoothly and it confirms that Libraries have been installed in:

[gdal-dev] Add to PythonGotchas: saving and closing raster datasets

2014-05-03 Thread Mike Toews
Hi, This seems to be a common gotcha: http://gis.stackexchange.com/q/93212/1872 I've been caught by it before, and I'm certain many others have too. This is a gotcha since WriteArray doesn't write the array to disk, but rather it is written when the dataset object is dereferenced. I've drafted

[gdal-dev] ogr.GeometryTypeToName oddness

2013-04-16 Thread Mike Toews
With the Python module for GDAL 1.9.2 for Python 2.7, Windows 64-bit, downloaded from http://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal I see this oddness: from osgeo import ogr for name in dir(ogr): if name.startswith('wkb'): i = getattr(ogr, name) print('%s : %d : %r' % (name,

[gdal-dev] Capture stderr in interactive Python shell

2012-08-05 Thread Mike Toews
I would like to capture or show GDAL error messages in an interactive Python shell. For instance, if trying to open an non-existing raster: from osgeo import gdal ds = gdal.Open('noexist.tif') shows nothing in an interactive shell (PythonWin, IDLE), but shows messages when used in a shell

[gdal-dev] Lengthy GDALRasterAttributeTable output

2011-06-01 Thread Mike Toews
I'm struggling to understand why both the aux.xml file and output from gdalinfo are really bulky in file size for my GeoTIFFs. First, output from gdalinfo on a 375 KB GeoTIFF file has 196664 lines: Driver: GTiff/GeoTIFF Files: HorizB.tif HorizB.aux Size is 317, 301 Coordinate System is:

Re: [gdal-dev] Adding field to Shapefile via Python

2011-03-20 Thread Mike Toews
features based on that feature definition. See the docs for OGRFeatureDefn::AddFieldDefn() http://www.gdal.org/ogr/classOGRFeatureDefn.html#40e681d8464b42f1a1fac655f16ac3dd On Fri, Mar 18, 2011 at 11:01 AM, Mike Toews mwto...@gmail.com wrote: In a Python script, I am updating an exiting

[gdal-dev] Adding field to Shapefile via Python

2011-03-17 Thread Mike Toews
In a Python script, I am updating an exiting shapefile with data by adding a column. However, my changes don't seem to be saved. Here is what I have: from osgeo import ogr obs_file = 'myfile.shp' source = ogr.Open(obs_file, 1) layer = source.GetLayer() layer_defn = layer.GetLayerDefn()

Re: [gdal-dev] Polygon topology

2011-03-08 Thread Mike Toews
You could use the `interiors` length in Shapely: from osgeo import ogr from shapely.wkb import loads source = ogr.Open('my_polygons.shp') layer = source.GetLayer() feature = layer.GetNextFeature() num = 0 while feature: g = loads(feature.GetGeometryRef().ExportToWkb()) if g.geom_type ==

Re: [gdal-dev] Polygon topology

2011-03-08 Thread Mike Toews
On 8 March 2011 23:22, Even Rouault even.roua...@mines-paris.org wrote: Not exactly. In fact you have to use the Geometry.GetGeometryCount() that returns 1 (the exterior ring) + the number of interior rings. So polygon.GetGeometryCount() - 1 should return the number of interior rings I

[gdal-dev] Cannot configure SpatiaLite

2010-07-24 Thread Mike Toews
Hi all, I cannot seem to configure GDAL 1.7.2 with SpatiaLite support. My system is Ubuntu 8.04 Hardy server LTS. I've installed SpatiaLite version 2.3.1 from source (both lib and tools), and it appears to work normally. I'm not sure if it matters, but I installed both sqlite3 and the development

[gdal-dev] Re: Cannot configure SpatiaLite

2010-07-24 Thread Mike Toews
? -Mike [1] http://trac.osgeo.org/gdal/browser/trunk/gdal/configure.in#L2088 On 24 July 2010 09:26, Mike Toews mwto...@gmail.com wrote: Hi all, I cannot seem to configure GDAL 1.7.2 with SpatiaLite support. My system is Ubuntu 8.04 Hardy server LTS. I've installed SpatiaLite version 2.3.1 from