<div>Before I get into the details of .data(&#39;mapquery&#39;), do you agree we should make it possible to make repeated calls to $(selector).mapQuery()?  For example,</div><div><br></div><div>$(selector).mapQuery(layers: { url, layer})</div>

<div>$(selector).mapquery(layers: { url2, layer2}) //Both layers exist in map</div><div><br></div><div>I don&#39;t believe this would work currently, I would like to look into making it work though.</div><div><br></div><div>

Onto .data(&#39;mapquery)...</div><div><br></div>I could see adding layers via the LayerControl widget or on instantiation, but you don&#39;t think a single user will want different access to the methods? We would have to write a widget for every possible use case...<div>

<br></div><div>I wrote a second demo that the user can add a WMS layer via a form. This requires opening up a .data(&#39;mapquery&#39;) object in order to add the layer.</div><div><br></div><div>On ESRI&#39;s demo site, layers are added via URL: <a href="http://www.arcgis.com/home/webmap/viewer.html?url=http://server.arcgisonline.com/ArcGIS/rest/services/Demographics/USA_Unemployment_Rate/MapServer&amp;source=sd">http://www.arcgis.com/home/webmap/viewer.html?url=http://server.arcgisonline.com/ArcGIS/rest/services/Demographics/USA_Unemployment_Rate/MapServer&amp;source=sd</a></div>

<meta http-equiv="content-type" content="text/html; charset=utf-8"><div>These types of behavior are not available with MapQuery, at least not in a blazingly obvious way.  The most basic examples may work well with the current API, but if the user requires any type of dynamic adding of layers/controls/etc they need to dig into .data(&#39;mapquery&#39;).</div>

<div><br></div><div>I think this will be a common use case that we should cater too.  I believe $(selector).mapQuery() should return jQuery chain as it does now, but $.mapQuery could return the map object with all our public methods available.</div>

<div><br></div><div>-Drew<br><br><div class="gmail_quote">On Fri, Jan 14, 2011 at 1:45 PM, Volker Mische <span dir="ltr">&lt;<a href="mailto:volker.mische@gmail.com">volker.mische@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

Hi Drew,<br>
<br>
we discussed the API quite a lot. To understand the current one, you have to understand the idea behind that all. MapQuery is basically two parts, MapQuery Core and MapQuery UI. MapQuery UI are the widgets, like the layer control or the popup control I&#39;m working on. Those widgets use the MapQuery Core. The goal is, that people start to use the widgets and are happy with them as they are, they don&#39;t need to care about the internals (and also not about MapQuery Core).<br>


<br>
Therefore .geoMap() (which should relaly be named .mapQuery()) behaves like a normal jQuery plugin, and is therefore chainable. If you need some internal functionality (which you shouldn&#39;t care about as an end user), you can easily have access via data(&#39;geoMap&#39;) (which also should be data(&#39;mapQuery&#39;)).<br>


<br>
You might argue that you need .data() for adding new layers. Well, I expect that most people pass in all layers they need at the beginning in the mapQuery() constructor. Later they add new layers probably through some interface, which would again be coded as a widget.<br>


<br>
I hope this mail makes it a bit clearer, why this API is like that. Though I&#39;m happy to keep discussing and changing it for the best.<br>
<br>
Cheers,<br>
  Volker<div><div></div><div class="h5"><br>
<br>
On 14.01.2011 18:51, Drew Wells wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div></div><div class="h5">
MapQuery currently suffers from a little complexity, seen in the<br>
following api.<br>
var map = $(&#39;#map&#39;).geoMap();<br>
var mapData = map.data(&#39;geoMap&#39;);<br>
<br>
I merged some code that eliminated this by having $(&quot;#map&quot;).geoMap()<br>
return the map object instead of the jQuery collection.  This may<br>
be counterintuitive to others that are normally used to chaining method<br>
calls in jQuery.<br>
<br>
I propose the following solution<br>
<br>
$.geoMap([jQuery selector], [options]); //return reference to Object<br>
containing all all relevant methods<br>
<br>
The following type of usage would be available:<br>
var map = $.geoMap(&quot;#map&quot;, {<br>
   layers: [<br>
               { url: &#39;<a href="http://wms" target="_blank">http://wms</a>&#39;,<br>
                 type: &#39;wms&#39;,<br>
                 layers: [states,countries] } ],<br>
   transparent: true //apply to all layers,<br>
   ...<br>
   Other options<br>
   ...<br>
});<br>
<br>
The then have the option of doing two things, either using<br>
$.geoMap(&quot;#map&quot;) to add new controls and/or layers OR $.geoMap returns<br>
an object which has these methods available.<br>
<br>
$.geoMap(&quot;#map&quot;, {transparent: false }); is the same as map.transparent(<br>
false )<br>
<br>
Ideas for this usage are based on past experiences with $.flot<br>
<a href="http://people.iola.dk/olau/flot/API.txt" target="_blank">http://people.iola.dk/olau/flot/API.txt</a><br>
<br>
-Drew<br>
<br>
<br>
<br></div></div>
_______________________________________________<br>
MapQuery mailing list<br>
<a href="mailto:MapQuery@lists.osgeo.org" target="_blank">MapQuery@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/mapquery" target="_blank">http://lists.osgeo.org/mailman/listinfo/mapquery</a><br>
</blockquote>
<br>
</blockquote></div><br><br clear="all"><br>-- <br>Sent from my Chrome V8 Engine<br>
</div>