Below code is showing the addition of mapserver file in openlayers 3, it is successfully showing me image in the browser but when i zoom that image it does not zoom. It comes back to originial view.
var perimetro = new ol.layer.Image({ source: new ol.source.ImageWMS({ url: 'http://localhost:8081/cgi-bin/mapserv.exe?', params: { LAYERS : 'landuse10' , CRS : 'EPSG:3857', map : 'C:/ms4w/apps/osm/basemaps/osm-google.map', mode : 'map', FORMAT : 'png' }, serverType : 'mapserver', extent: [8046840.710000,3906011.335000,8217827.220000,4076997.845000] }) }); var map = new ol.Map({ target: 'map', layers: [perimetro], projection : new ol.proj.Projection({ code: 'EPSG:3857', units: 'm' }), view: new ol.View({ center: [8046840.71, 3907521.8 ], zoom: 16 }) }); This is my map file layer code:
LAYER TYPE POLYGON STATUS ON PROJECTION "init=epsg:3857" END NAME "landuse10" GROUP "default" CONNECTIONTYPE POSTGIS CONNECTION "host=localhost dbname=osm user=postgres password=postgres123 port=5432" DATA "geometry from (select geometry ,osm_id, type, name as name from osm_new_landusages_gen1 where type in ('forest','pedestrian','cemetery','industrial','commercial', 'brownfield','residential','school','college','university', 'military','park','golf_course','hospital','parking','stadium','sports_center', 'pitch') order by area desc) as foo using unique osm_id using srid=3857" PROCESSING "LABEL_NO_CLIP=ON" PROCESSING "CLOSE_CONNECTION=DEFER" MAXSCALEDENOM 650016 MINSCALEDENOM 325008 CLASSITEM "type" LABELITEM "name"
أكثر...
var perimetro = new ol.layer.Image({ source: new ol.source.ImageWMS({ url: 'http://localhost:8081/cgi-bin/mapserv.exe?', params: { LAYERS : 'landuse10' , CRS : 'EPSG:3857', map : 'C:/ms4w/apps/osm/basemaps/osm-google.map', mode : 'map', FORMAT : 'png' }, serverType : 'mapserver', extent: [8046840.710000,3906011.335000,8217827.220000,4076997.845000] }) }); var map = new ol.Map({ target: 'map', layers: [perimetro], projection : new ol.proj.Projection({ code: 'EPSG:3857', units: 'm' }), view: new ol.View({ center: [8046840.71, 3907521.8 ], zoom: 16 }) }); This is my map file layer code:
LAYER TYPE POLYGON STATUS ON PROJECTION "init=epsg:3857" END NAME "landuse10" GROUP "default" CONNECTIONTYPE POSTGIS CONNECTION "host=localhost dbname=osm user=postgres password=postgres123 port=5432" DATA "geometry from (select geometry ,osm_id, type, name as name from osm_new_landusages_gen1 where type in ('forest','pedestrian','cemetery','industrial','commercial', 'brownfield','residential','school','college','university', 'military','park','golf_course','hospital','parking','stadium','sports_center', 'pitch') order by area desc) as foo using unique osm_id using srid=3857" PROCESSING "LABEL_NO_CLIP=ON" PROCESSING "CLOSE_CONNECTION=DEFER" MAXSCALEDENOM 650016 MINSCALEDENOM 325008 CLASSITEM "type" LABELITEM "name"
أكثر...