Some Examples

Selectable Layer

Here we introduce more interactivity: along with map navigation, we provide the ability to select regions.

This is done with a slight mapfile modification:

        NAME "montreal"
        TYPE line
        DATA "montreal.shp"
        CLASSITEM "region_id"
        CLASS STYLE COLOR 232 232 232 OUTLINECOLOR 105 105 105  END END
        CLASS STYLE COLOR 50 150 255 OUTLINECOLOR 105 105 105  END END

The presence of a CLASSITEM informs Dracones that the corresponding layer must be selectable, and the second CLASS attribute specifies the visual appearance of the selected items. You can still navigate the map by panning it with left button dragging, zoom in/out as before, by using the mouse wheel, or by double-clicking (in), or SHIFT + double-clicking (out). But this time you can also select one or more regions, by holding the CTRL button (while clicking or dragging):

One important thing to note is that this is not only a static display behavior: you can easily know which objects are being selected via a corresponding DLayer Python object server-side, and manipulate it as you need, by building a query for instance, as demonstrates the next example.