how to adapt an api for my own wms layers

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

how to adapt an api for my own wms layers

robertdbuckley
Hi,

I am using the Ushahidi framework and would like to serve my ownbasemaps which come from geoserver (wms and GeoWebCache)

There is a class in the Ushahidi framework which I have pasted underneath. It called the layers using the following parameters....

// OpenStreetMap Mapnik
$layer = new stdClass();
$layer->active = TRUE;
$layer->name = 'osm_mapnik';
$layer->openlayers = "OSM.Mapnik";
$layer->title = 'OSM Mapnik';
$layer->description = 'The main OpenStreetMap map';
$layer->api_url = 'https://www.openstreetmap.org/openlayers/OpenStreetMap.js';
$layer->data = array(
'baselayer' => TRUE,
'attribution' => '&copy;<a href="@ccbysa">CCBYSA</a> 2010
<a href="@openstreetmap">OpenStreetMap.org</a> contributors',
'url' => 'http://tile.openstreetmap.org/${z}/${x}/${y}.png',
'type' => ''
);
$layers[$layer->name] = $layer;

I would like to adapt this code for my own geoserver instance......but am not sure what/how to change it.

It references the OpenStreetMap.js file which defines the maps as this

/**
 * Class: OpenLayers.Layer.OSM.Mapnik
 *
 * Inherits from:
 *  - <OpenLayers.Layer.OSM>
 */
OpenLayers.Layer.OSM.Mapnik = OpenLayers.Class(OpenLayers.Layer.OSM, {
    /**
     * Constructor: OpenLayers.Layer.OSM.Mapnik
     *
     * Parameters:
     * name - {String}
     * options - {Object} Hashtable of extra options to tag onto the layer
     */
    initialize: function(name, options) {
        var url = [
            "http://a.tile.openstreetmap.org/${z}/${x}/${y}.png",
            "http://b.tile.openstreetmap.org/${z}/${x}/${y}.png",
            "http://c.tile.openstreetmap.org/${z}/${x}/${y}.png"
        ];
        options = OpenLayers.Util.extend({
            numZoomLevels: 19,
            buffer: 0,
            transitionEffect: "resize"
        }, options);
        var newArguments = [name, url, options];
        OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
    },

    CLASS_NAME: "OpenLayers.Layer.OSM.Mapnik"
});

Can anyone see how I could adapt this code to use a wms or gwc layer coming from http://mydomain/geoserver/wms? with "layername"???

thanks for any suggestions,

yours,

Rob




_______________________________________________
Users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/openlayers-users
Yours with thanks, Robert Buckley System: Linux Ubuntu 10.04 Server / Tomcat6 / Geoserver 2.1.2 / GeoWebCache 1.2.6)