Advertisement
Guest User

Untitled

a guest
Aug 3rd, 2017
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.27 KB | None | 0 0
  1. function init(){
  2. var map = new OpenLayers.Map('map');
  3. var imagery = new OpenLayers.Layer.WMS(
  4. "Global Imagery",
  5. "http://maps.opengeo.org/geowebcache/service/wms",
  6. {
  7. layers: "bluemarble",
  8. }
  9. );
  10. map.addLayer(imagery);
  11. localWMS = new OpenLayers.Layer.WMS(
  12. "Local WMS layers",
  13. "http://127.0.0.1/cgi-bin/mapserv.exe?MAP=C:/Users/gyu1/Desktop/Newfolder/mapserver.map",
  14. {
  15. layers: 'polygon',
  16. transparent: true
  17. }, {
  18. isBaseLayer: false
  19. }
  20. );
  21.  
  22. map.addLayer(localWMS);
  23. map.setCenter(
  24. new OpenLayers.LonLat(1.147, 52.472).transform(
  25. new OpenLayers.Projection("EPSG:4326"),
  26. map.getProjectionObject()
  27. ), 5
  28. );
  29. map.addControl( new OpenLayers.Control.LayerSwitcher());
  30. }
  31.  
  32. MAP
  33. NAME "polygon"
  34. WEB
  35. METADATA
  36. "wms_title" "MapServer"
  37. "wms_onlineresource" "http://127.0.0.1/cgi-bin/mapserv.exe?MAP=C:/Users/gyu1/Desktop/Newfolder/mapserver.map"
  38. "wms_srs" "EPSG:4326 EPSG:3857"
  39. END
  40. END
  41. PROJECTION
  42. "init=epsg:3857"
  43. END
  44. LAYER
  45. NAME "postgis"
  46. TYPE raster
  47. STATUS ON
  48. DATA "PG:host=localhost port=5432 dbname='fusiongeo' user='postgres' password='**' schema='public' table='london' mode='2'"
  49. PROCESSING "NODATA=-9999"
  50. PROCESSING "SCALE=AUTO"
  51. CLASS
  52. NAME "boring"
  53. EXPRESSION ([pixel] < 50)
  54. COLOR 250 100 0
  55. END
  56. CLASS
  57. NAME "mildly interesting"
  58. EXPRESSION ([pixel] > 50 AND [pixel] < 100)
  59. COLOR 100 0 0
  60. END
  61. CLASS
  62. NAME "very interesting"
  63. EXPRESSION ([pixel] >= 100)
  64. COLOR 0 50 0
  65. END
  66. END
  67. END # end map
  68.  
  69. map.setCenter(
  70. new OpenLayers.LonLat(1.147, 52.472).transform(
  71. new OpenLayers.Projection("EPSG:4326"),
  72. map.getProjectionObject()
  73. ), 5
  74. );
  75.  
  76. http://jsfiddle.net/aguiguy/ZAZN8/
  77. http://jsfiddle.net/UAxun/155/
  78. http://jsfiddle.net/VictorVelarde/DbCgt/
  79.  
  80. DATA "geom FROM table USING UNIQUE id USING SRID=4326"
  81.  
  82. DATA "PG:host=localhost port=5432 dbname='fusiongeo' user='postgres' password='**' schema='public' table='london' mode='2'"
  83.  
  84. CONNECTION "PG:host=localhost port=5432 dbname='fusiongeo' user='postgres' password='**'"
  85. DATA "geom FROM YOURtable USING UNIQUE id USING SRID=3857"
  86.  
  87. var map = new OpenLayers.Map('map', {
  88. projection: new OpenLayers.Projection("EPSG:3857"),
  89. displayProjection: new OpenLayers.Projection("EPSG:4326"),
  90. units: "m"
  91. });
  92. var imagery = new OpenLayers.Layer.OSM( "Simple OSM Map");
  93. map.addLayer(imagery);
  94.  
  95. localWMS = new OpenLayers.Layer.WMS( "Local WMS layers",
  96. "http://127.0.0.1/cgi-bin/mapserv.exe?MAP=C:/Users/gyu1/Desktop/Newfolder/mapserver.map",
  97. {layers: 'polygon',transparent: true},
  98. {isBaseLayer: false} );
  99. map.addLayer(localWMS);
  100.  
  101. var lonlat = new OpenLayers.LonLat(lon,lat).transform(map.displayProjection, map.projection);
  102. map.setCenter(lonlat, 5);
  103.  
  104. map.addControl( new OpenLayers.Control.LayerSwitcher());
  105. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement