MapServer and Geopackage failing

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

MapServer and Geopackage failing

Seth G-2
Hi all,

I'm trying out the geopackage format as an alternative to shapefiles but running into an issue where MapServer expects the geopackage dataset to include spatialite. Drawing layers with shp2img logs the following:

[Tue Mar 06 10:39:42 2018].512000 msDrawMap(): rendering using outputformat named png (AGG/PNG).
[Tue Mar 06 10:39:42 2018].512000 msDrawMap(): WMS/WFS set-up and query, 0.000s
[Tue Mar 06 10:39:42 2018].529000 msOGRFileOpen: Spatialite support in GPKG not enabled
[Tue Mar 06 10:39:42 2018].549000 msOGRFileNextShape(): OGR error. OGR GetNextFeature() error'd. Check logs.
[Tue Mar 06 10:39:42 2018].549000 msOGRFileNextShape(): In ExecuteSQL(): sqlite3_prepare(SELECT spatialite_version()):
  no such function: spatialite_version
[Tue Mar 06 10:39:42 2018].550000 msDrawMap(): Image handling error. Failed to draw layer named 'ways'.  

The spatialite_version function is missing in the geopackage. The dataset was created by exporting from MapServer as an OUTPUTOPTION:

      OUTPUTFORMAT
        NAME "GeoPackage"
        DRIVER "OGR/GPKG"
        FORMATOPTION "STORAGE=memory"
        FORMATOPTION "FORM=simple"
        FORMATOPTION "FILENAME=result.gpkg"
        FORMATOPTION "DSCO:SPATIALITE=YES" # not a listed option, but tried anyway
        FORMATOPTION "LCO:SPATIAL_INDEX=YES"
    END
 
Running a GisInternals build,  including GDAL 2.1.3 and MapServer 7.0.4.

Relevant code is at https://github.com/mapserver/mapserver/blob/aae74ff2abed3f2f8fe1f76c9b4bbccf15023dc1/mapogr.cpp#L1313
It looks like the error should be swallowed up?

The same dataset exported directly to spatilite works fine.

Anyone experienced the above issue?

Regards,

Seth


--
web:http://geographika.co.uk
twitter: @geographika
_______________________________________________
mapserver-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapserver-users
Reply | Threaded
Open this post in threaded view
|

Re: MapServer and Geopackage failing

Even Rouault-2

Seth,

 

I've pushed a temptative fix per

https://github.com/mapserver/mapserver/commit/4e4885f8598764b7cfb3a8c1c91c6f60eb12671f

but I'm not completely positive this will fix what you've seen.

 

Even

 

> Hi all,

>

> I'm trying out the geopackage format as an alternative to shapefiles but

> running into an issue where MapServer expects the geopackage dataset to

> include spatialite. Drawing layers with shp2img logs the following:

>

> [Tue Mar 06 10:39:42 2018].512000 msDrawMap(): rendering using outputformat

> named png (AGG/PNG). [Tue Mar 06 10:39:42 2018].512000 msDrawMap(): WMS/WFS

> set-up and query, 0.000s [Tue Mar 06 10:39:42 2018].529000 msOGRFileOpen:

> Spatialite support in GPKG not enabled [Tue Mar 06 10:39:42 2018].549000

> msOGRFileNextShape(): OGR error. OGR GetNextFeature() error'd. Check logs.

> [Tue Mar 06 10:39:42 2018].549000 msOGRFileNextShape(): In ExecuteSQL():

> sqlite3_prepare(SELECT spatialite_version()): no such function:

> spatialite_version

> [Tue Mar 06 10:39:42 2018].550000 msDrawMap(): Image handling error. Failed

> to draw layer named 'ways'.

>

> The spatialite_version function is missing in the geopackage. The dataset

> was created by exporting from MapServer as an OUTPUTOPTION:

>

> OUTPUTFORMAT

> NAME "GeoPackage"

> DRIVER "OGR/GPKG"

> FORMATOPTION "STORAGE=memory"

> FORMATOPTION "FORM=simple"

> FORMATOPTION "FILENAME=result.gpkg"

> FORMATOPTION "DSCO:SPATIALITE=YES" # not a listed option, but tried

> anyway FORMATOPTION "LCO:SPATIAL_INDEX=YES"

> END

>

> Running a GisInternals build, including GDAL 2.1.3 and MapServer 7.0.4.

>

> Relevant code is at

> https://github.com/mapserver/mapserver/blob/aae74ff2abed3f2f8fe1f76c9b4bbcc

> f15023dc1/mapogr.cpp#L1313 It looks like the error should be swallowed up?

>

> The same dataset exported directly to spatilite works fine.

>

> Anyone experienced the above issue?

>

> Regards,

>

> Seth

>

>

> --

> web:http://geographika.co.uk

> twitter: @geographika

> _______________________________________________

> mapserver-users mailing list

> [hidden email]

> https://lists.osgeo.org/mailman/listinfo/mapserver-users

 

 

--

Spatialys - Geospatial professional services

