hi, if i understand correctly<br>
if you overlay your own image, it is static and you must do<br>
myKaMap.registerForEvent(KAMAP_SCALE_CHANGED,this,redrawFunction)<br>
<br>
in order to get a new image on zoom in/out. where redrawFunction has to
remove current image, and resend the request for a new image given
the new extents<br>
-brent<br><br><div><span class="gmail_quote">On 9/29/05, <b class="gmail_sendername"><a href="mailto:jochen@ingenieurteam2.com">jochen@ingenieurteam2.com</a></b> <<a href="mailto:jochen@ingenieurteam2.com">jochen@ingenieurteam2.com
</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hello ka-map user,<br><br>I want to highlight polygons on the map (based on a query).
<br>To do this (and perhaps other things) I want to render an image<br>with the size of the viewport which contains the visible part of the map.<br>And then overlay this image over the viewport.<br>This works as I suppose but I have problem with the scale.
<br>It seems like there is a fractor missing. But which?<br><br>Best regards,<br>Jochen<br><br><br>//overlay.js start<br>function jg (oKaMap)<br>{<br> this.kaMap = oKaMap;<br> this.highlight = jg_highlight;<br> this.drawOverlay
= jg_drawOverlay;<br>}<br><br>function jg_highlight()<br>{<br> var px = this.kaMap.getGeoExtents();<br> var url = this.kaMap.server + "/overlay.php";<br> url += "?map=" + this.kaMap.currentMap;<br> url += "&width=" +
this.kaMap.viewportWidth;<br> url += "&height=" + this.kaMap.viewportHeight;<br> url += "&minx=" + px[0];<br> url += "&miny=" + px[1];<br> url += "&maxx=" + px[2];<br>
url += "&maxy=" + px[3];<br> call(url, this, this.drawOverlay);<br>}<br><br>function jg_drawOverlay (szResult)<br>{<br> eval( szResult );<br> var canvas = myKaMap.createDrawingCanvas( 500 );<br> var img = document.createElement
( 'img' );<br> img.src = this.imgSrc;<br> img.style.width = this.kaMap.viewportWidth + "px";<br> img.style.height = this.kaMap.viewportHeight + "px";<br> this.kaMap.addObjectGeo(canvas, this.imgX, this.imgY
, img );<br>}<br>//overlay.js start<br><br>//overlay.php start<br><?php<br> dl('php_mapscript_46.dll');<br><br> $width = $_REQUEST['width'];<br> $height = $_REQUEST['height'];<br> $minx = $_REQUEST['minx'];<br> $miny = $_REQUEST['miny'];
<br> $maxx = $_REQUEST['maxx'];<br> $maxy = $_REQUEST['maxy'];<br><br> $map = ms_newMapObj("c:/path/file.map"); // the same mapfile like ka-map<br>shows<br> $map->outputformat->set("transparent", MS_ON );
<br> $l1 = $map->getLayerByName ("L1");<br> $l1 -> set("status", MS_OFF);<br> $l2 = $map->getLayerByName ("L2");<br> $l2 -> set("status", MS_OFF);<br> $l3 = $map->getLayerByName ("L3");
<br> $c3 = $l3 -> getClass (0);<br> $style = ms_newStyleObj($c3);<br> $style->color->setRGB(255,0,0); // simulate highlighting<br> $map -> setExtent ($minx, $miny, $maxx, $maxy);<br> $map -> setSize ($width, $height);
<br> $image=$map->draw();<br> $image_url=$image->saveWebImage();<br> $szResult = "this.imgSrc = '".$image_url."';";<br> $szResult .= "this.imgX = ".$minx.";";<br> $szResult .= "
this.imgY = ".$maxy.";";<br> echo $szResult;<br>?><br>//overlay.php end<br>_______________________________________________<br>ka-Map-users mailing list<br><a href="mailto:ka-Map-users@lists.maptools.org">
ka-Map-users@lists.maptools.org</a><br><a href="http://lists.maptools.org/mailman/listinfo/ka-map-users">http://lists.maptools.org/mailman/listinfo/ka-map-users</a><br></blockquote></div><br>