Every layer on Locago can be described as layer pages and a map view. In the map view the layer can show an overlay of points, lines and/or polygons.
This tutorial will show you how to create a dynamic layer showing some places in Lund. The result for the Locago user will be the same as for the further developed static layer, but the geographical content will be loaded "on the go".
To follow this tutorial you need to understand some PHP. You can use any language running on a Web server to dynamically create your geographical data source. The use of PHP is not what makes this layer dynamic. PHP is used as a complement to the IScript language in this tutorial. The dynamic part of the layer depends instead on how Locago is loading the geographical content.
You can download all the files needed to create the tutorial layer here. You can also see them here.
The steps to create this dynamic layer are:
IGEO is a XML-based file format where geographical data can be stored.
Create an IGEO file with this content:
Save the file as dynamic.php.igeo
Note! If you copy it, make sure there are no
empty spaces in the beginning of the file.
This PHP file generates an IGEO depending on parameters sent to it through the PHP _GET method.
Hint!
Create an example of the IGEO file first and check that it works before letting PHP generate it
IDOC is also a XML-based file format where both the layer content and how the layer page will look like are described.
Create an IDOC file with this content:
Save the file as dynamic_tutorial_1.idoc, or download the file from here.
Save the icon:
as icon.png
The title and icon specified in the
<idoc>
tag is used to describe the layer to the Locago users.
The icon needs to be in .png, .gif or .jpg format and a
good size is 24x24 pixels.
<symbolLayer>
, connects the IGEO information to the map overlay. The access to the geographical content is defined with the
attribute dataset. By defining the attribute
webServiceFormat
the layer is loaded dynamically. The markers in the IGEO will not be stored on the Locago server, but
loaded on the go. The permissive service formats are
igeo, rss
and
kml
. coverage
tag describes where content from this layer is visible. This will help when a Locago user searches for a layer around
the user's position. In a static layer this is not needed, because the bounds are calculated from the uploaded IGEO
file, but for a dynamic layer it is impossible.coverage
tag.
The action attribute of the
<section>
tag makes a call to load a sublayer using the IScript language. When the layer is loaded, the handler is informed and
executes its action. The Locago user can view the selected objects in the map. The sublayer, "Places", is called with
the argument array. The arguments are set by using
doc.fields
. See the IScript documentation for more information.
The layer URL to be given on the publisher page is the path to the IDOC file.
After publishing your layer you can add it to your mobile phone from the head menu in Locago by searching for the
title. You can also view the layer in the Locago Web demo by clicking the 'View' option on the publisher page.
Note!
Your layer may not be visible if you browse the Locago layers by tag. Only the top ten rated layers in every tag
category are visible. This may be changed in Locago in the future.