I don't know, how I can add my SLD style for WFS layer. When I add WFS layer, ol using default style for layer. When I add WMS, ol using my SLD style for layer.I using GeoServer + OpenLayers3. My code (ol):
var map; function init(){ view = new ol.View({ center: [4701182.98765148, 7492051.764399836], zoom: 5, maxZoom: 18, minZoom: 2 }); map = new ol.Map({ target: 'map', renderer: 'canvas', view: view, }); var osmLayer = new ol.layer.Tile({ source: new ol.source.OSM() }); var vectorSourceHotpoint = new ol.source.Vector({ format: new ol.format.GeoJSON(), url: function(extent, resolution, projection) { return 'http://192.168.255.197:8080/geoserver/wfs?service=WFS&' + 'version=1.1.0&request=GetFeature&typename=geoportal:hotpoint&' + 'outputFormat=application/json&srsname=EPSG:4326&' + 'bbox=' + extent.join(',') + ',EPSG:4326'; }, strategy: ol.loadingstrategy.tile(ol.tilegrid.createXYZ({ maxZoom: 18 })), projection: 'EPSG:4326' }); var hotpointLayer = new ol.layer.Vector({ source: vectorSourceHotpoint, }); map.addLayer(osmLayer); map.addLayer(hotpointLayer); map.addLayer(threatLayer); And my SLD file:
Generalization data cellSize 30 outputBBOX wms_bbox outputWidth wms_width outputHeight wms_height rule1 Hotpoint 100000 square #FFFF00 #000000 250 0 100000 320000000 square #FFFF00 #000000 10 rule2 2-9 Hotpoints count 2 9 circle #FFFF00 #000000 16 count Arial 12 bold 0.5 0.8 2 #000000 0.9 #FFFFFF 1.0 rule3 > 9-50 Hotpoints count 11 50 circle #FFFF00 #000000 24 count Arial 12 bold 0.5 0.8 2 #000000 0.9 #FFFFFF 1.0 rule4 Greater 50 Hotpoints count 51 circle #FFFF00 #000000 32 count Arial 12 bold 0.5 0.8 2 #000000 0.9 #FFFFFF 1.0
أكثر...
var map; function init(){ view = new ol.View({ center: [4701182.98765148, 7492051.764399836], zoom: 5, maxZoom: 18, minZoom: 2 }); map = new ol.Map({ target: 'map', renderer: 'canvas', view: view, }); var osmLayer = new ol.layer.Tile({ source: new ol.source.OSM() }); var vectorSourceHotpoint = new ol.source.Vector({ format: new ol.format.GeoJSON(), url: function(extent, resolution, projection) { return 'http://192.168.255.197:8080/geoserver/wfs?service=WFS&' + 'version=1.1.0&request=GetFeature&typename=geoportal:hotpoint&' + 'outputFormat=application/json&srsname=EPSG:4326&' + 'bbox=' + extent.join(',') + ',EPSG:4326'; }, strategy: ol.loadingstrategy.tile(ol.tilegrid.createXYZ({ maxZoom: 18 })), projection: 'EPSG:4326' }); var hotpointLayer = new ol.layer.Vector({ source: vectorSourceHotpoint, }); map.addLayer(osmLayer); map.addLayer(hotpointLayer); map.addLayer(threatLayer); And my SLD file:
Generalization data cellSize 30 outputBBOX wms_bbox outputWidth wms_width outputHeight wms_height rule1 Hotpoint 100000 square #FFFF00 #000000 250 0 100000 320000000 square #FFFF00 #000000 10 rule2 2-9 Hotpoints count 2 9 circle #FFFF00 #000000 16 count Arial 12 bold 0.5 0.8 2 #000000 0.9 #FFFFFF 1.0 rule3 > 9-50 Hotpoints count 11 50 circle #FFFF00 #000000 24 count Arial 12 bold 0.5 0.8 2 #000000 0.9 #FFFFFF 1.0 rule4 Greater 50 Hotpoints count 51 circle #FFFF00 #000000 32 count Arial 12 bold 0.5 0.8 2 #000000 0.9 #FFFFFF 1.0
أكثر...