Scale can only be computed if there is a map extent and map size set. Are you doing so?
Steve From: [email protected] [mailto:[email protected]] On Behalf Of Vladimir Sent: Monday, June 16, 2014 1:12 AM To: mapserver-users Subject: [mapserver-users] Why $map->scaledenom returns -1 ? Hello list I stuck on the scaledenom definition in my PHPMapScript v. 6.4.1. The current scaledenom required to embed in SQL-statement, but $map->scaledenom returns -1. Tons of googling got nothing. Please help! phpscript.php --------------------------------------------------------------------------------------------- $map = ms_newMapobj("/srv/www/htdocs/tez/design/mapfile.map"); $request = ms_newOwsrequestObj(); if(!empty($_GET)){ foreach ($_GET as $key => $value) { $request->setparameter($key, $value); } } $map->preparequery(); $map->scaledenom;//returns -1 $rayonLayer = $map->getLayerByName("rayon"); $rayonLayer->set("data","geom from (select id, name, geom from location where ST_Intersects(geom, !BOX!)) as subquery using unique id using srid=3857"); ms_ioinstallstdouttobuffer(); $map->owsDispatch($request); $contenttype = ms_iostripstdoutbuffercontenttype(); header('Content-type:'.$contenttype); ms_iogetStdoutBufferBytes(); ms_ioresethandlers(); mapfile.map--------------------------------------------------------------------------------------------- MAP NAME "Map" OUTPUTFORMAT NAME 'AGG' DRIVER AGG/PNG IMAGEMODE RGB END #OUTPUTFORMAT STATUS ON FONTSET "fonts/fonts.list" CONFIG "PROJ_LIB" "/usr/lib/proj/" WEB METADATA wms_title "Map" wms_abstract "Map" wms_onlineresource "http://localhost/phpscript.php" wms_srs "EPSG:3857" wms_enable_request "*" wms_encoding "utf-8" END # end METADATA END # end WEB PROJECTION "init=epsg:3857" END # end PROJECTION LAYER NAME "rayon" STATUS ON CONNECTIONTYPE postgis CONNECTION "user=ms_viewer password=1 dbname=ms_db host=localhost" TYPE POLYGON LABELITEM "name" CLASS NAME "rayons" STYLE OUTLINECOLOR 255 0 0 OUTLINEWIDTH 5 END # end STYLE END # end CLASS PROJECTION "init=epsg:3857" END # end PROJECTION METADATA wms_title "rayon" wms_abstract "rayon" wms_srs "EPSG:3857" wms_include_items "all" END # end METADATA END # end LAYER END # end MAP --------------------------------------------------------------------------------------------- Best regards
_______________________________________________ mapserver-users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/mapserver-users
