[gdal-dev] Re: [mapserver-users] Investigating OpenLayers -> MapServer (WMS) -> OGR -> db

P Kishor punk.kish at gmail.com
Sun Apr 20 09:06:54 EDT 2008

On 4/20/08, Frank Warmerdam <warmerdam at pobox.com> wrote:
> P Kishor wrote:
> > My issue is simple -- OpenLayers is sending a CGI query (whether
> > asking mapserv to respond via CGI or via WMS, I am calling it a CGI
> > query as it is a query via http). That query string has a param called
> > BBOX (in the case of OpenLayers.Layer.WMS) or mapext (in the case of
> > OpenLayers.Layer.MapServer). All I am interested is in the bit of code
> > that MapServer runs via its OGR driver to extract the data. Since my
> > DATA string says "SELECT wkt_geometry FROM database", it seems to me
> > that MapServer is extracting all the rows for every tile that
> > OpenLayers is requesting. If that is true, that would be very
> > inefficient. If that is not true, what exactly is MapServer
> > extracting?
> >
>  Puneet,
>  That is true.  OGR does not use any spatial indexing for sqlite at this
>  time.  It just reads all the rows and discards those that don't match the
>  current spatial query.
> > This must be specified somewhere in the code for MapServer/OGR
> > connection, because, I am assuming, OpenLayers doesn't directly query
> > the database -- after it hands the right query to MapServer, it simply
> > waits for whatever data it gets back.
> >
>  Right, it is up to the SQLite OGR driver to manage construction of the SQL.
>  It would be nice if the OGR SQLite driver recognised when it was working
>  with a SpatialLite database, and knew how to load the spatiallite extension
>  and could then take advantage of whatever spatial indexing spatiallite
> offers.
>  In the meantime, sqlite + ogr + mapserver is not a suitable arrangement for
>  really large volumes of spatial data from which you want to full small
> spatial
>  regions frequently.  Us a format with spatial indexing that we can take
>  advantage of.

Thanks Frank. That was precisely the answer I was looking for. Even
though it is disappointing in that it confirms that the OGR/SQLite
driver is no really throttling the queries based on the querystring
params, at least I won't be spending my time wondering about what
exactly was going on in that black box.

One suggestion and one question follow (assuming that you are the
person who either wrote the OGR/SQLite driver or are knowledgeable
enough about its details) --

Suggestion: would be nice for the OGR/<whatever> driver to log all its
queries to a log file. This would make life really easy for the
database types who may want to know more.

Question: would you (or someone on this list) happen to know which C
file in the source code actually implements the OGR/SQLite driver?


More information about the gdal-dev mailing list