Advertisement
Guest User

Untitled

a guest
Jun 2nd, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.28 KB | None | 0 0
  1. sourceVector = new ol.source.Vector({
  2. loader: function(extent) {
  3. $.ajax('http://localhost:8080/geoserver/wfs?forcebasicauth=true&SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&TYPENAME=BFTchambers:bft&SRSNAME=EPSG:27700&username=user&password=password',{
  4. type: 'GET',
  5. data: {
  6. service: 'WFS',
  7. version: '2.0.0',
  8. request: 'GetFeature',
  9. typename: 'bft',
  10. //srsname: 'EPSG:27700',
  11. //cql_filter: "property='Value'",
  12. //cql_filter: "BBOX(geometry," + extent.join(',') + ")",
  13. //bbox: extent.join(',') + ',EPSG:27700'
  14. //extent:[524416,175664, 538096,184752],
  15. },
  16. }).done(function(response) {
  17. formatWFS = new ol.format.WFS(),
  18. sourceVector.addFeatures(formatWFS.readFeatures(response))
  19. });
  20. },
  21. strategy: ol.loadingstrategy.tile(new ol.tilegrid.XYZ({
  22. maxZoom: 19
  23. })),
  24. });
  25.  
  26. <wfs:FeatureCollection xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:wfs="http://www.opengis.net/wfs/2.0" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:BFTchambers="http://geoserver.org/bftchamber" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" numberMatched="1" numberReturned="1" timeStamp="2016-06-02T09:56:21.450Z" xsi:schemaLocation="http://www.opengis.net/gml/3.2 http://localhost:8080/geoserver/schemas/gml/3.2.1/gml.xsd http://geoserver.org/bftchamber http://localhost:8080/geoserver/wfs?service=WFS&version=2.0.0&request=DescribeFeatureType&typeName=BFTchambers%3Abft http://www.opengis.net/wfs/2.0 http://localhost:8080/geoserver/schemas/wfs/2.0/wfs.xsd">
  27. gml:name>test</gml:name BFTchambers:id>1</BFTchambers:id> BFTchambers:geom> gml:LineString srsName="http://www.opengis.net/gml/srs/epsg.xml#27700" srsDimension="2"> gml:posList>528115 181037 533903 180877</gml:posList> /gml:LineString> /BFTchambers:geom> /BFTchambers:bft> /wfs:member> /wfs:FeatureCollection>
  28.  
  29. var layerVector = new ol.layer.Vector({
  30. source: sourceVector
  31. });
  32. layerOSM = new ol.layer.Tile({
  33. source: new ol.source.OSM()
  34. });
  35. var map = new ol.Map({
  36. target: 'map',
  37. overlays: [overlayPopup],
  38. controls: [controlMousePos],
  39. layers: [layerVector, layerOSM],
  40. view: new ol.View({
  41. center: [-12000,6711790],
  42. zoom: 14
  43. })
  44. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement