wiki:PluginsMap

>> Back to available plugins page

TOC?

Plugins concerning the Map

Auto calculate reference map

Description

This plugin automatically redraw reference map. Moreover it could recalculate size and extent of reference map and map. So administration of mapfile is easier.

Dependencies

  • plugins/common/groupsAndLayers.php
  • plugins/common/pluginsMapUtils.inc.php
  • plugins/common/easyMDB2.inc.php

How to use

Enable the plugin by adding a line in config_XXXXX.xml file:

<pmapper>
    <ini>
        <pmapper>
....
            <plugins>ms_auto_refmap</plugins>
....
        </pmapper>
    </ini>
</pmapper>

Set default plugin configuration by adding a line in config_XXXXX.xml file:

<pmapper>
   <ini>
....
        <pluginsConfig>
....        
            <!-- Automatic generation of refmap -->
            <ms_auto_refmap>
               <!-- Image -->
               <!-- outputformat to use (have to be defined in mapfile) -->
               <format>png</format>
               <!-- URL of the refmap containing directory (usually "/tmp/" or "/ms_tmp/") -->
               <imgBaseURL>/tmp/</imgBaseURL>
               <!-- groups / layers to draw in refmap -->
               <groups>
                   <group>countries</group>
                   <group>rivers</group>
               </groups>
	
               <!-- Extent -->
               <!-- Auto calculate extent (0 / 1) ? -->
               <autoExtent>1</autoExtent>
               <!-- groups / layers to use to determinate extent -->
               <autoExtentGroups>
                   <group>countries</group>
               </autoExtentGroups>
               <!-- add margin in percent -->
               <marginPercent>10</marginPercent>
               <!-- add magin in pixel (in percent not defined !)-->
               <marginFixValue>0</marginFixValue>

               <!-- Size -->
               <!-- Auto calculate refmap size (0 / 1) ? -->
               <autoSize>0</autoSize>
               <!-- decrease size to find the best one (0 / 1) ? -->
               <decreaseHeight>0</decreaseHeight>
               <!-- decrease height (0 / 1) ? -->
               <decreaseWidth>0</decreaseWidth>
               <!-- step in pixel to finc the best size -->
               <stepSize>10</stepSize>
            </ms_auto_refmap>
....
        </pluginsConfig>
    </ini>
</pmapper>

Additional use

You can use an other layer to zoom change extend between 2 configurations with the same mapfile. You need either SHP layer(s) that only contains your country for instance, or a postgis layer(s) with a filter like for instance:

LAYER
  NAME "country_DE"
  TYPE polygon
  DATA "the_geom from countries USING UNIQUE gid_1 using SRID=4326"
  CONNECTION "user=xxx password=xxx dbname=xxx host=xxx"
  CONNECTIONTYPE POSTGIS
  FILTER ("isocode" = 'DE')
  PROJECTION
    "init=epsg:4326"
  END
END

LAYER
  NAME "country_FR"
  TYPE polygon
  DATA "the_geom from countries USING UNIQUE gid_1 using SRID=4326"
  CONNECTION "user=xxx password=xxx dbname=xxx host=xxx"
  CONNECTIONTYPE POSTGIS
  FILTER ("isocode" = 'FR')
  PROJECTION
    "init=epsg:4326"
  END
END

And in your config_xxx.xml:

   <autoExtentGroups>
      <group>country_DE</group>
   </autoExtentGroups>

and

   <autoExtentGroups>
      <group>country_FR</group>
   </autoExtentGroups>

Coordinates translation

Description

This plugin allow to translate cursor coordinates in other projections.

How to use

Enable the plugin by adding a line in config_XXXXX.xml file:

<pmapper>
    <ini>
        <pmapper>
....
            <plugins>coordinates</plugins>
....
        </pmapper>
    </ini>
</pmapper>

Add the drawing tool button to the interface in /config/XXXXX/js_config.php file:

PM.buttonsDefault = {
.....
    buttons: [
.....
        {tool:'coordinates',   name:'Coordinates'},
.....
    ]
}

Define the projections you would like to display by adding in config_XXXXX.xml file:

<pmapper>
    <ini>
....
        <pluginsConfig>
....

            <coordinates>
                <mapPrj name="ETRS LAEA" roundTo="0">
                </mapPrj>
                <prj name="lat/lon WGS84" roundTo="4">
                    <definition>init=epsg:4326</definition>
                </prj>
                <prj name="UTM32" roundTo="0">
                    <definition>init=epsg:32632</definition>
                </prj>
            </coordinates>
....
        </pluginsConfig>
    </ini>
</pmapper>

All listed tags and attributes are mandatory.


Map selector

Description

Adds a select box to let user swap to another map file configuration. Uses the function to load different config files via URL, like http://www.myurl.org?config=xyz

How to use

Enable the plugin by adding a line in config_XXXXX.xml file:

<pmapper>
    <ini>
        <pmapper>
....
            <plugins>mapselect</plugins>
....
        </pmapper>
        </ini>
</pmapper>

Configure the plugin in /config/XXXXX/js_config.php file like this:

PM.Plugin.Mapselect.settings = { 
    displayText:_p('Select Theme'),
    configList:{'default':"Map Default", 
                'dev':"Map Dev"
               }, 
    appendToDiv:".map-top-bar",
    cssDiv:{'position':'absolute', right:'60px'},
    cssSelect:{'margin-left':'5px'},
    resetSession:'groups'
};

Parameters:

  • displayText: Text to show before checkbox
  • configList: contains key:value pairs,
    • key = definition of the config (corresponds to 'config_...ini' file),
    • value = the text displayed in the GUI
  • appendToDiv: Id of DOM element where to add the select box (prefix # for and id, . for a class)
  • cssDiv: styles for parent <div>
  • cssSelect: styles for <select> box
  • resetSession: comma-separated string with all session variables to be reset. If set to 'ALL' then *all* session variables are reset. A typical value is 'groups', which means only the default groups are reset but the map extent is kept.

Pan

Not yet documented!!!


Auto refresh map

Description

Enable a timing map reload.

How to use

Enable the plugin by adding a line in config_XXXXX.xml file:

<pmapper>
    <ini>
        <pmapper>
....
            <plugins>timingmap</plugins>
....
        </pmapper>
    </ini>
</pmapper>

Indicate the interval time between reloading map event (ms, default 10000) by adding in config_XXXXX.xml file:

<pmapper>
    <ini>
....
        <pluginsConfig>
....
            <timingmap>
                <delayTimingMap>10000</delayTimingMap>
            </timingmap>
....
        </pluginsConfig>
    </ini>
</pmapper>
Last modified 8 years ago Last modified on Oct 21, 2010, 10:52:13 AM