MySQL or Oracle queries...

Abe Gillespie agillesp at VT.EDU
Thu Jan 6 15:28:35 EST 2005


I'm not sure the information you're looking for as to either the theory
or the actual code for doing it ... but I do link (sorta) to external
data in a PostgreSQL database.  I'm going on the assumption you're
looking for the theory behind this.  So:

Take, for example, a houses layer.  The layer only needs a field that
uniquely identifies each record; say an auto-increment integer.  Now
maybe you have a table in the database that gives the history for a
house.  Assume there's a record for each year.  So one house could have
20, 30, 40+ records for it.

Now say you want the history for any building that existed before 1975.
  All you would have to do is externally (by this I mean some other
means than MapServer ... I do it via Mono / ASP.NET + Npgsql) query the
database for "year < 1975"  Now just include the unique ID in the
output and you can link into MapServer (of course the history table
needs the unique identifier from the houses layer).  From here it's an
easy query in MapServer.  In PHP it looks like:

$layer->queryByAttributes("ID", $bldgId, MS_SINGLE);

Viola!

-Abe


On Jan 6, 2005, at 2:35 PM, Kevin Grootendorst wrote:

> On Wed, 22 Sep 2004 16:14:52 -0400, William Bulley <web at UMICH.EDU>
> wrote:
>
>> I am new to MapServer so please bear with me...
>>
>> The main MapServer home page makes reference to a feature
>> of MapServer that would allow queries to a database like
>> MySQL or Oracle no doubt through Perl's DBI module.
>>
>> My interest is not obtaining points to plot from a table
>> in a database, but rather tabular or scalar information
>> about a map feature (height of a building, address of a
>> store, etc.) that might be selected by a MapServer user.
>>
>> I am no where near being able to attempt this at my level
>> of MapServer knowledge today, but if it is possible to do
>> this, could someone point me to a chunk of documentation
>> or a WWW page for more information?
>>
>> I assume that something like this would need to be done
>> using MapScript (Perl?) if at all.
>>
>> Regards,
>>
>> web...
>>
>> --
>> William Bulley                     Email: web at umich.edu
>
> William,
> I too am interested in learning how to query tabular data from MySQl
> and
> present it in MapServer.  Have you had any luck with this?
>
> Kevin
>



More information about the mapserver-users mailing list