[MapQuery] MapQuery API Proposal

Drew Wells drew.wells00 at gmail.com
Fri Jan 14 12:51:21 EST 2011


MapQuery currently suffers from a little complexity, seen in the following
api.
var map = $('#map').geoMap();
var mapData = map.data('geoMap');

I merged some code that eliminated this by having $("#map").geoMap() return
the map object instead of the jQuery collection.  This may
be counterintuitive to others that are normally used to chaining method
calls in jQuery.

I propose the following solution

$.geoMap([jQuery selector], [options]); //return reference to Object
containing all all relevant methods

The following type of usage would be available:
var map = $.geoMap("#map", {
  layers: [
              { url: 'http://wms',
                type: 'wms',
                layers: [states,countries] } ],
  transparent: true //apply to all layers,
  ...
  Other options
  ...
});

The then have the option of doing two things, either using $.geoMap("#map")
to add new controls and/or layers OR $.geoMap returns an object which has
these methods available.

$.geoMap("#map", {transparent: false }); is the same as map.transparent(
false )

Ideas for this usage are based on past experiences with $.flot
http://people.iola.dk/olau/flot/API.txt

-Drew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapquery/attachments/20110114/3506d13c/attachment.html


More information about the MapQuery mailing list