[mapserver-users] Why $map->scaledenom returns -1 ?

Lime, Steve D (MNIT) Steve.Lime at state.mn.us
Mon Jun 16 08:43:17 PDT 2014


Scale can only be computed if there is a map extent and map size set. Are you doing so?

Steve

From: mapserver-users-bounces at lists.osgeo.org [mailto:mapserver-users-bounces at lists.osgeo.org] 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20140616/c26cd57f/attachment-0001.html>


More information about the mapserver-users mailing list