<HTML><BODY>Hello Steve.<br><div class="js-helper js-readmsg-msg"><div><div id="style_14030055530000000738_BODY"><p>Thank you very much for the thought.</p><p>I use OpenLayers 3 on client side whose query string contains: <br>&WIDTH=2025&HEIGHT=1125&BBOX=5252151,2C3515519,11856310613,7184496 <br><br>and futher scaledenom is computed:</p><p>$extentArray=explode(',',$_GET['BBOX']);<br> $minX=$extentArray[0];<br> $minY=$extentArray[1];<br> $maxX=$extentArray[2];<br> $maxY=$extentArray[3];<br> $width=(int)$_GET['WIDTH'];<br> $height=(int)$_GET['HEIGHT'];<br> $map->setExtent($minX,$minY,$maxX,$maxY);<br>$map->setSize($width,$height);<br> $map->preparequery();<br> $scale=$map->scaledenom;</p><p>It works for me, but I am not sure that is standard method.<br>Can this be used?</p><br>Best regards<br>Vladimir<br><br>16 2014, 15:43 UTC от "Lime, Steve D (MNIT)" <Steve.Lime@state.mn.us>:<br>
<blockquote style="border-left:1px solid #0857A6;margin:10px;padding:0 0 0 10px;">
<div>
<div>
<div>
<div>
<div>
<p><span style="font-size:11.0pt;font-family:'Calibri','sans-serif';color:#1F497D">Scale can only be computed if there is a map extent and map size set. Are you doing so?</span></p>
<p><span style="font-size:11.0pt;font-family:'Calibri','sans-serif';color:#1F497D"> </span></p>
<p><span style="font-size:11.0pt;font-family:'Calibri','sans-serif';color:#1F497D">Steve</span></p>
<p><span style="font-size:11.0pt;font-family:'Calibri','sans-serif';color:#1F497D"> </span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p><b><span style="font-size:10.0pt;font-family:'Tahoma','sans-serif'">From:</span></b><span style="font-size:10.0pt;font-family:'Tahoma','sans-serif'"> mapserver-users-bounces@lists.osgeo.org [mailto:mapserver-users-bounces@lists.osgeo.org]
<b>On Behalf Of </b>Vladimir<br>
<b>Sent:</b> Monday, June 16, 2014 1:12 AM<br>
<b>To:</b> mapserver-users<br>
<b>Subject:</b> [mapserver-users] Why $map->scaledenom returns -1 ?</span></p>
</div>
</div>
<p> </p>
<p style="margin-bottom:12.0pt">Hello list<br>
<br>
I stuck on the scaledenom definition in my PHPMapScript v. 6.4.1.<br>
The current scaledenom required to embed in SQL-statement, but <br>
$map->scaledenom returns -1. Tons of googling got nothing. Please help!<br>
<br>
phpscript.php ---------------------------------------------------------------------------------------------
<br>
<br>
$map = ms_newMapobj("/srv/www/htdocs/tez/design/mapfile.map"); <br>
$request = ms_newOwsrequestObj();<br>
if(!empty($_GET)){<br>
foreach ($_GET as $key => $value) {<br>
$request->setparameter($key, $value);<br>
}<br>
}<br>
<br>
$map->preparequery();<br>
$map->scaledenom;//returns -1 <br>
<br>
$rayonLayer = $map->getLayerByName("rayon"); <br>
$rayonLayer->set("data","geom from (select id, name, geom from location<br>
where ST_Intersects(geom, !BOX!)) as subquery using unique id using srid=3857");<br>
<br>
ms_ioinstallstdouttobuffer();<br>
$map->owsDispatch($request); <br>
<br>
$contenttype = ms_iostripstdoutbuffercontenttype();<br>
header('Content-type:'.$contenttype);<br>
ms_iogetStdoutBufferBytes();<br>
ms_ioresethandlers(); <br>
<br>
<br>
mapfile.map---------------------------------------------------------------------------------------------
<br>
<br>
MAP<br>
NAME "Map"<br>
OUTPUTFORMAT<br>
NAME 'AGG'<br>
DRIVER AGG/PNG<br>
IMAGEMODE RGB<br>
END #OUTPUTFORMAT<br>
STATUS ON<br>
FONTSET "fonts/fonts.list" <br>
CONFIG "PROJ_LIB" "/usr/lib/proj/"<br>
WEB <br>
METADATA<br>
wms_title "Map"<br>
wms_abstract "Map"<br>
wms_onlineresource "<a href="http://localhost/phpscript.php" target="_blank">http://localhost/phpscript.php</a>"<br>
wms_srs "EPSG:3857" <br>
wms_enable_request "*"<br>
wms_encoding "utf-8"<br>
END # end METADATA <br>
END # end WEB <br>
PROJECTION<br>
"init=epsg:3857"<br>
END # end PROJECTION <br>
LAYER<br>
NAME "rayon" <br>
STATUS ON<br>
CONNECTIONTYPE postgis<br>
CONNECTION "user=ms_viewer password=1 dbname=ms_db host=localhost" <br>
TYPE POLYGON<br>
LABELITEM "name"<br>
CLASS <br>
NAME "rayons" <br>
STYLE<br>
OUTLINECOLOR 255 0 0<br>
OUTLINEWIDTH 5<br>
END # end STYLE<br>
END # end CLASS<br>
PROJECTION<br>
"init=epsg:3857"<br>
END # end PROJECTION<br>
METADATA<br>
wms_title "rayon"<br>
wms_abstract "rayon" <br>
wms_srs "EPSG:3857"<br>
wms_include_items "all"<br>
END # end METADATA<br>
END # end LAYER <br>
END # end MAP<br>
---------------------------------------------------------------------------------------------<br>
<br>
Best regards</p>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<br>
<br>--
<br>Vladimir<br>
</div>
<base target="_self" href="https://e.mail.ru/">
</div>
</div>
<br><hr>
<br>-- <br>Владимир<br></BODY></HTML>