[OpenLayers-Users] how to define an non-wms layer on opnelayers?
Stephen Woodbridge
woodbri at swoodbridge.com
Thu Sep 6 07:23:30 PDT 2012
On 9/6/2012 3:54 AM, 李杨 wrote:
> *I leran that if in an html file , add a wms layer using openlayer is like that.*
>
> function init(){
> map= new OpenLayers.Map( 'map' );
> layer= new OpenLayers.Layer.MapServer( "OpenLayers WMS",
> "http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );
> map.addLayer(layer);
> map.zoomToMaxExtent();
>
>
> I want to ask that if I want to add a non wms layer existing on my server, how shoul I do.
>
> I use a mapfile to tell the mapserver configure info.
>
> for example, I browse my map by the link "http://222.129.51.186/cgi-bin/mapserv?&layers=all&map=/home/jack/osm-demo/basemaps/osm-google.map&template=openlayers"
>
> where the222.129.51.186 is my server IP.
>
>
>
> Now I want write these info in an html file ,how to define the layer?
>
>
>
> layer = new Openlayer.Layer.Mapserver("...?what to contain?",..)
This is what I use:
var base = new OpenLayers.Layer.MapServer(
"Sample Maps",
"http://127.0.0.1/cgi-bin/mapserv?",
{ map: "/u/data/maps/sample.map",
layers: "all",
map_imagetype: "agg_q" // reference to name in mapfile
},
{
singleTile: true,
ratio: 1.0
});
base.addOptions({isBaseLayer: true});
base.setVisibility(true);
map.addLayers([base]);
-Steve W
> --
> Yang Li
> GIS Developer
> P.R.China
>
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>
More information about the Users
mailing list