http://www.spatialys.com


_______________________________________________
mapserver-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapserver-users
Reply | Threaded
Open this post in threaded view
|

Re: MapServer and Geopackage failing

Seth G-2
Thanks Even!
I'll get a build together and test,

Seth

--
web:http://geographika.co.uk
twitter: @geographika


On Tue, Mar 6, 2018, at 11:41 AM, Even Rouault wrote:

Seth,

 

I've pushed a temptative fix per

https://github.com/mapserver/mapserver/commit/4e4885f8598764b7cfb3a8c1c91c6f60eb12671f

but I'm not completely positive this will fix what you've seen.

 

Even

 

> Hi all,

>

> I'm trying out the geopackage format as an alternative to shapefiles but

> running into an issue where MapServer expects the geopackage dataset to

> include spatialite. Drawing layers with shp2img logs the following:

>

> [Tue Mar 06 10:39:42 2018].512000 msDrawMap(): rendering using outputformat

> named png (AGG/PNG). [Tue Mar 06 10:39:42 2018].512000 msDrawMap(): WMS/WFS

> set-up and query, 0.000s [Tue Mar 06 10:39:42 2018].529000 msOGRFileOpen:

> Spatialite support in GPKG not enabled [Tue Mar 06 10:39:42 2018].549000

> msOGRFileNextShape(): OGR error. OGR GetNextFeature() error'd. Check logs.

> [Tue Mar 06 10:39:42 2018].549000 msOGRFileNextShape(): In ExecuteSQL():

> sqlite3_prepare(SELECT spatialite_version()): no such function:

> spatialite_version

> [Tue Mar 06 10:39:42 2018].550000 msDrawMap(): Image handling error. Failed

> to draw layer named 'ways'.

>

> The spatialite_version function is missing in the geopackage. The dataset

> was created by exporting from MapServer as an OUTPUTOPTION:

>

> OUTPUTFORMAT

> NAME "GeoPackage"

> DRIVER "OGR/GPKG"

> FORMATOPTION "STORAGE=memory"

> FORMATOPTION "FORM=simple"

> FORMATOPTION "FILENAME=result.gpkg"

> FORMATOPTION "DSCO:SPATIALITE=YES" # not a listed option, but tried

> anyway FORMATOPTION "LCO:SPATIAL_INDEX=YES"

> END

>

> Running a GisInternals build, including GDAL 2.1.3 and MapServer 7.0.4.

>

> Relevant code is at

> https://github.com/mapserver/mapserver/blob/aae74ff2abed3f2f8fe1f76c9b4bbcc

> f15023dc1/mapogr.cpp#L1313 It looks like the error should be swallowed up?

>

> The same dataset exported directly to spatilite works fine.

>

> Anyone experienced the above issue?

>

> Regards,

>

> Seth

>

>

> --

> web:http://geographika.co.uk

> twitter: @geographika

> _______________________________________________

> mapserver-users mailing list

> [hidden email]

> https://lists.osgeo.org/mailman/listinfo/mapserver-users

 

 

--

Spatialys - Geospatial professional services

http://www.spatialys.com



_______________________________________________
mapserver-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapserver-users
Reply | Threaded
Open this post in threaded view
|

Re: MapServer and Geopackage failing

Gert Cuykens
Having the same error message but I thought it was because of gdal not
compiled with spatialite or something?

gdal = https://pkgs.alpinelinux.org/package/edge/testing/x86/gdal-dev

2018/03/02 13:18:21 [error] 15#0: *1 FastCGI sent in stderr: "CGI
Request 1 on process 10
msOGRFileOpen: Spatialite support in GPKG not enabled
msOGRFileOpen: Spatialite support in GPKG not enabled
msOGRFileOpen: Spatialite support in GPKG not enabled
msOGRFileNextShape(): OGR error. OGR GetNextFeature() error'd. Check logs.
msOGRFileNextShape(): In ExecuteSQL(): sqlite3_prepare_v2(SELECT
spatialite_version()):
  no such function: spatialite_version

PS could it be using the native shapefile/qix implementation is much
faster than any ogr driver/gpkg alternative even with spatial index
enabled ?


On Tue, Mar 6, 2018 at 12:05 PM, Seth G <[hidden email]> wrote:

> Thanks Even!
> I'll get a build together and test,
>
> Seth
>
> --
> web:http://geographika.co.uk
> twitter: @geographika
>
>
> On Tue, Mar 6, 2018, at 11:41 AM, Even Rouault wrote:
>
> Seth,
>
>
>
> I've pushed a temptative fix per
>
> https://github.com/mapserver/mapserver/commit/4e4885f8598764b7cfb3a8c1c91c6f60eb12671f
>
> but I'm not completely positive this will fix what you've seen.
>
>
>
> Even
>
>
>
>> Hi all,
>
>>
>
>> I'm trying out the geopackage format as an alternative to shapefiles but
>
>> running into an issue where MapServer expects the geopackage dataset to
>
>> include spatialite. Drawing layers with shp2img logs the following:
>
>>
>
>> [Tue Mar 06 10:39:42 2018].512000 msDrawMap(): rendering using
>> outputformat
>
>> named png (AGG/PNG). [Tue Mar 06 10:39:42 2018].512000 msDrawMap():
>> WMS/WFS
>
>> set-up and query, 0.000s [Tue Mar 06 10:39:42 2018].529000 msOGRFileOpen:
>
>> Spatialite support in GPKG not enabled [Tue Mar 06 10:39:42 2018].549000
>
>> msOGRFileNextShape(): OGR error. OGR GetNextFeature() error'd. Check logs.
>
>> [Tue Mar 06 10:39:42 2018].549000 msOGRFileNextShape(): In ExecuteSQL():
>
>> sqlite3_prepare(SELECT spatialite_version()): no such function:
>
>> spatialite_version
>
>> [Tue Mar 06 10:39:42 2018].550000 msDrawMap(): Image handling error.
>> Failed
>
>> to draw layer named 'ways'.
>
>>
>
>> The spatialite_version function is missing in the geopackage. The dataset
>
>> was created by exporting from MapServer as an OUTPUTOPTION:
>
>>
>
>> OUTPUTFORMAT
>
>> NAME "GeoPackage"
>
>> DRIVER "OGR/GPKG"
>
>> FORMATOPTION "STORAGE=memory"
>
>> FORMATOPTION "FORM=simple"
>
>> FORMATOPTION "FILENAME=result.gpkg"
>
>> FORMATOPTION "DSCO:SPATIALITE=YES" # not a listed option, but tried
>
>> anyway FORMATOPTION "LCO:SPATIAL_INDEX=YES"
>
>> END
>
>>
>
>> Running a GisInternals build, including GDAL 2.1.3 and MapServer 7.0.4.
>
>>
>
>> Relevant code is at
>
>>
>> https://github.com/mapserver/mapserver/blob/aae74ff2abed3f2f8fe1f76c9b4bbcc
>
>> f15023dc1/mapogr.cpp#L1313 It looks like the error should be swallowed up?
>
>>
>
>> The same dataset exported directly to spatilite works fine.
>
>>
>
>> Anyone experienced the above issue?
>
>>
>
>> Regards,
>
>>
>
>> Seth
>
>>
>
>>
>
>> --
>
>> web:http://geographika.co.uk
>
>> twitter: @geographika
>
>> _______________________________________________
>
>> mapserver-users mailing list
>
>> [hidden email]
>
>> https://lists.osgeo.org/mailman/listinfo/mapserver-users
>
>
>
>
>
> --
>
> Spatialys - Geospatial professional services
>
> http://www.spatialys.com
>
>
>
> _______________________________________________
> mapserver-users mailing list
> [hidden email]
> https://lists.osgeo.org/mailman/listinfo/mapserver-users
_______________________________________________
mapserver-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapserver-users
Reply | Threaded
Open this post in threaded view
|

Re: MapServer and Geopackage failing

jratike80
In reply to this post by Seth G-2
Hi,

Shapefile may be a little faster than gpkg, but not much. For me the advantages in data administration mean more than a nominal difference in speed (can use the same long attribute names than in the source data, support of longer than 255 character strings, just one file for one or more layers etc.).

-Jukka Rahkonen.

-----Alkuperäinen viesti-----
Lähettäjä: mapserver-users [mailto:[hidden email]] Puolesta Gert Cuykens
Lähetetty: 6. maaliskuuta 2018 17:32
Vastaanottaja: Seth G <[hidden email]>
Kopio: [hidden email]
Aihe: Re: [mapserver-users] MapServer and Geopackage failing

Having the same error message but I thought it was because of gdal not compiled with spatialite or something?

gdal = https://pkgs.alpinelinux.org/package/edge/testing/x86/gdal-dev

2018/03/02 13:18:21 [error] 15#0: *1 FastCGI sent in stderr: "CGI Request 1 on process 10
msOGRFileOpen: Spatialite support in GPKG not enabled
msOGRFileOpen: Spatialite support in GPKG not enabled
msOGRFileOpen: Spatialite support in GPKG not enabled
msOGRFileNextShape(): OGR error. OGR GetNextFeature() error'd. Check logs.
msOGRFileNextShape(): In ExecuteSQL(): sqlite3_prepare_v2(SELECT
spatialite_version()):
  no such function: spatialite_version

PS could it be using the native shapefile/qix implementation is much faster than any ogr driver/gpkg alternative even with spatial index enabled ?


On Tue, Mar 6, 2018 at 12:05 PM, Seth G <[hidden email]> wrote:

> Thanks Even!
> I'll get a build together and test,
>
> Seth
>
> --
> web:http://geographika.co.uk
> twitter: @geographika
>
>
> On Tue, Mar 6, 2018, at 11:41 AM, Even Rouault wrote:
>
> Seth,
>
>
>
> I've pushed a temptative fix per
>
> https://github.com/mapserver/mapserver/commit/4e4885f8598764b7cfb3a8c1
> c91c6f60eb12671f
>
> but I'm not completely positive this will fix what you've seen.
>
>
>
> Even
>
>
>
>> Hi all,
>
>>
>
>> I'm trying out the geopackage format as an alternative to shapefiles
>> but
>
>> running into an issue where MapServer expects the geopackage dataset
>> to
>
>> include spatialite. Drawing layers with shp2img logs the following:
>
>>
>
>> [Tue Mar 06 10:39:42 2018].512000 msDrawMap(): rendering using
>> outputformat
>
>> named png (AGG/PNG). [Tue Mar 06 10:39:42 2018].512000 msDrawMap():
>> WMS/WFS
>
>> set-up and query, 0.000s [Tue Mar 06 10:39:42 2018].529000 msOGRFileOpen:
>
>> Spatialite support in GPKG not enabled [Tue Mar 06 10:39:42
>> 2018].549000
>
>> msOGRFileNextShape(): OGR error. OGR GetNextFeature() error'd. Check logs.
>
>> [Tue Mar 06 10:39:42 2018].549000 msOGRFileNextShape(): In ExecuteSQL():
>
>> sqlite3_prepare(SELECT spatialite_version()): no such function:
>
>> spatialite_version
>
>> [Tue Mar 06 10:39:42 2018].550000 msDrawMap(): Image handling error.
>> Failed
>
>> to draw layer named 'ways'.
>
>>
>
>> The spatialite_version function is missing in the geopackage. The
>> dataset
>
>> was created by exporting from MapServer as an OUTPUTOPTION:
>
>>
>
>> OUTPUTFORMAT
>
>> NAME "GeoPackage"
>
>> DRIVER "OGR/GPKG"
>
>> FORMATOPTION "STORAGE=memory"
>
>> FORMATOPTION "FORM=simple"
>
>> FORMATOPTION "FILENAME=result.gpkg"
>
>> FORMATOPTION "DSCO:SPATIALITE=YES" # not a listed option, but tried
>
>> anyway FORMATOPTION "LCO:SPATIAL_INDEX=YES"
>
>> END
>
>>
>
>> Running a GisInternals build, including GDAL 2.1.3 and MapServer 7.0.4.
>
>>
>
>> Relevant code is at
>
>>
>> https://github.com/mapserver/mapserver/blob/aae74ff2abed3f2f8fe1f76c9
>> b4bbcc
>
>> f15023dc1/mapogr.cpp#L1313 It looks like the error should be swallowed up?
>
>>
>
>> The same dataset exported directly to spatilite works fine.
>
>>
>
>> Anyone experienced the above issue?
>
>>
>
>> Regards,
>
>>
>
>> Seth
>
>>
>
>>
>
>> --
>
>> web:http://geographika.co.uk
>
>> twitter: @geographika
>
>> _______________________________________________
>
>> mapserver-users mailing list
>
>> [hidden email]
>
>> https://lists.osgeo.org/mailman/listinfo/mapserver-users
>
>
>
>
>
> --
>
> Spatialys - Geospatial professional services
>
> http://www.spatialys.com
>
>
>
> _______________________________________________
> mapserver-users mailing list
> [hidden email]
> https://lists.osgeo.org/mailman/listinfo/mapserver-users
_______________________________________________
mapserver-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapserver-users
_______________________________________________
mapserver-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapserver-users
Reply | Threaded
Open this post in threaded view
|

Re: MapServer and Geopackage failing

jratike80
In reply to this post by Seth G-2
Hi,

Please explain what you are actually doing. Do you wish to use geopackage for input or output, or both?  For rasters, vectors, or both?

If you use gpkg as input I suggest to create the database with GDAL from some publicly available datasets so others can do the same for reproducing you case (share your ogr2ogr or gdal_translate commands), with a complete mapfile that you will hopefully provide as well.

-Jukka Rahkonen-

-----Alkuperäinen viesti-----
Lähettäjä: mapserver-users [mailto:[hidden email]] Puolesta Seth G
Lähetetty: 6. maaliskuuta 2018 12:20
Vastaanottaja: [hidden email]
Aihe: [mapserver-users] MapServer and Geopackage failing

Hi all,

I'm trying out the geopackage format as an alternative to shapefiles but running into an issue where MapServer expects the geopackage dataset to include spatialite. Drawing layers with shp2img logs the following:

[Tue Mar 06 10:39:42 2018].512000 msDrawMap(): rendering using outputformat named png (AGG/PNG).
[Tue Mar 06 10:39:42 2018].512000 msDrawMap(): WMS/WFS set-up and query, 0.000s [Tue Mar 06 10:39:42 2018].529000 msOGRFileOpen: Spatialite support in GPKG not enabled [Tue Mar 06 10:39:42 2018].549000 msOGRFileNextShape(): OGR error. OGR GetNextFeature() error'd. Check logs.
[Tue Mar 06 10:39:42 2018].549000 msOGRFileNextShape(): In ExecuteSQL(): sqlite3_prepare(SELECT spatialite_version()):
  no such function: spatialite_version
[Tue Mar 06 10:39:42 2018].550000 msDrawMap(): Image handling error. Failed to draw layer named 'ways'.  

The spatialite_version function is missing in the geopackage. The dataset was created by exporting from MapServer as an OUTPUTOPTION:

      OUTPUTFORMAT
        NAME "GeoPackage"
        DRIVER "OGR/GPKG"
        FORMATOPTION "STORAGE=memory"
        FORMATOPTION "FORM=simple"
        FORMATOPTION "FILENAME=result.gpkg"
        FORMATOPTION "DSCO:SPATIALITE=YES" # not a listed option, but tried anyway
        FORMATOPTION "LCO:SPATIAL_INDEX=YES"
    END
 
Running a GisInternals build,  including GDAL 2.1.3 and MapServer 7.0.4.

Relevant code is at https://github.com/mapserver/mapserver/blob/aae74ff2abed3f2f8fe1f76c9b4bbccf15023dc1/mapogr.cpp#L1313
It looks like the error should be swallowed up?

The same dataset exported directly to spatilite works fine.

Anyone experienced the above issue?

Regards,

Seth


--
web:http://geographika.co.uk
twitter: @geographika
_______________________________________________
mapserver-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapserver-users
_______________________________________________
mapserver-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapserver-users
Reply | Threaded
Open this post in threaded view
|

Re: MapServer and Geopackage failing

Seth G-2
Hi,

I'm trying to create an image from a Geopackage with MapServer.
I can recreate the issue using data from http://www.geopackage.org/#sampledata

It appears a v1.1 Geopackage will throw an error if the Sqlite database does not include the Spatialite extension.
A v1.2 Geopackage does not seem to produce the same error.
Even's patch fixes this error. It also seems the issue disappears when using a dev 2.3.0 build of GDAL.

A sample Mapfile using the sample datasets is below. The first shp2img command works, the second does not.

shp2img -m test.map -l point2d_v1_2 -o test.png
shp2img -m test.map -l point2d_v1_1 -o test.png    


MAP
    # cd /D C:\MapServer\apps\gpkg
    # shp2img -m test.map -l point2d_v1_2 -o test.png
    # shp2img -m test.map -l point2d_v1_1 -o test.png    
    SIZE 200 200
    DEBUG 5
    CONFIG "MS_ERRORFILE" "test.log"
    CONFIG "CPL_DEBUG" "ON"
    EXTENT 0 0 10 10
    SYMBOL
        NAME "circle"
        TYPE ELLIPSE
        FILLED TRUE
        POINTS
            1 1
        END
    END    
    LAYER
        NAME "point2d_v1_2"
        TYPE POINT
        DATA "point2d"
        CONNECTIONTYPE OGR
        CONNECTION "gdal_sample_v1.2_no_extensions.gpkg"
        CLASS
            STYLE
                SYMBOL "circle"
                SIZE 10
                COLOR 0 255 255
            END
        END
    END
    LAYER
        NAME "point2d_v1_1"
        TYPE POINT
        DATA "point2d"
        CONNECTIONTYPE OGR
        CONNECTION "gdal_sample.gpkg"
        CLASS
            STYLE
                SYMBOL "circle"
                SIZE 10
                COLOR 0 255 255
            END
        END
    END    
END


--
web:http://geographika.co.uk
twitter: @geographika

On Tue, Mar 6, 2018, at 5:05 PM, Rahkonen Jukka (MML) wrote:

> Hi,
>
> Please explain what you are actually doing. Do you wish to use
> geopackage for input or output, or both?  For rasters, vectors, or both?
>
> If you use gpkg as input I suggest to create the database with GDAL from
> some publicly available datasets so others can do the same for
> reproducing you case (share your ogr2ogr or gdal_translate commands),
> with a complete mapfile that you will hopefully provide as well.
>
> -Jukka Rahkonen-
>
> -----Alkuperäinen viesti-----
> Lähettäjä: mapserver-users
> [mailto:[hidden email]] Puolesta Seth G
> Lähetetty: 6. maaliskuuta 2018 12:20
> Vastaanottaja: [hidden email]
> Aihe: [mapserver-users] MapServer and Geopackage failing
>
> Hi all,
>
> I'm trying out the geopackage format as an alternative to shapefiles but
> running into an issue where MapServer expects the geopackage dataset to
> include spatialite. Drawing layers with shp2img logs the following:
>
> [Tue Mar 06 10:39:42 2018].512000 msDrawMap(): rendering using
> outputformat named png (AGG/PNG).
> [Tue Mar 06 10:39:42 2018].512000 msDrawMap(): WMS/WFS set-up and query,
> 0.000s [Tue Mar 06 10:39:42 2018].529000 msOGRFileOpen: Spatialite
> support in GPKG not enabled [Tue Mar 06 10:39:42 2018].549000
> msOGRFileNextShape(): OGR error. OGR GetNextFeature() error'd. Check
> logs.
> [Tue Mar 06 10:39:42 2018].549000 msOGRFileNextShape(): In ExecuteSQL():
> sqlite3_prepare(SELECT spatialite_version()):
>   no such function: spatialite_version
> [Tue Mar 06 10:39:42 2018].550000 msDrawMap(): Image handling error.
> Failed to draw layer named 'ways'.  
>
> The spatialite_version function is missing in the geopackage. The
> dataset was created by exporting from MapServer as an OUTPUTOPTION:
>
>       OUTPUTFORMAT
>         NAME "GeoPackage"
>         DRIVER "OGR/GPKG"
>         FORMATOPTION "STORAGE=memory"
>         FORMATOPTION "FORM=simple"
>         FORMATOPTION "FILENAME=result.gpkg"
>         FORMATOPTION "DSCO:SPATIALITE=YES" # not a listed option, but
> tried anyway
>         FORMATOPTION "LCO:SPATIAL_INDEX=YES"
>     END
>  
> Running a GisInternals build,  including GDAL 2.1.3 and MapServer 7.0.4.
>
> Relevant code is at
> https://github.com/mapserver/mapserver/blob/aae74ff2abed3f2f8fe1f76c9b4bbccf15023dc1/mapogr.cpp#L1313
> It looks like the error should be swallowed up?
>
> The same dataset exported directly to spatilite works fine.
>
> Anyone experienced the above issue?
>
> Regards,
>
> Seth
>
>
> --
> web:http://geographika.co.uk
> twitter: @geographika
> _______________________________________________
> mapserver-users mailing list
> [hidden email]
> https://lists.osgeo.org/mailman/listinfo/mapserver-users
_______________________________________________
mapserver-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapserver-users
Reply | Threaded
Open this post in threaded view
|

Re: MapServer and Geopackage failing

jmckenna
Administrator
Hi Seth,

I was also testing with that same test dataset when you wrote this last
message.  In my testing using MS4W v3.2.5 here (MapServer 7.0.7, GDAL
2.2.3) I can display both the v1.2 and v1.0/1.1 test datasets of GPKG.
(I remember painfully spending a lot of time building spatialite with
sqlite, for the MS4W community).

-jeff



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




On 2018-03-06 12:58 PM, Seth G wrote:

> Hi,
>
> I'm trying to create an image from a Geopackage with MapServer.
> I can recreate the issue using data from http://www.geopackage.org/#sampledata
>
> It appears a v1.1 Geopackage will throw an error if the Sqlite database does not include the Spatialite extension.
> A v1.2 Geopackage does not seem to produce the same error.
> Even's patch fixes this error. It also seems the issue disappears when using a dev 2.3.0 build of GDAL.
>
> A sample Mapfile using the sample datasets is below. The first shp2img command works, the second does not.
>
> shp2img -m test.map -l point2d_v1_2 -o test.png
> shp2img -m test.map -l point2d_v1_1 -o test.png
>
>
> MAP
>      # cd /D C:\MapServer\apps\gpkg
>      # shp2img -m test.map -l point2d_v1_2 -o test.png
>      # shp2img -m test.map -l point2d_v1_1 -o test.png
>      SIZE 200 200
>      DEBUG 5
>      CONFIG "MS_ERRORFILE" "test.log"
>      CONFIG "CPL_DEBUG" "ON"
>      EXTENT 0 0 10 10
>      SYMBOL
>          NAME "circle"
>          TYPE ELLIPSE
>          FILLED TRUE
>          POINTS
>              1 1
>          END
>      END
>      LAYER
>          NAME "point2d_v1_2"
>          TYPE POINT
>          DATA "point2d"
>          CONNECTIONTYPE OGR
>          CONNECTION "gdal_sample_v1.2_no_extensions.gpkg"
>          CLASS
>              STYLE
>                  SYMBOL "circle"
>                  SIZE 10
>                  COLOR 0 255 255
>              END
>          END
>      END
>      LAYER
>          NAME "point2d_v1_1"
>          TYPE POINT
>          DATA "point2d"
>          CONNECTIONTYPE OGR
>          CONNECTION "gdal_sample.gpkg"
>          CLASS
>              STYLE
>                  SYMBOL "circle"
>                  SIZE 10
>                  COLOR 0 255 255
>              END
>          END
>      END
> END
>
>
> --
> web:http://geographika.co.uk
> twitter: @geographika
>
> On Tue, Mar 6, 2018, at 5:05 PM, Rahkonen Jukka (MML) wrote:
>> Hi,
>>
>> Please explain what you are actually doing. Do you wish to use
>> geopackage for input or output, or both?  For rasters, vectors, or both?
>>
>> If you use gpkg as input I suggest to create the database with GDAL from
>> some publicly available datasets so others can do the same for
>> reproducing you case (share your ogr2ogr or gdal_translate commands),
>> with a complete mapfile that you will hopefully provide as well.
>>
>> -Jukka Rahkonen-
>>
>> -----Alkuperäinen viesti-----
>> Lähettäjä: mapserver-users
>> [mailto:[hidden email]] Puolesta Seth G
>> Lähetetty: 6. maaliskuuta 2018 12:20
>> Vastaanottaja: [hidden email]
>> Aihe: [mapserver-users] MapServer and Geopackage failing
>>
>> Hi all,
>>
>> I'm trying out the geopackage format as an alternative to shapefiles but
>> running into an issue where MapServer expects the geopackage dataset to
>> include spatialite. Drawing layers with shp2img logs the following:
>>
>> [Tue Mar 06 10:39:42 2018].512000 msDrawMap(): rendering using
>> outputformat named png (AGG/PNG).
>> [Tue Mar 06 10:39:42 2018].512000 msDrawMap(): WMS/WFS set-up and query,
>> 0.000s [Tue Mar 06 10:39:42 2018].529000 msOGRFileOpen: Spatialite
>> support in GPKG not enabled [Tue Mar 06 10:39:42 2018].549000
>> msOGRFileNextShape(): OGR error. OGR GetNextFeature() error'd. Check
>> logs.
>> [Tue Mar 06 10:39:42 2018].549000 msOGRFileNextShape(): In ExecuteSQL():
>> sqlite3_prepare(SELECT spatialite_version()):
>>    no such function: spatialite_version
>> [Tue Mar 06 10:39:42 2018].550000 msDrawMap(): Image handling error.
>> Failed to draw layer named 'ways'.
>>
>> The spatialite_version function is missing in the geopackage. The
>> dataset was created by exporting from MapServer as an OUTPUTOPTION:
>>
>>        OUTPUTFORMAT
>>          NAME "GeoPackage"
>>          DRIVER "OGR/GPKG"
>>          FORMATOPTION "STORAGE=memory"
>>          FORMATOPTION "FORM=simple"
>>          FORMATOPTION "FILENAME=result.gpkg"
>>          FORMATOPTION "DSCO:SPATIALITE=YES" # not a listed option, but
>> tried anyway
>>          FORMATOPTION "LCO:SPATIAL_INDEX=YES"
>>      END
>>    
>> Running a GisInternals build,  including GDAL 2.1.3 and MapServer 7.0.4.
>>
>> Relevant code is at
>> https://github.com/mapserver/mapserver/blob/aae74ff2abed3f2f8fe1f76c9b4bbccf15023dc1/mapogr.cpp#L1313
>> It looks like the error should be swallowed up?
>>
>> The same dataset exported directly to spatilite works fine.
>>
>> Anyone experienced the above issue?
>>
>> Regards,
>>
>> Seth
>>
>>
>> --
>> web:http://geographika.co.uk
>> twitter: @geographika
>> __
_______________________________________________
mapserver-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapserver-users
Reply | Threaded
Open this post in threaded view
|

Re: MapServer and Geopackage failing

Seth G-2
Hi Jeff,

I tested on my ms4w installation just now, and didn't get any errors with the above test (MapServer 7.0.4 and GDAL  2.1.3). The same versions of the GISInternals builds did throw the error on the same machine.

Maybe it is related to the sqlite/spatialite libraries?

ms4w:

SQLite 3.19.3
libspatialite 4.3.0-RC1

GISInternals:

sqlite-3.10.2
libspatialite-4.3.0a

Not sure how MapServer would skip the error Even fixed today though.

Regards,

Seth

--
web:http://geographika.co.uk
twitter: @geographika

On Tue, Mar 6, 2018, at 6:16 PM, Jeff McKenna wrote:

> Hi Seth,
>
> I was also testing with that same test dataset when you wrote this last
> message.  In my testing using MS4W v3.2.5 here (MapServer 7.0.7, GDAL
> 2.2.3) I can display both the v1.2 and v1.0/1.1 test datasets of GPKG.
> (I remember painfully spending a lot of time building spatialite with
> sqlite, for the MS4W community).
>
> -jeff
>
>
>
> --
> Jeff McKenna
> MapServer Consulting and Training Services
> http://www.gatewaygeomatics.com/
>
>
>
>
> On 2018-03-06 12:58 PM, Seth G wrote:
> > Hi,
> >
> > I'm trying to create an image from a Geopackage with MapServer.
> > I can recreate the issue using data from http://www.geopackage.org/#sampledata
> >
> > It appears a v1.1 Geopackage will throw an error if the Sqlite database does not include the Spatialite extension.
> > A v1.2 Geopackage does not seem to produce the same error.
> > Even's patch fixes this error. It also seems the issue disappears when using a dev 2.3.0 build of GDAL.
> >
> > A sample Mapfile using the sample datasets is below. The first shp2img command works, the second does not.
> >
> > shp2img -m test.map -l point2d_v1_2 -o test.png
> > shp2img -m test.map -l point2d_v1_1 -o test.png
> >
> >
> > MAP
> >      # cd /D C:\MapServer\apps\gpkg
> >      # shp2img -m test.map -l point2d_v1_2 -o test.png
> >      # shp2img -m test.map -l point2d_v1_1 -o test.png
> >      SIZE 200 200
> >      DEBUG 5
> >      CONFIG "MS_ERRORFILE" "test.log"
> >      CONFIG "CPL_DEBUG" "ON"
> >      EXTENT 0 0 10 10
> >      SYMBOL
> >          NAME "circle"
> >          TYPE ELLIPSE
> >          FILLED TRUE
> >          POINTS
> >              1 1
> >          END
> >      END
> >      LAYER
> >          NAME "point2d_v1_2"
> >          TYPE POINT
> >          DATA "point2d"
> >          CONNECTIONTYPE OGR
> >          CONNECTION "gdal_sample_v1.2_no_extensions.gpkg"
> >          CLASS
> >              STYLE
> >                  SYMBOL "circle"
> >                  SIZE 10
> >                  COLOR 0 255 255
> >              END
> >          END
> >      END
> >      LAYER
> >          NAME "point2d_v1_1"
> >          TYPE POINT
> >          DATA "point2d"
> >          CONNECTIONTYPE OGR
> >          CONNECTION "gdal_sample.gpkg"
> >          CLASS
> >              STYLE
> >                  SYMBOL "circle"
> >                  SIZE 10
> >                  COLOR 0 255 255
> >              END
> >          END
> >      END
> > END
> >
> >
> > --
> > web:http://geographika.co.uk
> > twitter: @geographika
> >
> > On Tue, Mar 6, 2018, at 5:05 PM, Rahkonen Jukka (MML) wrote:
> >> Hi,
> >>
> >> Please explain what you are actually doing. Do you wish to use
> >> geopackage for input or output, or both?  For rasters, vectors, or both?
> >>
> >> If you use gpkg as input I suggest to create the database with GDAL from
> >> some publicly available datasets so others can do the same for
> >> reproducing you case (share your ogr2ogr or gdal_translate commands),
> >> with a complete mapfile that you will hopefully provide as well.
> >>
> >> -Jukka Rahkonen-
> >>
> >> -----Alkuperäinen viesti-----
> >> Lähettäjä: mapserver-users
> >> [mailto:[hidden email]] Puolesta Seth G
> >> Lähetetty: 6. maaliskuuta 2018 12:20
> >> Vastaanottaja: [hidden email]
> >> Aihe: [mapserver-users] MapServer and Geopackage failing
> >>
> >> Hi all,
> >>
> >> I'm trying out the geopackage format as an alternative to shapefiles but
> >> running into an issue where MapServer expects the geopackage dataset to
> >> include spatialite. Drawing layers with shp2img logs the following:
> >>
> >> [Tue Mar 06 10:39:42 2018].512000 msDrawMap(): rendering using
> >> outputformat named png (AGG/PNG).
> >> [Tue Mar 06 10:39:42 2018].512000 msDrawMap(): WMS/WFS set-up and query,
> >> 0.000s [Tue Mar 06 10:39:42 2018].529000 msOGRFileOpen: Spatialite
> >> support in GPKG not enabled [Tue Mar 06 10:39:42 2018].549000
> >> msOGRFileNextShape(): OGR error. OGR GetNextFeature() error'd. Check
> >> logs.
> >> [Tue Mar 06 10:39:42 2018].549000 msOGRFileNextShape(): In ExecuteSQL():
> >> sqlite3_prepare(SELECT spatialite_version()):
> >>    no such function: spatialite_version
> >> [Tue Mar 06 10:39:42 2018].550000 msDrawMap(): Image handling error.
> >> Failed to draw layer named 'ways'.
> >>
> >> The spatialite_version function is missing in the geopackage. The
> >> dataset was created by exporting from MapServer as an OUTPUTOPTION:
> >>
> >>        OUTPUTFORMAT
> >>          NAME "GeoPackage"
> >>          DRIVER "OGR/GPKG"
> >>          FORMATOPTION "STORAGE=memory"
> >>          FORMATOPTION "FORM=simple"
> >>          FORMATOPTION "FILENAME=result.gpkg"
> >>          FORMATOPTION "DSCO:SPATIALITE=YES" # not a listed option, but
> >> tried anyway
> >>          FORMATOPTION "LCO:SPATIAL_INDEX=YES"
> >>      END
> >>    
> >> Running a GisInternals build,  including GDAL 2.1.3 and MapServer 7.0.4.
> >>
> >> Relevant code is at
> >> https://github.com/mapserver/mapserver/blob/aae74ff2abed3f2f8fe1f76c9b4bbccf15023dc1/mapogr.cpp#L1313
> >> It looks like the error should be swallowed up?
> >>
> >> The same dataset exported directly to spatilite works fine.
> >>
> >> Anyone experienced the above issue?
> >>
> >> Regards,
> >>
> >> Seth
> >>
> >>
> >> --
> >> web:http://geographika.co.uk
> >> twitter: @geographika
> >> __
> _______________________________________________
> mapserver-users mailing list
> [hidden email]
> https://lists.osgeo.org/mailman/listinfo/mapserver-users
_______________________________________________
mapserver-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapserver-users