Re: [mapserver-users] Add a validation block using python mapscript

2016-01-14 Thread thomas bonfort
I'm not a mapscript expert, others may be able to help out better than me.
try "LAYER VALIDATION .. .. .. END END"

--
thomas

On 14 January 2016 at 11:26, Andrea Peri  wrote:

> Thx Thomas ,
> I find the right function name.
> It is
> updateFromString()
> now the function is callable, but have another kind of error:
>
> Traceback (most recent call last):
>   File "generatore_mapfile_istat.py", line 192, in 
> theLayer.updateFromString(tempValidation)
>   File
> "C:\my-programs\osgeo4w\apps\Python27\lib\site-packages\mapscript.py", li
> ne 1568, in updateFromString
> def updateFromString(self, *args): return
> _mapscript.layerObj_updateFromStri
> ng(self, *args)
> EOFError: loadLayer(): Premature End-of-File.
>
> A.
>
>
> 2016-01-14 11:18 GMT+01:00 thomas bonfort :
> > mapscript is camelcase
> >
> > On 14 January 2016 at 10:51, Andrea Peri  wrote:
> >>
> >> Hi Thomas,
> >> Thx for reply, I don't know this sintax.
> >>
> >> I try this:
> >>
> >> theLayer = clone_map.getLayer(li)
> >> tempValidation = "VALIDATION 'idtpn' '^[a-zA-Z0-9\-_#]+$'
> >> 'default_idtpn' '%' END"
> >> theLayer.updatefromstring(tempValidation)
> >>
> >> But it return an error:
> >>
> >> Traceback (most recent call last):
> >>   File "generatore_mapfile_istat.py", line 192, in 
> >> theLayer.updatefromstring(tempValidation)
> >>   File
> >> "C:\my-programs\osgeo4w\apps\Python27\lib\site-packages\mapscript.py",
> li
> >> ne 1385, in 
> >> __getattr__ = lambda self, name: _swig_getattr(self, layerObj, name)
> >>   File
> >> "C:\my-programs\osgeo4w\apps\Python27\lib\site-packages\mapscript.py",
> li
> >> ne 54, in _swig_getattr
> >> raise AttributeError(name)
> >> AttributeError: updatefromstring
> >>
> >> A.
> >>
> >>
> >> 2016-01-14 10:38 GMT+01:00 thomas bonfort :
> >> > if there is no mapscript interface for VALIDATION you can always use
> >> >
> >> > layer->updatefromstring("VALIDATION etc END")
> >> >
> >> > --
> >> > thomas
> >> >
> >> > On 14 January 2016 at 10:33, Andrea Peri  wrote:
> >> >>
> >> >> Hi,
> >> >>
> >> >> Is possible , using the python mapscript add a block for validation
> >> >> like
> >> >> this ?
> >> >>
> >> >> VALIDATION
> >> >>   'idtpn' '^[a-zA-Z0-9\-_#]+$'
> >> >>   'default_idtpn' '%'
> >> >> END
> >> >>
> >> >>
> >> >> --
> >> >> -
> >> >> Andrea Peri
> >> >> . . . . . . . . .
> >> >> qwerty àèìòù
> >> >> -
> >> >> ___
> >> >> mapserver-users mailing list
> >> >> mapserver-users@lists.osgeo.org
> >> >> http://lists.osgeo.org/mailman/listinfo/mapserver-users
> >> >
> >> >
> >>
> >>
> >>
> >> --
> >> -
> >> Andrea Peri
> >> . . . . . . . . .
> >> qwerty àèìòù
> >> -
> >
> >
>
>
>
> --
> -
> Andrea Peri
> . . . . . . . . .
> qwerty àèìòù
> -
>
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users

Re: [mapserver-users] Add a validation block using python mapscript

2016-01-14 Thread Andrea Peri
Hi Thomas,
Thx for reply, I don't know this sintax.

I try this:

theLayer = clone_map.getLayer(li)
tempValidation = "VALIDATION 'idtpn' '^[a-zA-Z0-9\-_#]+$'
'default_idtpn' '%' END"
theLayer.updatefromstring(tempValidation)

But it return an error:

Traceback (most recent call last):
  File "generatore_mapfile_istat.py", line 192, in 
theLayer.updatefromstring(tempValidation)
  File "C:\my-programs\osgeo4w\apps\Python27\lib\site-packages\mapscript.py", li
ne 1385, in 
__getattr__ = lambda self, name: _swig_getattr(self, layerObj, name)
  File "C:\my-programs\osgeo4w\apps\Python27\lib\site-packages\mapscript.py", li
ne 54, in _swig_getattr
raise AttributeError(name)
AttributeError: updatefromstring

A.


2016-01-14 10:38 GMT+01:00 thomas bonfort :
> if there is no mapscript interface for VALIDATION you can always use
>
> layer->updatefromstring("VALIDATION etc END")
>
> --
> thomas
>
> On 14 January 2016 at 10:33, Andrea Peri  wrote:
>>
>> Hi,
>>
>> Is possible , using the python mapscript add a block for validation like
>> this ?
>>
>> VALIDATION
>>   'idtpn' '^[a-zA-Z0-9\-_#]+$'
>>   'default_idtpn' '%'
>> END
>>
>>
>> --
>> -
>> Andrea Peri
>> . . . . . . . . .
>> qwerty àèìòù
>> -
>> ___
>> mapserver-users mailing list
>> mapserver-users@lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>
>



