[OpenLayers-Users] How to add attribution to this layer?

Andreas Hocevar ahocevar at opengeo.org
Mon Feb 27 01:55:51 EST 2012


Hi,

you can set options in the 3rd argument, as explained here:
http://dev.openlayers.org/apidocs/files/OpenLayers/Layer/OSM-js.html#OpenLayers.Layer.OSM.OpenLayers.Layer.OSM

So in your example this would be something like:

new OpenLayers.Layer.OSM("MapQuest-OSM Tiles", arrayOSM, {
    attribution: "Tiles Courtesy of MapQuest"
});

The attribution can contain HTML markup, so you can also include the
link and the image required by the MapQuest terms of use.

Andreas.

On Mon, Feb 27, 2012 at 7:08 AM, Scott Chapman <scott at mischko.com> wrote:
> I don't know how to add an attribution property to the baseOSM layer
> below.  I want to be able to display an attribution line on the map
> saying where the data comes from, etc.
>
>        var arrayOSM =
> ["http://otile1.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.jpg",
>
> "http://otile2.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.jpg",
>
> "http://otile3.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.jpg",
>
> "http://otile4.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.jpg"];
>        var baseOSM = new OpenLayers.Layer.OSM("MapQuest-OSM Tiles", arrayOSM);
>
> Thanks!
> Scott
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users



-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.


More information about the Users mailing list