1 Map with dynamic layers

In this example, a map with dynamic layers is shown depending on the client's country.


Parameters of the main box:


Sentence used:


Copy
<select>
    <columns>
        <geo.buffer>
            <geom1>
        <geo.aggrMbr>
            <geo.point2D>
                <coords>' || customer.gps_lon ||' ' || customer.gps_lat  || '</coords>  
                <srid>auth_srid2_srid(4)</srid>
            </geo.point2D>
        </geo.aggrMbr>
            </geom1>
            <dist>0.5</dist>
        </geo.buffer>
    </columns>
    <from table='customer' />
    <where>
        gps_lat IS NOT NULL
    </where>
</select>

Parameters of the layer:


Code of the sentence in cursor tracking


Copy
<select>
    <columns>
       country
    </columns>
    <from table='customer' />
    <where>
        gps_lat IS NOT NULL
    </where>
    <group>1</group>
</select>

Code of the SQL statement


Copy
<select>
    <columns>
        'POINT(' || REPLACE(customer.gps_lon,',','.') || ' ' || REPLACE(customer.gps_lat, ',','.') || ')' zone,
        customerid,
        1 sqlgmap_range,
        customer.firstname,
        customer.company,
        customer.supportrepid
    </columns>
    <from table='customer' />
    <where>
        customer.country = '#country' AND
        customer.gps_lat IS NOT NULL
    </where>
</select>

Code of the info window


Copy
<table border='0.5' cellpadding='2' cellspacing='2' bgcolor='grey'>
    <tr bgcolor='white'>
       <th colspan='2' bgcolor="LightBlue"><b>CUSTOMER</b></th>
    </tr>
    <tr bgcolor='white'>
       <th bgcolor="LightBlue"><b>Name</b></th>
       <th><b>#firstname</b></th> 
    </tr>
    <tr bgcolor='white'>
       <th bgcolor="LightBlue"><b>Company</b></th>
       <th><b><i>#company</i></b></th> 
    </tr>
</table>

Note that the label of the layer indicates HDR_COUNTRY, the parameterization of the label is:


In the description of the tag, #valueof (country), in this way the tag will be replaced by the value of the country column in the sql statement of the tracking cursor.


Result:


By clicking on legend, the n layers are shown for each country. Layers can be activated or deactivated dynamically on the map.