-- 
-
Andrea Peri
. . . . . . . . .
qwerty àèìòù
-
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users

Re: [mapserver-users] Add a validation block using python mapscript

2016-01-14 Thread thomas bonfort
mapscript is camelcase

On 14 January 2016 at 10:51, Andrea Peri  wrote:

> Hi Thomas,
> Thx for reply, I don't know this sintax.
>
> I try this:
>
> theLayer = clone_map.getLayer(li)
> tempValidation = "VALIDATION 'idtpn' '^[a-zA-Z0-9\-_#]+$'
> 'default_idtpn' '%' END"
> theLayer.updatefromstring(tempValidation)
>
> But it return an error:
>
> Traceback (most recent call last):
>   File "generatore_mapfile_istat.py", line 192, in 
> theLayer.updatefromstring(tempValidation)
>   File
> "C:\my-programs\osgeo4w\apps\Python27\lib\site-packages\mapscript.py", li
> ne 1385, in 
> __getattr__ = lambda self, name: _swig_getattr(self, layerObj, name)
>   File
> "C:\my-programs\osgeo4w\apps\Python27\lib\site-packages\mapscript.py", li
> ne 54, in _swig_getattr
> raise AttributeError(name)
> AttributeError: updatefromstring
>
> A.
>
>
> 2016-01-14 10:38 GMT+01:00 thomas bonfort :
> > if there is no mapscript interface for VALIDATION you can always use
> >
> > layer->updatefromstring("VALIDATION etc END")
> >
> > --
> > thomas
> >
> > On 14 January 2016 at 10:33, Andrea Peri  wrote:
> >>
> >> Hi,
> >>
> >> Is possible , using the python mapscript add a block for validation like
> >> this ?
> >>
> >> VALIDATION
> >>   'idtpn' '^[a-zA-Z0-9\-_#]+$'
> >>   'default_idtpn' '%'
> >> END
> >>
> >>
> >> --
> >> -
> >> Andrea Peri
> >> . . . . . . . . .
> >> qwerty àèìòù
> >> -
> >> ___
> >> mapserver-users mailing list
> >> mapserver-users@lists.osgeo.org
> >> http://lists.osgeo.org/mailman/listinfo/mapserver-users
> >
> >
>
>
>
> --
> -
> Andrea Peri
> . . . . . . . . .
> qwerty àèìòù
> -
>
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users

[mapserver-users] Add a validation block using python mapscript

2016-01-14 Thread Andrea Peri
Hi,

Is possible , using the python mapscript add a block for validation like this ?

VALIDATION
  'idtpn' '^[a-zA-Z0-9\-_#]+$'
  'default_idtpn' '%'
END


-- 
-
Andrea Peri
. . . . . . . . .
qwerty àèìòù
-
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users

Re: [mapserver-users] Add a validation block using python mapscript

2016-01-14 Thread Andrea Peri
Thx Thomas ,
I find the right function name.
It is
updateFromString()
now the function is callable, but have another kind of error:

Traceback (most recent call last):
  File "generatore_mapfile_istat.py", line 192, in 
theLayer.updateFromString(tempValidation)
  File "C:\my-programs\osgeo4w\apps\Python27\lib\site-packages\mapscript.py", li
ne 1568, in updateFromString
def updateFromString(self, *args): return _mapscript.layerObj_updateFromStri
ng(self, *args)
EOFError: loadLayer(): Premature End-of-File.

A.


2016-01-14 11:18 GMT+01:00 thomas bonfort :
> mapscript is camelcase
>
> On 14 January 2016 at 10:51, Andrea Peri  wrote:
>>
>> Hi Thomas,
>> Thx for reply, I don't know this sintax.
>>
>> I try this:
>>
>> theLayer = clone_map.getLayer(li)
>> tempValidation = "VALIDATION 'idtpn' '^[a-zA-Z0-9\-_#]+$'
>> 'default_idtpn' '%' END"
>> theLayer.updatefromstring(tempValidation)
>>
>> But it return an error:
>>
>> Traceback (most recent call last):
>>   File "generatore_mapfile_istat.py", line 192, in 
>> theLayer.updatefromstring(tempValidation)
>>   File
>> "C:\my-programs\osgeo4w\apps\Python27\lib\site-packages\mapscript.py", li
>> ne 1385, in 
>> __getattr__ = lambda self, name: _swig_getattr(self, layerObj, name)
>>   File
>> "C:\my-programs\osgeo4w\apps\Python27\lib\site-packages\mapscript.py", li
>> ne 54, in _swig_getattr
>> raise AttributeError(name)
>> AttributeError: updatefromstring
>>
>> A.
>>
>>
>> 2016-01-14 10:38 GMT+01:00 thomas bonfort :
>> > if there is no mapscript interface for VALIDATION you can always use
>> >
>> > layer->updatefromstring("VALIDATION etc END")
>> >
>> > --
>> > thomas
>> >
>> > On 14 January 2016 at 10:33, Andrea Peri  wrote:
>> >>
>> >> Hi,
>> >>
>> >> Is possible , using the python mapscript add a block for validation
>> >> like
>> >> this ?
>> >>
>> >> VALIDATION
>> >>   'idtpn' '^[a-zA-Z0-9\-_#]+$'
>> >>   'default_idtpn' '%'
>> >> END
>> >>
>> >>
>> >> --
>> >> -
>> >> Andrea Peri
>> >> . . . . . . . . .
>> >> qwerty àèìòù
>> >> -
>> >> ___
>> >> mapserver-users mailing list
>> >> mapserver-users@lists.osgeo.org
>> >> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>> >
>> >
>>
>>
>>
>> --
>> -
>> Andrea Peri
>> . . . . . . . . .
>> qwerty àèìòù
>> -
>
>



