[mapserver-users] Using spatialite with mapserver

Rahkonen Jukka Jukka.Rahkonen at mmmtike.fi
Thu Aug 2 15:04:38 PDT 2012


I an writing this night faster than I am thinking, sorry for that. It came into my mind to delete the row for geom1 from the geometry_columns and now it is possible to use geom2.  OGR takes the first matching row from geometry_columns and because row for geom1 does not exist row for geom2 is found and everything works fine.  However, this workaround makes only one geometry at a time usable for OGR and Mapserver because the first registered geometry column must match.

ogrinfo:

FID Column = ROWID
Geometry Column = geom2
OGRFeature(test3):1
  POINT (1436841.2324912299 6908774.4285142776)

OGRFeature(test3):2
  POINT (1437614.9808758798 6908943.9149846984)

OGRFeature(test3):3
  POINT (1438331.5778339701 6909101.5655383449)

-Jukka-
________________________________________
Lähettäjä: mapserver-users-bounces at lists.osgeo.org [mapserver-users-bounces at lists.osgeo.org] käyttäjän Rahkonen Jukka [Jukka.Rahkonen at mmmtike.fi] puolesta
Lähetetty: 3. elokuuta 2012 0:46
Vastaanottaja: Andrea Peri; mapserver-users at lists.osgeo.org
Aihe: Re: [mapserver-users] Using spatialite with mapserver

Hi again,

Tried what ogrinfo sees in case of two geometries. It does not look good.

FID Column = rowid
Geometry Column = geom1
geom2: Binary (0.0)
OGRFeature(test2):1
  geom2 (Binary) = 0001110F0000958B843BA9EC354126C76C9BD95A5A41958B843BA9EC35412
6C76C9BD95A...
  POINT (1436841.2324912299 6908774.4285142776)

OGRFeature(test2):2
  geom2 (Binary) = 0001110F000081AE1AFBAEEF3541FB1B8FFA035B5A4181AE1AFBAEEF3541F
B1B8FFA035B...
  POINT (1437614.9808758798 6908943.9149846984)

So that means than only the first geometry can be user with OGR. Next I tried to create a spatial view with spatialite-gui by selecting only geom2 into the view. This fails too

D:\ms4w\data>ogrinfo berlin.sqlite test3
INFO: Open of `berlin.sqlite'
      using driver `SQLite' successful.
ERROR 1: Underlying layer test2 for view test3 has not expected geometry column
name (geom1 instead of geom2)

Layer name: test3
Geometry: Unknown (any)
Feature Count: 0
Layer SRS WKT:
(unknown)
FID Column = ROWID
Geometry Column = geom2

This looks like an OGR bug, I have correct info in views_geometry_columns (refering to geom2 of the main table) and in geometry_columns (both geom1 and geom2 has records).

For now, forget multiple geometries and create new single geometry tables and enjoy the speed of Spatialite and Mapserver.

-Jukka Rahkonen-


________________________________________
Lähettäjä: mapserver-users-bounces at lists.osgeo.org [mapserver-users-bounces at lists.osgeo.org] käyttäjän Rahkonen Jukka [Jukka.Rahkonen at mmmtike.fi] puolesta
Lähetetty: 3. elokuuta 2012 0:27
Vastaanottaja: Andrea Peri; mapserver-users at lists.osgeo.org
Aihe: Re: [mapserver-users] Using spatialite with mapserver

Hi,

The SELECT alternative works fine for me but I do not have multiple geometries. I made a very fast test on Spatialite side and it seems to be possible to run "Recover geometry column" and "Create spatial index" for multiple geometries but I did not test the result with Mapserver.

I would recommend you to check first your geometry_columns table and see it there is a line for the geometry you want to use and if spatial index is OK. If they are OK make a simplified test. Create a single geometry table as
CREATE table test as
SELECT geom1, attr1... FROM...
Do "Recover geometry column" and "Create spatial index" things for the new table and have a try with Mapserver.

GDAL version must be 1.9 or higher or things will be far too slow.
This document may also be useful for you
http://latuviitta.org/documents/Super_easy_WMS_server.pdf

-Jukka Rahkonen-





________________________________
Lähettäjä: mapserver-users-bounces at lists.osgeo.org [mapserver-users-bounces at lists.osgeo.org] käyttäjän Andrea Peri [aperi2007 at gmail.com] puolesta
Lähetetty: 2. elokuuta 2012 23:03
Vastaanottaja: mapserver-users at lists.osgeo.org
Aihe: [mapserver-users] Using spatialite with mapserver

Hi,
I'm try-ing to use spatialite with mapserver.

is this mapfile configuration ok for spatialite ?

    CONNECTIONTYPE OGR
    CONNECTION '/..path-to../spatialite_file.sqlite'
    DATA 'SELECT field1, field2, field3, geometry from table'

It seem don't work.

Instead work perfectly this other configuration:

    CONNECTIONTYPE OGR
    CONNECTION '/home/vector/vettoriali/db_catasto/regione_toscana/adt_toscana.sqlite'
    DATA 'table'

Unfortunately this second configuration don't allow to choose the geometry field , necessary when spatialite table as two or more geometry field.

Thx,

--
-----------------
Andrea Peri
. . . . . . . . .
qwerty àèìòù
-----------------

_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users
_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


More information about the mapserver-users mailing list