[mapserver-users] Sqlite / Spatialite as a layer

Richard Greenwood richard.greenwood at gmail.com
Fri Jan 16 08:07:37 EST 2009


On Fri, Jan 16, 2009 at 2:57 AM, James Mapserver
<james.mapserver at gmail.com> wrote:
> Hi does anyone have any examples of using this ?
>
> I see that Sqlite is included as an option with OGR - but the only reference
> I can see is:
> http://www.gdal.org/ogr/drv_sqlite.html
>
> Does anyone have any examples of the layer statement needed in a mapserver
> .map file
>
> Also - can the spatialite extension be used at all ?
>
> It looks similar to PostGIS - and whilst not having all the power may have
> application for simpler datasets / setups where a full PostGIS install is
> not possible



   ### SQLite/SpatiaLite
   CONNECTIONTYPE OGR
   CONNECTION "/data/23_Sublette_GIS/sqlite/sublette.sqlite"  # full
path to SQLite db file
   DATA "ownership" # table in db file

The geometry must be in WKT format. You can import w/ GDAL like:
   ogr2ogr -f "SQLite" -lco FORMAT=WKT dest.db source.shp source

Or import w/ SpatiaLite and the convert to WKT like:
  sqlite> alter table ownership add column WKT_GEOMETRY;
  sqlite> update ownership set WKT_GEOMETRY=astext(geom);

You don't do select statements like w/ PostGIS. Treat it like a shape
file and use FILTER and FILTERITEM.

Rich

-- 
Richard Greenwood
richard.greenwood at gmail.com
www.greenwoodmap.com


More information about the mapserver-users mailing list