-- 
-
Andrea Peri
. . . . . . . . .
qwerty àèìòù
-
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users

Re: [mapserver-users] kml superoverlays

2016-01-14 Thread Jeff McKenna

On 2016-01-14 4:51 PM, Even Rouault wrote:



Could this 'OGRDB2DriverOpen' be the issue?


This is just a harmelss debug message (that shouldn't be printed IMHO in the
Open() method of the DB2 driver. cc'ing David)


Shouldn't GDAL use the
"KMLSUPEROVERLAY" driver here?  (for the record that driver is listed in
both my Windows and Ubuntu builds, through 'gdalinfo --formats').


No the issue is that the \ windows directory separator was used instead of /
for http ressources.
Just fixed with https://trac.osgeo.org/gdal/ticket/6310

You might get some extra open speedup by defining
GDAL_DISABLE_READDIR_ON_OPEN=EMPTY as env. var/config. option (this prevents
probing for (most) side-car files. This is not something to use in general
however.



Thanks Even, that worked!

Now onto MapServer :)  Unfortunately that same vsicurl superoverlay in 
MapServer-master works on Ubuntu, but now on Windows.  Here is more details:


Mapfile
===

MAP
NAME "superoverlay"
STATUS ON
SIZE 400 300
EXTENT -122.1293127 37.3727086 -122.0593424 37.4398034
UNITS DD
IMAGECOLOR 255 255 255

LAYER
  NAME "mountain-view-superoverlay"
  TYPE RASTER
  STATUS ON
  #DATA "mv-doqq.kml"
  DATA 
"/vsicurl/http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-doqq.kml;

  CLASS
NAME "Superoverlay"
STYLE
END
  END
END # layer

END # Map File

Test1: MapServer with superoverlay+VSICURL, on Windows
==

shp2img -m superoverlay-kml.map -o ttt.png -all_debug 5

result (fail)
-

msLoadMap(): 0.000s
msDrawMap(): rendering using outputformat named png (AGG/PNG).
msDrawMap(): WMS/WFS set-up and query, 0.000s
msDrawRasterLayerLow(mountain-view-superoverlay): entering.
msDrawRasterLayerGDAL(): Entering transform.
msDrawRasterLayerGDAL(): src=0,0,16384,16384, dst=44,0,312,300
msDrawRasterLayerGDAL(): source raster PL (-4.888,-27.409) for dst PL 
(44,0).

msDrawRasterLayerGDAL(): red,green,blue,alpha bands = 1,2,3,4
drawGDAL(): Unable to access file. GDALDatasetRasterIO() failed: 
/vsimem/kmlsuperoverlay/3
_085CA378, band 1: Illegal nBlockXOff value (2) in 
GDALRasterBand::GetLockedBlockRef()


msDrawMap(): Image handling error. Failed to draw layer named 
'mountain-view-superoverlay'

.
msDrawMap(): Image handling error. Failed to draw layer named 
'mountain-view-superoverlay'

. 
drawGDAL(): Unable to access file. GDALDatasetRasterIO() failed: 
/vsimem/kmlsuperoverlay/3
_085CA378, band 1: Illegal nBlockXOff value (2) in 
GDALRasterBand::GetLockedBlockRef()

 
msFreeMap(): freeing map at 061BA7F0.
freeLayer(): freeing layer at 07273208.

Test2: MapServer with superoverlay+VSICURL, on Ubuntu
==

$ shp2img -m superoverlay-kml.map -o ttt.png -all_debug 5

result (success)


[Thu Jan 14 18:20:02 2016].525687 msLoadMap(): 0.000s
[Thu Jan 14 18:20:02 2016].525906 msDrawMap(): rendering using 
outputformat named png (AGG/PNG).
[Thu Jan 14 18:20:02 2016].525919 msDrawMap(): WMS/WFS set-up and query, 
0.000s
[Thu Jan 14 18:20:02 2016].527354 
msDrawRasterLayerLow(mountain-view-superoverlay): entering.
[Thu Jan 14 18:20:11 2016].774926 msDrawRasterLayerGDAL(): Entering 
transform.
[Thu Jan 14 18:20:11 2016].774950 msDrawRasterLayerGDAL(): 
src=0,0,16384,16384, dst=44,0,312,300
[Thu Jan 14 18:20:11 2016].774955 msDrawRasterLayerGDAL(): source raster 
PL (-4.888,-27.409) for dst PL (44,0).
[Thu Jan 14 18:20:11 2016].774969 msDrawRasterLayerGDAL(): 
red,green,blue,alpha bands = 1,2,3,4
[Thu Jan 14 18:20:13 2016].225477 msDrawMap(): Layer 0 
(mountain-view-superoverlay), 10.700s

[Thu Jan 14 18:20:13 2016].225507 msDrawMap(): Drawing Label Cache, 0.000s
[Thu Jan 14 18:20:13 2016].225512 msDrawMap() total time: 10.700s
[Thu Jan 14 18:20:13 2016].244934 msSaveImage(ttt.png) total time: 0.019s
[Thu Jan 14 18:20:13 2016].244971 msFreeMap(): freeing map at 0x15256f0.
[Thu Jan 14 18:20:13 2016].244994 freeLayer(): freeing layer at 0x152d120.
[Thu Jan 14 18:20:13 2016].245030 shp2img total time: 10.720s



-jeff



--
Jeff McKenna
MapServer Consulting and Training Services
http://www.gatewaygeomatics.com/




___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users

Re: [mapserver-users] kml superoverlays

2016-01-14 Thread Jeff McKenna

On 2016-01-14 6:55 PM, Even Rouault wrote:

Le jeudi 14 janvier 2016 23:21:30, Jeff McKenna a écrit :

On 2016-01-14 4:51 PM, Even Rouault wrote:

Could this 'OGRDB2DriverOpen' be the issue?


This is just a harmelss debug message (that shouldn't be printed IMHO in
the Open() method of the DB2 driver. cc'ing David)


Shouldn't GDAL use the
"KMLSUPEROVERLAY" driver here?  (for the record that driver is listed in
both my Windows and Ubuntu builds, through 'gdalinfo --formats').


No the issue is that the \ windows directory separator was used instead
of / for http ressources.
Just fixed with https://trac.osgeo.org/gdal/ticket/6310

You might get some extra open speedup by defining
GDAL_DISABLE_READDIR_ON_OPEN=EMPTY as env. var/config. option (this
prevents probing for (most) side-car files. This is not something to use
in general however.


Thanks Even, that worked!

Now onto MapServer :)  Unfortunately that same vsicurl superoverlay in
MapServer-master works on Ubuntu, but now on Windows.  Here is more
details:


Hum I didn't try with MapServer, but looking at the GDAL request it does in the 
logs, I tried
something close with gdal_translate:

gdal_translate 
/vsicurl/http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-doqq.kml 
out2.tif -outsize 312 300

and the good or bad news is that fails on both Ubuntu and Windows (well at 
least on wine/Linux) with
a similar error to yours:

VSICURL: Start download for 
http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-070501/422.kml
VSICURL: Stop download for 
http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-070501/422.kml
VSICURL: Start download for 
http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-070501/422.JPEG
VSICURL: Stop download for 
http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-070501/422.JPEG
GDAL: GDALOpen(/vsimem/kmlsuperoverlay/6_0x1d0f878, this=0x1d12bd0) succeeds as 
JPEG.
GDAL: GDALDefaultOverviews::OverviewScan()
GDAL: GDALDefaultOverviews::OverviewScan()
ERROR 5: /vsimem/kmlsuperoverlay/3_0x1cf4ce8, band 1: Illegal nBlockXOff value 
(2) in GDALRasterBand::TryGetLockedBlockRef()

ERROR 5: /vsimem/kmlsuperoverlay/3_0x1cf4ce8, band 1: Illegal nBlockXOff value 
(2) in GDALRasterBand::GetLockedBlockRef()


Not sure why you get different results.

Mind opening a GDAL ticket about that ? I'm debugging something else tricky 
right now ;-)


no problem, willdo, I know the feeling :)

