Re: [gdal-dev] VRT derived band pixel functions written in Python

2016-09-12 Thread James Ramm
Incredible Really cool initiative. I had a play around and wanted a way to be able to write the pixel function in a 'stand alone' python module and generate the VRT from it. This would allow independent testing and easier maintenance of the python code. It is fairly easy using lxml to build up

Re: [gdal-dev] VRT derived band pixel functions written in Python

2016-09-12 Thread Even Rouault
> I found http://nedbatchelder.com/blog/201206/eval_really_is_dangerous.html > to be a good intro to the risks of eval'ing untrusted Python code. > Mentioned in there is a notable attempt to make a secure subset of Python > called "pysandbox", but its developer has since declared it "broken by > de

Re: [gdal-dev] VRT derived band pixel functions written in Python

2016-09-12 Thread Even Rouault
Le lundi 12 septembre 2016 16:59:34, Poughon Victor a écrit : > Hi Even, > > This is a really cool and really impressive feature! > Calling Python code from C++ without development packages as a dependency > sounds like black magic to me. No black magic. Just setting function pointers using dlope

Re: [gdal-dev] VRT derived band pixel functions written in Python

2016-09-12 Thread Poughon Victor
Hi Even, This is a really cool and really impressive feature! Calling Python code from C++ without development packages as a dependency sounds like black magic to me. Obviously Python symbols have to be there at some point to execute Python code, so this is only usable from a binary that happen

Re: [gdal-dev] VRT derived band pixel functions written in Python

2016-09-12 Thread Sean Gillies
Hi Even, On Mon, Sep 12, 2016 at 2:31 PM, Even Rouault wrote: > Hi, > > I wanted to mention a new (and I think pretty cool ) feature I've added in > trunk: the possibility to define pixel functions in Python in a VRT derived > band. > > ... > > There are obvious security concerns in allowing Pyt

Re: [gdal-dev] Request for comments on Rasterio documentation

2016-09-12 Thread Even Rouault
Sean, > Yes, I suppose it could be okay to call gdal functions within a > rasterio.Env() block as long as you didn't change the error handler or > config options. I can't help thinking that "you can use a subset of gdal > with Rasterio" advice sets users up for trouble and I'd like to avoid that.

Re: [gdal-dev] Request for comments on Rasterio documentation

2016-09-12 Thread Sean Gillies
Hi Even, Thanks for the comments! More from me below... On Fri, Sep 9, 2016 at 11:40 AM, Even Rouault wrote: > Sean, > > I've actually a question along Howard's yesterday tweet regarding mutual > incompatiblity between osgeo.gdal and rasterio. From my understanding of > the > doc and look at ra

[gdal-dev] VRT derived band pixel functions written in Python

2016-09-12 Thread Even Rouault
Hi, I wanted to mention a new (and I think pretty cool ) feature I've added in trunk: the possibility to define pixel functions in Python in a VRT derived band. Let's start with a simple example to multiply a raster by 1.5 : EPSG:26711 440720,60,0,3751320,0,-60 multiply Python