Labels in two renderings of the same map (php/MapScript) ?

Lars V. Nielsen (GisPro) LVN at GISPRO.DK
Sun Jan 16 09:59:36 EST 2005


Hi Bobb,

(I forgot to mention that I'm using MapScript 4.3 on php 4.3.7, on W2K(3))

What I basically do is this :

$map->setextent(...);
$img1 = $map->draw(); // original large map
$map->drawLabelCache($img1); // MAYBE
$url1 = $img1->saveWebImage();

$map->setextent(...);
$img2 = $map->draw(); // smaller insert map
$map->drawLabelCache($img2); // MAYBE
$url2 = $img2->saveWebImage();

I tried your suggestion, adding a second labelling layer, separating the two by min/max scale settings, but the labels are still
missing in the insert image.

And yes, I've checked the original output, the labels are not present in the second image.

My first thought, is that the label cache is cleared during the first rendering, making it impossible to add labels to a second
rendering.

My second thought is that the settings to control label caching are disfunctional. I've tried using LABELCACHE OFF + remove
drawLabelCache(), but it seems I can't de-select label caching, and thus can't circumvent the original cache clearing problem.

Is Mapserver even capable of such dual rendering at all ?

I'm still interested in any thoughts, also from the developers of Mapserver, on the issue.

And if anyone has another idea of how to generate an insert maps (note: using two map files are unacceptable and unpractical) with
the same map content, I'm very interested.

Best regards/Med venlig hilsen
Lars V. Nielsen
GisPro, Denmark
http://www.gispro.dk/
----- Original Message -----
From: "Blammo" <bob.basques at ci.stpaul.mn.us>
To: "Lars V. Nielsen (GisPro)" <LVN at GISPRO.DK>
Sent: Sunday, January 16, 2005 1:25 PM
Subject: Re: Labels in two renderings of the same map ?


Lars V. Nielsen (GisPro) wrote:

>I've been asked to generate a map with an insert, i.e. adding a small area with a larger scale in the corner of the map.
>
>I've accomplished it by performing two renderings of the same map, the second rendering after setting a smaller width/height and a
>fixed extent, and using GD2 to merge the two images appropriately. This works perfectly.
>
>However, I've sofar been unable to get labels to display in the small insert image. They show up perfectly in the main/large image.
>
>I don't turn any layers on/off between the two renderings, and I don't have any label min/max scale settings in place for this
>labelling layer (which btw. is an OVF layer).
>
>I suspect that it's an issue connected with the label cache. I've tried to add LABELCACHE OFF to the labelling layer and remove the
>commands $map->drawLabelCache() from my code, but it makes no difference at all: the labels only (and always!) appear in the main
>window.
>
>If anyone has come up with a way to control labels in two map renderings, I'll be delighted to know.
>
>
It sounds like you are making to seperate calls to MapServer.  Did you
try running them through by hand to see if they both get labeled.

I've noticed on occassion that the smaller images sometimes don't label
based on the settings in the Mapfile, you may need a seperate layer
definiton for the smaller area with different label settings.

bobb

>Best regards/Med venlig hilsen
>Lars V. Nielsen
>GisPro, Denmark
>http://www.gispro.dk/
>
>
>
>



More information about the mapserver-users mailing list