-jeff







Mapfile
===

MAP
NAME "superoverlay"
STATUS ON
SIZE 400 300
EXTENT -122.1293127 37.3727086 -122.0593424 37.4398034
UNITS DD
IMAGECOLOR 255 255 255

LAYER
NAME "mountain-view-superoverlay"
TYPE RASTER
STATUS ON
#DATA "mv-doqq.kml"
DATA
"/vsicurl/http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-doqq.kml;
CLASS
  NAME "Superoverlay"
  STYLE
  END
END
END # layer

END # Map File

Test1: MapServer with superoverlay+VSICURL, on Windows
==

shp2img -m superoverlay-kml.map -o ttt.png -all_debug 5

result (fail)
-

msLoadMap(): 0.000s
msDrawMap(): rendering using outputformat named png (AGG/PNG).
msDrawMap(): WMS/WFS set-up and query, 0.000s
msDrawRasterLayerLow(mountain-view-superoverlay): entering.
msDrawRasterLayerGDAL(): Entering transform.
msDrawRasterLayerGDAL(): src=0,0,16384,16384, dst=44,0,312,300
msDrawRasterLayerGDAL(): source raster PL (-4.888,-27.409) for dst PL
(44,0).
msDrawRasterLayerGDAL(): red,green,blue,alpha bands = 1,2,3,4
drawGDAL(): Unable to access file. GDALDatasetRasterIO() failed:
/vsimem/kmlsuperoverlay/3
_085CA378, band 1: Illegal nBlockXOff value (2) in
GDALRasterBand::GetLockedBlockRef()

msDrawMap(): Image handling error. Failed to draw layer named
'mountain-view-superoverlay'
.
msDrawMap(): Image handling error. Failed to draw layer named
'mountain-view-superoverlay'
. 
drawGDAL(): Unable to access file. GDALDatasetRasterIO() failed:
/vsimem/kmlsuperoverlay/3
_085CA378, band 1: Illegal nBlockXOff value (2) in
GDALRasterBand::GetLockedBlockRef()
   
msFreeMap(): freeing map at 061BA7F0.
freeLayer(): freeing layer at 07273208.

Test2: MapServer with superoverlay+VSICURL, on Ubuntu
==

$ shp2img -m superoverlay-kml.map -o ttt.png -all_debug 5

result (success)


[Thu Jan 14 18:20:02 2016].525687 msLoadMap(): 0.000s
[Thu Jan 14 18:20:02 2016].525906 msDrawMap(): rendering using
outputformat named png (AGG/PNG).
[Thu Jan 14 18:20:02 2016].525919 msDrawMap(): WMS/WFS set-up and query,
0.000s
[Thu Jan 14 18:20:02 2016].527354
msDrawRasterLayerLow(mountain-view-superoverlay): entering.
[Thu Jan 14 18:20:11 2016].774926 msDrawRasterLayerGDAL(): Entering
transform.
[Thu Jan 14 18:20:11 2016].774950 msDrawRasterLayerGDAL():
src=0,0,16384,16384, dst=44,0,312,300
[Thu Jan 14 18:20:11 2016].774955 msDrawRasterLayerGDAL(): source raster
PL (-4.888,-27.409) for dst PL (44,0).
[Thu Jan 14 18:20:11 2016].774969 msDrawRasterLayerGDAL():

Re: [mapserver-users] kml superoverlays

2016-01-14 Thread Even Rouault
Le jeudi 14 janvier 2016 23:21:30, Jeff McKenna a écrit :
> On 2016-01-14 4:51 PM, Even Rouault wrote:
> >> Could this 'OGRDB2DriverOpen' be the issue?
> > 
> > This is just a harmelss debug message (that shouldn't be printed IMHO in
> > the Open() method of the DB2 driver. cc'ing David)
> > 
> >> Shouldn't GDAL use the
> >> "KMLSUPEROVERLAY" driver here?  (for the record that driver is listed in
> >> both my Windows and Ubuntu builds, through 'gdalinfo --formats').
> > 
> > No the issue is that the \ windows directory separator was used instead
> > of / for http ressources.
> > Just fixed with https://trac.osgeo.org/gdal/ticket/6310
> > 
> > You might get some extra open speedup by defining
> > GDAL_DISABLE_READDIR_ON_OPEN=EMPTY as env. var/config. option (this
> > prevents probing for (most) side-car files. This is not something to use
> > in general however.
> 
> Thanks Even, that worked!
> 
> Now onto MapServer :)  Unfortunately that same vsicurl superoverlay in
> MapServer-master works on Ubuntu, but now on Windows.  Here is more
> details:

Hum I didn't try with MapServer, but looking at the GDAL request it does in the 
logs, I tried
something close with gdal_translate:

gdal_translate 
/vsicurl/http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-doqq.kml 
out2.tif -outsize 312 300

and the good or bad news is that fails on both Ubuntu and Windows (well at 
least on wine/Linux) with
a similar error to yours:

VSICURL: Start download for 
http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-070501/422.kml
VSICURL: Stop download for 
http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-070501/422.kml
VSICURL: Start download for 
http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-070501/422.JPEG
VSICURL: Stop download for 
http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-070501/422.JPEG
GDAL: GDALOpen(/vsimem/kmlsuperoverlay/6_0x1d0f878, this=0x1d12bd0) succeeds as 
JPEG.
GDAL: GDALDefaultOverviews::OverviewScan()
GDAL: GDALDefaultOverviews::OverviewScan()
ERROR 5: /vsimem/kmlsuperoverlay/3_0x1cf4ce8, band 1: Illegal nBlockXOff value 
(2) in GDALRasterBand::TryGetLockedBlockRef()

ERROR 5: /vsimem/kmlsuperoverlay/3_0x1cf4ce8, band 1: Illegal nBlockXOff value 
(2) in GDALRasterBand::GetLockedBlockRef()


Not sure why you get different results.

Mind opening a GDAL ticket about that ? I'm debugging something else tricky 
right now ;-)

