[Mapstraction] Constructor default settings (Andrew Kirwin)

Andrew Kirwin
Mon, 02 Apr 2012 08:39:53 -0000

Thanks Andrew (Turner),

That does sound like it would work, but no joy for me
(example<http://jsfiddle.net/amk221/mh4Vb/1/>
).

I''d previously notice Nestoria use this {defaultLayer:false} too, but I
can''t figure out how its working. As far as I can tell defaultLayer is
not
actually in the source at all. Should I be altering applyOptions() for
leaflet in order to handle this?

Cheers,
Andrew Kirwin




>
> Today''s Topics:
>
>   1. Re: Constructor default settings (Andrew Turner)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Sun, 1 Apr 2012 17:09:44 -0400
> From: Andrew Turner <andrew at highearthorbit.com>
> To: mapstraction at lists.mapstraction.com
> Subject: Re: [Mapstraction] Constructor default settings
> Message-ID:
>        <CAMpG0ovKNVnASR82-gJdMXv=-7GxKF3FEXEHjgvSz4OEL12hfw at
mail.gmail.com
> >
> Content-Type: text/plain; charset=UTF-8
>
> I think Andrew Kirwin is correct. Leaftlet requires a basemap to
> initialize. In order to keep it matching other providers we
> recommended having a default load on initialization. That happens
> internal the new mxn.Mapstraction constructor. You likely won''t
see it
> if your JS runs fast but you would likely see a request for tiles in
> your Network panel.
>
> I agree that we should either extend to provide optional arguments at
> the end, or even have the constructor optionally take in an Object
> dictionary and accept creation like:
>
>  var mxn = new mxn.Mapstraction({div: map_div, provider:
''leaflet'',
> layers:
[''http://otile{s}.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.png'']}
>  );
>
>
> any thoughts?
>
> Andrew
>
> On Sun, Apr 1, 2012 at 3:39 PM, Ed Freyfogle <edf at sloan.mit.edu>
wrote:
> > Hi Andrew,
> >
> > I use leaflet for mxn
> >
> > here''s how we do it, I don''t believe we load two
tilesets
> >
> > var mxn = new mxn.Mapstraction(map_div,''leaflet'');
> >
> > mxn.options.enableDragging ? = true;
> > mxn.options.scrollWheelZoom = false;
> > mxn.applyOptions();
> > mxn.setOption({defaultLayer:false});
> > mxn.addTileLayer(
> > ? ? ? ? ?
?''http://otile{s}.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.png'',
> > ? ? ? ? ? ?{
> > ? ? ? ? ? ? ? ?attribution: ''Map data &copy; <a
href="
> http://www.openstreetmap.
> > org">OpenStreetMap contributors <a href="
> http://creativecommons.org/licenses
> > /by-sa/2.0/">CC-BY-SA, Imagery &copy;
MapQuest'',
> > ? ? ? ? ? ? ? ?subdomains: ''1234''
> > ? ? ? ? ? ?}
> > ? ? ? ?);
> >
> >
> > does this address your situation?
> >
> >
> > 2012/4/1 Andrew Kirwin <andrew.kirwin at gmail.com>:
> >> Hi,
> >>
> >> Since the release of Leaflet there has been some discussion about
> passing
> >> default settings to a Mapstraction constructor, so that (for
example) a
> tile
> >> set can be specified before the instance gets initialised.
> >>
> >> Has there been any official?decision?on this? I''ve read
that
> Mapstraction''s
> >> stance is that each provider should be required to have a default
tile
> set
> >> (which does make sense). But, this means business using
mapstraction
> could
> >> incur two sets of fees for tile bandwidth (the default tile set
which
> can''t
> >> be switched off, and the new tile set that the developer
*actually*
> wants).
> >>
> >> Being able to override this default would be a great help
> >>
> >> Thanks for any info
> >> - andrew
> >>
> >>
> >> _______________________________________________
> >> Mapstraction mailing list
> >> Mapstraction at lists.mapstraction.com
> >>
> http://lists.mapstraction.com/listinfo.cgi/mapstraction-mapstraction.com
> >>
> > _______________________________________________
> > Mapstraction mailing list
> > Mapstraction at lists.mapstraction.com
> >
http://lists.mapstraction.com/listinfo.cgi/mapstraction-mapstraction.com
>
>
>
> --
> Andrew Turner
> mobile: 248.982.3609
> andrew at fortiusone.com
> http://highearthorbit.com
>
> http://geocommons.com? ? ? ? ?? Helping build the Geospatial Web
> Introduction to Neogeography - http://oreilly.com/catalog/neogeography
>
>
> ------------------------------
>
> _______________________________________________
> Mapstraction mailing list
> Mapstraction at lists.mapstraction.com
> http://lists.mapstraction.com/listinfo.cgi/mapstraction-mapstraction.com
>
>
> End of Mapstraction Digest, Vol 53, Issue 2
> *******************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.mapstraction.com/pipermail/mapstraction-mapstraction.com/attachments/20120402/efe99e5b/attachment.htm>