PHP Map Obj Serialize
Stuart Eve
stuarteve at LPARCHAEOLOGY.COM
Tue Aug 15 06:13:00 PDT 2006
Hi there
thanks for the reply - we don't use the querystring to particularly send
queries (we are not using cgi mapserver), instead what we normally do to
preserve the map during each reload is to save it out to a mapfile in
the temp directory (named with the users php session id) and then
recreate the map object from this temp file on each reload. In terms of
recreating the map from variables in the querystring - that is
theoretically possible, but our application allows users to change
colours/layer order/symbology etc. - so its not just a matter of
choosing WHAT data to display its also HOW it is displayed. This means
we would need to load the querystring with definitions for each layer
and class within the mapfile which may become a little unmanageable.
Stuart
P Kishor wrote:
> I know very little about the current state of PHP/MapScript, but I
> have implemented what you propose below. It does not require mucking
> around with mapObj at all.
>
> Think of how any given map is formed -- it requires a query sent
> either via GET or POST. All you have to do is store that query (it is
> already serialized by http for you), associate it with a memorable
> name ('My House', 'My Cat's Sleeping Place') and the resulting png
> image cached somewhere safe where it doesn't get cleaned up by your
> normal hard disk maid service, and store the three as you wish -- in
> an associative array, in a file, in 3 fields of a database table,
> whatever you want.
>
> Next time your user clicks on her 'My House', you check if the
> associate png is present and use it, if not, use the associated query
> to regenerate it, and restore it.
>
> On 8/15/06, Stuart Eve <stuarteve at lparchaeology.com> wrote:
>> Dear all,
>>
>> We are attempting to think of a way to provide a 'permalink' to a
>> particular map object. In addition we would like to do a check to see if
>> the server has already created that map (with its specific
>> configuration) before and so just load up the cached png instead of
>> recreating the png each time.
>>
>> I realise we can save out the mapfile to a .txt file and then read it in
>> - and compare it to all of the other mapfiles we have saved, but it
>> seems like it may be a little processor heavy. We were hoping to save
>> something out to a field in the MySQL table. We were thinking along the
>> lines of a serialized array which could then be compared with the other
>> cached arrays in the MySQL table and see if theres a match.
>>
>> Our main problem, though, is that we can't unserialize a map object (as
>> it loses all of its methods). Is there a way to unserialize the map
>> object and make it function properly again as a map object or
>> alternatively output the mapfile to a field in the database and then
>> recreate the map object from that? Does the mapObj constructor only work
>> from files?
>>
>> We are using Mapserver 4.8 and PHPMapscript.
>>
>> Thanks in advance
>>
>> Stuart
>>
>> --
>> Stuart Eve
>> L - P : Archaeology
>> stuarteve at lparchaeology.com
>>
>
>
--
Stuart Eve
L - P : Archaeology
stuarteve at lparchaeology.com
More information about the MapServer-users
mailing list