> 
> Mapfile
> ===
> 
> MAP
> NAME "superoverlay"
> STATUS ON
> SIZE 400 300
> EXTENT -122.1293127 37.3727086 -122.0593424 37.4398034
> UNITS DD
> IMAGECOLOR 255 255 255
> 
> LAYER
>NAME "mountain-view-superoverlay"
>TYPE RASTER
>STATUS ON
>#DATA "mv-doqq.kml"
>DATA
> "/vsicurl/http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-doqq.kml;
>CLASS
>  NAME "Superoverlay"
>  STYLE
>  END
>END
> END # layer
> 
> END # Map File
> 
> Test1: MapServer with superoverlay+VSICURL, on Windows
> ==
> 
> shp2img -m superoverlay-kml.map -o ttt.png -all_debug 5
> 
> result (fail)
> -
> 
> msLoadMap(): 0.000s
> msDrawMap(): rendering using outputformat named png (AGG/PNG).
> msDrawMap(): WMS/WFS set-up and query, 0.000s
> msDrawRasterLayerLow(mountain-view-superoverlay): entering.
> msDrawRasterLayerGDAL(): Entering transform.
> msDrawRasterLayerGDAL(): src=0,0,16384,16384, dst=44,0,312,300
> msDrawRasterLayerGDAL(): source raster PL (-4.888,-27.409) for dst PL
> (44,0).
> msDrawRasterLayerGDAL(): red,green,blue,alpha bands = 1,2,3,4
> drawGDAL(): Unable to access file. GDALDatasetRasterIO() failed:
> /vsimem/kmlsuperoverlay/3
> _085CA378, band 1: Illegal nBlockXOff value (2) in
> GDALRasterBand::GetLockedBlockRef()
> 
> msDrawMap(): Image handling error. Failed to draw layer named
> 'mountain-view-superoverlay'
> .
> msDrawMap(): Image handling error. Failed to draw layer named
> 'mountain-view-superoverlay'
> . 
> drawGDAL(): Unable to access file. GDALDatasetRasterIO() failed:
> /vsimem/kmlsuperoverlay/3
> _085CA378, band 1: Illegal nBlockXOff value (2) in
> GDALRasterBand::GetLockedBlockRef()
>   
> msFreeMap(): freeing map at 061BA7F0.
> freeLayer(): freeing layer at 07273208.
> 
> Test2: MapServer with superoverlay+VSICURL, on Ubuntu
> ==
> 
> $ shp2img -m superoverlay-kml.map -o ttt.png -all_debug 5
> 
> result (success)
> 
> 
> [Thu Jan 14 18:20:02 2016].525687 msLoadMap(): 0.000s
> [Thu Jan 14 18:20:02 2016].525906 msDrawMap(): rendering using
> outputformat named png (AGG/PNG).
> [Thu Jan 14 18:20:02 2016].525919 msDrawMap(): WMS/WFS set-up and query,
> 0.000s
> [Thu Jan 14 18:20:02 2016].527354
> msDrawRasterLayerLow(mountain-view-superoverlay): entering.
> [Thu Jan 14 18:20:11 2016].774926 msDrawRasterLayerGDAL(): Entering
> transform.
> [Thu Jan 14 18:20:11 2016].774950 msDrawRasterLayerGDAL():
> src=0,0,16384,16384, dst=44,0,312,300
> [Thu Jan 14 18:20:11 2016].774955 

Re: [mapserver-users] kml superoverlays

2016-01-14 Thread Jeff McKenna

On 2016-01-14 6:55 PM, Even Rouault wrote:


Hum I didn't try with MapServer, but looking at the GDAL request it does in the 
logs, I tried
something close with gdal_translate:

gdal_translate 
/vsicurl/http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-doqq.kml 
out2.tif -outsize 312 300

and the good or bad news is that fails on both Ubuntu and Windows (well at 
least on wine/Linux) with
a similar error to yours:

VSICURL: Start download for 
http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-070501/422.kml
VSICURL: Stop download for 
http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-070501/422.kml
VSICURL: Start download for 
http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-070501/422.JPEG
VSICURL: Stop download for 
http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-070501/422.JPEG
GDAL: GDALOpen(/vsimem/kmlsuperoverlay/6_0x1d0f878, this=0x1d12bd0) succeeds as 
JPEG.
GDAL: GDALDefaultOverviews::OverviewScan()
GDAL: GDALDefaultOverviews::OverviewScan()
ERROR 5: /vsimem/kmlsuperoverlay/3_0x1cf4ce8, band 1: Illegal nBlockXOff value 
(2) in GDALRasterBand::TryGetLockedBlockRef()

ERROR 5: /vsimem/kmlsuperoverlay/3_0x1cf4ce8, band 1: Illegal nBlockXOff value 
(2) in GDALRasterBand::GetLockedBlockRef()


Not sure why you get different results.

Mind opening a GDAL ticket about that ? I'm debugging something else tricky 
right now ;-)



GDAL ticket: https://trac.osgeo.org/gdal/ticket/6311

-jeff



--
Jeff McKenna
MapServer Consulting and Training Services
http://www.gatewaygeomatics.com/




___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users

Re: [mapserver-users] kml superoverlays

2016-01-14 Thread Even Rouault

> Could this 'OGRDB2DriverOpen' be the issue?  

