<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<base href="https://e.mail.ru/" target="_self"><!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p
{mso-style-priority:99;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
{mso-style-priority:99;
mso-style-link:"Balloon Text Char";
margin:0in;
margin-bottom:.0001pt;
font-size:8.0pt;
font-family:"Tahoma","sans-serif";}
span.BalloonTextChar
{mso-style-name:"Balloon Text Char";
mso-style-priority:99;
mso-style-link:"Balloon Text";
font-family:"Tahoma","sans-serif";}
span.EmailStyle20
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><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?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Steve<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><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 ?<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Hello Steve.<o:p></o:p></p>
<div>
<div>
<div id="style_14030055530000000738_BODY">
<p>Thank you very much for the thought.<o:p></o:p></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:<o:p></o:p></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;<o:p></o:p></p>
<p>It works for me, but I am not sure that is standard method.<br>
Can this be used?<o:p></o:p></p>
<p class="MsoNormal"><br>
Best regards<br>
Vladimir<br>
<br>
16 2014, 15:43 UTC от "Lime, Steve D (MNIT)" <<a href="mailto:Steve.Lime@state.mn.us">Steve.Lime@state.mn.us</a>>:<o:p></o:p></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><o:p></o:p></p>
<p><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Steve</span><o:p></o:p></p>
<p><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></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="mailto:mapserver-users-bounces@lists.osgeo.org">mapserver-users-bounces@lists.osgeo.org</a> [<a href="mailto:mapserver-users-bounces@lists.osgeo.org">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><o:p></o:p></p>
</div>
</div>
<p> <o:p></o: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<o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal"><br>
<br>
-- <br>
Vladimir<o:p></o:p></p>
</div>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="2" width="100%" align="center">
</div>
<p class="MsoNormal"><br>
-- <br>
Владимир<o:p></o:p></p>
</div>
</body>
</html>