当前位置:   article > 正文

openlayer 加载wfs 2种方式_openlayer加载wfs数据

openlayer加载wfs数据

1.geojson

  1. var geo = new OpenLayers.Layer.Vector("EarthQuake", {
  2. strategies: [new OpenLayers.Strategy.Fixed()],
  3. protocol: new OpenLayers.Protocol.HTTP({
  4. url: 'http://172.31.170.98:8088/geoserver/weidong/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=weidong:weidong-vectorlayer&maxFeatures=50&outputFormat=application/json',
  5. format: new OpenLayers.Format.GeoJSON({ignoreExtraDims: true})
  6. })
  7. });

2.KML

  1. buildsLayer = new OpenLayers.Layer.Vector('矢量图层', {
  2. projection: new OpenLayers.Projection('EPSG:4326'),
  3. protocol: new OpenLayers.Protocol.HTTP({
  4. url: 'http://172.31.170.98:8088/geoserver/weidong/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=weidong:weidong-vectorlayer&maxFeatures=50',
  5. format: new OpenLayers.Format.GML({
  6. extractAttributes:true
  7. })
  8. }),
  9. strategies: [new OpenLayers.Strategy.BBOX()]
  10. });
  11. var buildsLayer_style = new OpenLayers.Style({
  12. 'fillOpacity': 0,
  13. 'fillColor':"yellow",
  14. 'strokeColor': 'yellow',
  15. 'strokeWidth': 0,
  16. 'pointRadius': 8
  17. });
  18. var buildsLayer_style_map = new OpenLayers.StyleMap({
  19. 'default': buildsLayer_style
  20. });
  21. buildsLayer.styleMap = buildsLayer_style_map;


url可以在geoserver 中预览视图中得到

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/盐析白兔/article/detail/872344
推荐阅读
相关标签
  

闽ICP备14008679号