This is just a harmelss debug message (that shouldn't be printed IMHO in the 
Open() method of the DB2 driver. cc'ing David)

> Shouldn't GDAL use the
> "KMLSUPEROVERLAY" driver here?  (for the record that driver is listed in
> both my Windows and Ubuntu builds, through 'gdalinfo --formats').

No the issue is that the \ windows directory separator was used instead of / 
for http ressources.
Just fixed with https://trac.osgeo.org/gdal/ticket/6310

You might get some extra open speedup by defining 
GDAL_DISABLE_READDIR_ON_OPEN=EMPTY as env. var/config. option (this prevents 
probing for (most) side-car files. This is not something to use in general 
however.

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users

Re: [mapserver-users] kml superoverlays

2016-01-14 Thread Jeff McKenna

On 2016-01-13 1:20 PM, Even Rouault wrote:

Le mercredi 13 janvier 2016 17:59:46, Páll Péter Hunor a écrit :

Hi,

Thanks for tip, I already have seen that option, but I have not found
any example how to use it.
Does anybody have any experience with that?


You can refer to general raster input documentation :
http://mapserver.org/input/raster.html

Check first with gdalinfo that the KML superoverlay is properly recognized. If
that works, you should also be able to open it in a desktop GIS such as QGIS.



Hunor

On 2016.01.13. 17:32, Even Rouault wrote:

Le mercredi 13 janvier 2016 17:15:12, Páll Péter Hunor a écrit :

Hi,

Does mapserver support raster layers using kml superoverlays as data
source, similar to shapefile based tileindexes?
I did not find any solution, but I still might exist...
Thanks in advance.


GDAL supports opening kml superoverlays file as rasters (probably with
some caveats), so you can try adding DATA your.kml or your.kmz in the
mapfile.

(no docs apart mentionning it in
http://gdal.org/formats_list.html )


Regards,
Hunor




This caught my interest yesterday, so I did some testing locally with a 
KML superoverlay.  I used the file referenced in the KML reference doc: 
http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-doqq.kml


What I found was that I have troubles getting GDAL to read this file on 
Windows, yet no problems with Ubuntu.


I compile GDAL from source for both Windows and Ubuntu. To be honest, at 
first I thought the issue must be because on Windows I was using GDAL 
2.0.1, and on Ubuntu I am using GDAL-trunk; but today I did a fresh 
build of GDAL-trunk on Windows, and the same problem exists. I'm sharing 
this because I am stuck on why this occurs.  Here is more details:


Test 1: VSICURL to a remote GeoTIFF, on Windows
===

gdalinfo 
/vsicurl/http://svn.osgeo.org/gdal/trunk/autotest/utilties/data/pyramid_shaded_ref.tif


result: expected details on the tif extents etc.

Test 2: VSICURL to the remote KML Superoverlay, on Windows
==

gdalinfo 
/vsicurl/http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-doqq.kml


gdalinfo failed - unable to open 
'/vsicurl/http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-doqq.kml'.



Test 3: VSICURL to the remote KML Superoverlay, on Windows, with debug
==

gdalinfo --config CPL_DEBUG ON 
/vsicurl/http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-doqq.kml


VSICURL: 
GetFileSize(http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-doqq.kml)=0 
 r

esponse_code=200
VSICURL: 
GetFileList(/vsicurl/http://mw1.google.com/mw-earth-vectordb/kml-samples)
VSICURL: Downloading 0-18446744073709551615 
(http://mw1.google.com/mw-earth-vectordb/kml-s

amples/mv-doqq.kml)...
VSICURL: Got response_code=206
VSICURL: 
GetFileSize(http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-doqq.hdr)=0 
 r

esponse_code=404
VSICURL: 
GetFileSize(http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-doqq.HDR)=0 
 r

esponse_code=404
VSICURL: 
GetFileSize(http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-doqq.kml.hdr)=

0  response_code=404
VSICURL: 
GetFileSize(http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-doqq.kml.HDR)=

0  response_code=404
VSICURL: 
GetFileSize(http://mw1.google.com/mw-earth-vectordb/kml-samples/MV-DOQQ.HDR)=0 
 r

esponse_code=404
VSICURL: 
GetFileSize(http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-doqq.aux)=0 
 r

esponse_code=404
VSICURL: 
GetFileSize(http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-doqq.AUX)=0 
 r

esponse_code=404
VSICURL: 
GetFileSize(http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-doqq.kml.xml)=

0  response_code=404
VSICURL: Start download for 
http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-070501/

1.kml
VSICURL: Stop download for 
http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-070501/1

.kml
VSICURL: Start download for 
http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-070501\

1.JPEG
VSICURL: Stop download for 
http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-070501\1

.JPEG
OGRDB2DriverOpen: pszFilename: 
'/vsicurl/http://mw1.google.com/mw-earth-vectordb/kml-sampl

es/mv-doqq.kml'
gdalinfo failed - unable to open 
'/vsicurl/http://mw1.google.com/mw-earth-vectordb/kml-sam

ples/mv-doqq.kml'.

Test 4: VSICURL to the remote KML Superoverlay, on Ubuntu, with debug
=

$ gdalinfo --config CPL_DEBUG ON 
/vsicurl/http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-doqq.kml


VSICURL: 
GetFileSize(http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-doqq.kml)=0 
 response_code=200
VSICURL: 
GetFileList(/vsicurl/http://mw1.google.com/mw-earth-vectordb/kml-samples)
VSICURL: Downloading 0-18446744073709551615 
(http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-doqq.kml)...

VSICURL: Got 

Re: [mapserver-users] kml superoverlays

2016-01-14 Thread Jeff McKenna

On 2016-01-14 4:22 PM, Jeff McKenna wrote:

On 2016-01-13 1:20 PM, Even Rouault wrote:

Le mercredi 13 janvier 2016 17:59:46, Páll Péter Hunor a écrit :

Hi,

Thanks for tip, I already have seen that option, but I have not found
any example how to use it.
Does anybody have any experience with that?


You can refer to general raster input documentation :
http://mapserver.org/input/raster.html

Check first with gdalinfo that the KML superoverlay is properly
recognized. If
that works, you should also be able to open it in a desktop GIS such
as QGIS.



Hunor

On 2016.01.13. 17:32, Even Rouault wrote:

Le mercredi 13 janvier 2016 17:15:12, Páll Péter Hunor a écrit :

Hi,

Does mapserver support raster layers using kml superoverlays as data
source, similar to shapefile based tileindexes?
I did not find any solution, but I still might exist...
Thanks in advance.


GDAL supports opening kml superoverlays file as rasters (probably with
some caveats), so you can try adding DATA your.kml or your.kmz in the
mapfile.

(no docs apart mentionning it in
http://gdal.org/formats_list.html )


Regards,
Hunor




This caught my interest yesterday, so I did some testing locally with a
KML superoverlay.  I used the file referenced in the KML reference doc:
http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-doqq.kml

What I found was that I have troubles getting GDAL to read this file on
Windows, yet no problems with Ubuntu.

I compile GDAL from source for both Windows and Ubuntu. To be honest, at
first I thought the issue must be because on Windows I was using GDAL
2.0.1, and on Ubuntu I am using GDAL-trunk; but today I did a fresh
build of GDAL-trunk on Windows, and the same problem exists. I'm sharing
this because I am stuck on why this occurs.  Here is more details:

Test 1: VSICURL to a remote GeoTIFF, on Windows
===

gdalinfo
/vsicurl/http://svn.osgeo.org/gdal/trunk/autotest/utilties/data/pyramid_shaded_ref.tif


result: expected details on the tif extents etc.

Test 2: VSICURL to the remote KML Superoverlay, on Windows
==

gdalinfo
/vsicurl/http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-doqq.kml

gdalinfo failed - unable to open
'/vsicurl/http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-doqq.kml'.


Test 3: VSICURL to the remote KML Superoverlay, on Windows, with debug
==

gdalinfo --config CPL_DEBUG ON
/vsicurl/http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-doqq.kml

VSICURL:
GetFileSize(http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-doqq.kml)=0
  r
esponse_code=200
VSICURL:
GetFileList(/vsicurl/http://mw1.google.com/mw-earth-vectordb/kml-samples)
VSICURL: Downloading 0-18446744073709551615
(http://mw1.google.com/mw-earth-vectordb/kml-s
amples/mv-doqq.kml)...
VSICURL: Got response_code=206
VSICURL:
GetFileSize(http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-doqq.hdr)=0
  r
esponse_code=404
VSICURL:
GetFileSize(http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-doqq.HDR)=0
  r
esponse_code=404
VSICURL:
GetFileSize(http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-doqq.kml.hdr)=

0  response_code=404
VSICURL:
GetFileSize(http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-doqq.kml.HDR)=

0  response_code=404
VSICURL:
GetFileSize(http://mw1.google.com/mw-earth-vectordb/kml-samples/MV-DOQQ.HDR)=0
  r
esponse_code=404
VSICURL:
GetFileSize(http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-doqq.aux)=0
  r
esponse_code=404
VSICURL:
GetFileSize(http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-doqq.AUX)=0
  r
esponse_code=404
VSICURL:
GetFileSize(http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-doqq.kml.xml)=

0  response_code=404
VSICURL: Start download for
http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-070501/
1.kml
VSICURL: Stop download for
http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-070501/1
.kml
VSICURL: Start download for
http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-070501\
1.JPEG
VSICURL: Stop download for
http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-070501\1
.JPEG
OGRDB2DriverOpen: pszFilename:
'/vsicurl/http://mw1.google.com/mw-earth-vectordb/kml-sampl
es/mv-doqq.kml'


Could this 'OGRDB2DriverOpen' be the issue?  Shouldn't GDAL use the 
"KMLSUPEROVERLAY" driver here?  (for the record that driver is listed in 
both my Windows and Ubuntu builds, through 'gdalinfo --formats').



gdalinfo failed - unable to open
'/vsicurl/http://mw1.google.com/mw-earth-vectordb/kml-sam
ples/mv-doqq.kml'.

Test 4: VSICURL to the remote KML Superoverlay, on Ubuntu, with debug
=

$ gdalinfo --config CPL_DEBUG ON
/vsicurl/http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-doqq.kml

VSICURL:
GetFileSize(http://mw1.google.com/mw-earth-vectordb/kml-samples/mv-doqq.kml)=0
  response_code=200
VSICURL: