Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function init(){
- var map = new OpenLayers.Map('map');
- var imagery = new OpenLayers.Layer.WMS(
- "Global Imagery",
- "http://maps.opengeo.org/geowebcache/service/wms",
- {
- layers: "bluemarble",
- }
- );
- map.addLayer(imagery);
- localWMS = new OpenLayers.Layer.WMS(
- "Local WMS layers",
- "http://127.0.0.1/cgi-bin/mapserv.exe?MAP=C:/Users/gyu1/Desktop/Newfolder/mapserver.map",
- {
- layers: 'polygon',
- transparent: true
- }, {
- isBaseLayer: false
- }
- );
- map.addLayer(localWMS);
- map.setCenter(
- new OpenLayers.LonLat(1.147, 52.472).transform(
- new OpenLayers.Projection("EPSG:4326"),
- map.getProjectionObject()
- ), 5
- );
- map.addControl( new OpenLayers.Control.LayerSwitcher());
- }
- MAP
- NAME "polygon"
- WEB
- METADATA
- "wms_title" "MapServer"
- "wms_onlineresource" "http://127.0.0.1/cgi-bin/mapserv.exe?MAP=C:/Users/gyu1/Desktop/Newfolder/mapserver.map"
- "wms_srs" "EPSG:4326 EPSG:3857"
- END
- END
- PROJECTION
- "init=epsg:3857"
- END
- LAYER
- NAME "postgis"
- TYPE raster
- STATUS ON
- DATA "PG:host=localhost port=5432 dbname='fusiongeo' user='postgres' password='**' schema='public' table='london' mode='2'"
- PROCESSING "NODATA=-9999"
- PROCESSING "SCALE=AUTO"
- CLASS
- NAME "boring"
- EXPRESSION ([pixel] < 50)
- COLOR 250 100 0
- END
- CLASS
- NAME "mildly interesting"
- EXPRESSION ([pixel] > 50 AND [pixel] < 100)
- COLOR 100 0 0
- END
- CLASS
- NAME "very interesting"
- EXPRESSION ([pixel] >= 100)
- COLOR 0 50 0
- END
- END
- END # end map
- map.setCenter(
- new OpenLayers.LonLat(1.147, 52.472).transform(
- new OpenLayers.Projection("EPSG:4326"),
- map.getProjectionObject()
- ), 5
- );
- http://jsfiddle.net/aguiguy/ZAZN8/
- http://jsfiddle.net/UAxun/155/
- http://jsfiddle.net/VictorVelarde/DbCgt/
- DATA "geom FROM table USING UNIQUE id USING SRID=4326"
- DATA "PG:host=localhost port=5432 dbname='fusiongeo' user='postgres' password='**' schema='public' table='london' mode='2'"
- CONNECTION "PG:host=localhost port=5432 dbname='fusiongeo' user='postgres' password='**'"
- DATA "geom FROM YOURtable USING UNIQUE id USING SRID=3857"
- var map = new OpenLayers.Map('map', {
- projection: new OpenLayers.Projection("EPSG:3857"),
- displayProjection: new OpenLayers.Projection("EPSG:4326"),
- units: "m"
- });
- var imagery = new OpenLayers.Layer.OSM( "Simple OSM Map");
- map.addLayer(imagery);
- localWMS = new OpenLayers.Layer.WMS( "Local WMS layers",
- "http://127.0.0.1/cgi-bin/mapserv.exe?MAP=C:/Users/gyu1/Desktop/Newfolder/mapserver.map",
- {layers: 'polygon',transparent: true},
- {isBaseLayer: false} );
- map.addLayer(localWMS);
- var lonlat = new OpenLayers.LonLat(lon,lat).transform(map.displayProjection, map.projection);
- map.setCenter(lonlat, 5);
- map.addControl( new OpenLayers.Control.LayerSwitcher());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement