Some Examples


Basic Map Widget

Let's first look at a very simple example: you want to create a widget for navigating a shapefile (or a PostGIS table that defines some geographical region). For that you need first to create a MapServer mapfile:

MAP
    [...]
    LAYER
        NAME "montreal"
        TYPE line
        DATA "montreal.shp"
        CLASS STYLE COLOR 105 105 105 END END
    END
END

The next and final required step is to instantiate a map widget, with a single JavaScript statement:

var dmap = new dracones.MapWidget(/* some params */); 

Which creates this map, anchored to a div element in the page, that you can pan by dragging with the left mouse button, zoom in/out with the mouse wheel or by double-clicking (in) or SHIFT + double-clicking (out) (or rectangle zoom by dragging while holding SHIFT):

You can have as many map widgets as you need on a page, each with their own config options.

Let's follow with a slightly more complex example.