<HTML><BODY>Hi Steve<br><br>Yes it is WMS request from OL3:<br><a href="http://localhost/map,php?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&FORMAT=image%2Fpng&TRANSPARENT=true&LAYERS=rayon&CRS=EPSG%3A3857&STYLES=&MAP_RESOLUTION=135&WIDTH=2025&HEIGHT=1125&BBOX=1950071.7561607715%2C1681030.6423115395%2C15158390.243839229%2C9018985.35768846">http://localhost/map,php?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&FORMAT=image%2Fpng&TRANSPARENT=true&LAYERS=rayon&CRS=EPSG%3A3857&STYLES=&MAP_RESOLUTION=135&WIDTH=2025&HEIGHT=1125&BBOX=1950071.7561607715%2C1681030.6423115395%2C15158390.243839229%2C9018985.35768846</a><br><br>I considered MapServer captures width, height and extent from GetMap request parameters. <br>But either <br><span style="background-color: transparent;"><em><span style="color: rgb(23, 59, 211);" data-mce-style="color: #173bd3;">$request->loadparams(</span>)</em></span><br>or<br><p><span style="color: rgb(23, 59, 211);" data-mce-style="color: #173bd3;"><em>foreach ($_GET as $key => $value) </em></span><br><span style="color: rgb(23, 59, 211); background-color: transparent;" data-mce-style="color: #173bd3; background-color: transparent;"><em> {</em></span><br><span style="color: rgb(23, 59, 211); background-color: transparent;" data-mce-style="color: #173bd3; background-color: transparent;"><em> $request->setparameter($key, $value);</em></span><br><span style="color: rgb(23, 59, 211); background-color: transparent;" data-mce-style="color: #173bd3; background-color: transparent;"><em> }</em></span><br>don't calculate them and scaledenom=-1 as result. </p><p>Is there another unknown method for me?<br><br>Now this works only with additional extracting from $_GET:<br></p><p><span style="color: rgb(23, 59, 211);"><em>foreach ($_GET as $key => $value) </em></span><br><span style="color: rgb(23, 59, 211);"><em> {</em></span><br><span style="color: rgb(23, 59, 211);"><em> $request->setparameter($key, $value);</em></span><br><span style="color: rgb(23, 59, 211);"><em> }</em></span><br><span style="color: rgb(23, 59, 211);"><em> if(!empty($_GET['BBOX']) && !empty($_GET['WIDTH']) && !empty($_GET['HEIGHT']))</em></span><br><span style="color: rgb(23, 59, 211);"><em> {</em></span><br><span style="color: rgb(23, 59, 211);"><em> $extentArray=explode(',',$_GET['BBOX']);</em></span><br><span style="color: rgb(23, 59, 211);"><em> $minX=$extentArray[0];</em></span><br><span style="color: rgb(23, 59, 211);"><em> $minY=$extentArray[1];</em></span><br><span style="color: rgb(23, 59, 211);"><em> $maxX=$extentArray[2];</em></span><br><span style="color: rgb(23, 59, 211);"><em> $maxY=$extentArray[3];</em></span><br><span style="color: rgb(23, 59, 211);"><em> $width=(int)$_GET['WIDTH'];</em></span><br><span style="color: rgb(23, 59, 211);"><em> $height=(int)$_GET['HEIGHT'];</em></span><br><span style="color: rgb(23, 59, 211);"><em> $map->setSize($width,$height);</em></span><br><span style="color: rgb(23, 59, 211);"><em> $map->setExtent($minX,$minY,$maxX,$maxY);</em></span><br><span style="color: rgb(23, 59, 211);"><em> $map->preparequery();</em></span><br><span style="color: rgb(23, 59, 211);"><em> $scale=$map->scaledenom;</em></span><br><span style="color: rgb(23, 59, 211);"><em> }</em></span></p>Can't understand what's wrong. Any idea ?<br><br>Best regards<br>Vladimir<br><br><br>Tue, 17 Jun 2014 14:29:53 +0000 от "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 id="">
<div class="js-helper js-readmsg-msg">
<style type="text/css"></style>
<div>
<base target="_self" href="https://e.mail.ru/">
<div id="style_14030154040000000890_BODY">
<div>
<p><span style="font-size:11.0pt;font-family:'Calibri','sans-serif';color:#1F497D">This is a WMS request? I’d think MapServer would populate width, height and extent for you. What are the values for those parameters if you don’t set them explicitly?</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> Tuesday, June 17, 2014 6:57 AM<br>
<b>To:</b> mapserver-users<br>
<b>Subject:</b> Re: [mapserver-users] Why $map->scaledenom returns -1 ?</span></p>
</div>
</div>
<p> </p>
<p>Hello Steve.</p>
<div>
<div>
<div>
<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>
<p><br>
Best regards<br>
Vladimir<br>
<br>
16 2014, 15:43 UTC от "Lime, Steve D (MNIT)" <<a href="//e.mail.ru/compose/?mailto=mailto%3aSteve.Lime@state.mn.us" target="_blank">Steve.Lime@state.mn.us</a>>:</p>
<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'">
<a href="//e.mail.ru/compose/?mailto=mailto%3amapserver%2dusers%2dbounces@lists.osgeo.org" target="_blank">mapserver-users-bounces@lists.osgeo.org</a> [<a href="//e.mail.ru/compose/?mailto=mailto%3amapserver%2dusers%2dbounces@lists.osgeo.org" target="_blank">mailto:mapserver-users-bounces@lists.osgeo.org</a>]
<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>
<p><br>
<br>
-- <br>
Vladimir</p>
</div>
</div>
</div>
<p> </p>
<div align="center" style="text-align:center">
<hr size="2" width="100%" align="center">
</div>
<p><br>
-- <br>Vladimir<br></p>
</div>
</div>
<base target="_self" href="https://e.mail.ru/">
</div>
</div>
</div>
</blockquote>
<br>
<br>-- <br>Vladimir<br></BODY></HTML>