Ticket #1406: wfs_reprojection.patch
| File wfs_reprojection.patch, 6.3 kB (added by crschmidt, 10 months ago) |
|---|
-
lib/OpenLayers/Layer/WFS.js
old new 277 277 278 278 var params = {BBOX: this.encodeBBOX ? tileBounds.toBBOX() 279 279 : tileBounds.toArray()}; 280 281 if (this.map && !this.projection.equals(this.map.getProjectionObject())) { 282 var projectedBounds = tileBounds.clone(); 283 projectedBounds.transform(this.map.getProjectionObject(), 284 this.projection); 285 params.BBOX = this.encodeBBOX ? projectedBounds.toBBOX() 286 : projectedBounds.toArray(); 287 } 288 280 289 url += "&" + OpenLayers.Util.getParameterString(params); 281 290 282 291 if (!this.tile) { … … 434 443 */ 435 444 commit: function() { 436 445 if (!this.writer) { 437 this.writer = new OpenLayers.Format.WFS({},this); 446 var options = {}; 447 if (this.map && !this.projection.equals(this.map.getProjectionObject())) { 448 options.externalProjection = this.projection; 449 options.internalProjection = this.map.getProjectionObject(); 450 } 451 452 this.writer = new OpenLayers.Format.WFS(options,this); 438 453 } 439 454 440 455 var data = this.writer.write(this.features); -
examples/proxy.cgi
old new 18 18 allowedHosts = ['www.openlayers.org', 'openlayers.org', 19 19 'labs.metacarta.com', 'world.freemap.in', 20 20 'prototype.openmnnd.org', 'geo.openplans.org', 21 'geo.openplans.org:8080', 21 22 'www.openstreetmap.org'] 22 23 23 24 method = os.environ["REQUEST_METHOD"] -
examples/wfs-reprojection.html
old new 1 <html xmlns="http://www.w3.org/1999/xhtml"> 2 <head> 3 <link rel="stylesheet" href="../theme/default/style.css" type="text/css" /> 4 <style type="text/css"> 5 #map { 6 width: 512px; 7 height: 512px; 8 border: 1px solid black; 9 } 10 </style> 11 <script src="../lib/OpenLayers.js"></script> 12 <script src='http://maps.google.com/maps?file=api&v=2.82&key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhR_wWLPFku8Ix9i2SXYRVK3e45q1BQUd_beF8dtzKET_EteAjPdGDwqpQ'></script> 13 <script type="text/javascript"> 14 var map, layer; 15 OpenLayers.ProxyHost = "/cgi-bin/proxy.cgi?url="; 16 function init(){ 17 map = new OpenLayers.Map('map', { 18 projection: new OpenLayers.Projection("EPSG:900913"), 19 displayProjection: new OpenLayers.Projection("EPSG:4326"), 20 units: "m", 21 maxResolution: 156543.0339, 22 maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34, 23 20037508.34, 20037508.34) 24 }); 25 layer = new OpenLayers.Layer.Google( "G", 26 {sphericalMercator: true} ); 27 map.addLayer(layer); 28 layer = new OpenLayers.Layer.WFS( "States", 29 "http://geo.openplans.org:8080/geoserver/ows", {typename: 'topp:states'}, 30 { 31 typename: 'states', 32 featureNS: 'http://www.openplans.org/topp', 33 projection: new OpenLayers.Projection("EPSG:4326"), 34 extractAttributes: false, 35 ratio: 1.2 36 } ); 37 map.addLayer(layer); 38 map.addControl(new OpenLayers.Control.LayerSwitcher()); 39 40 map.zoomToExtent(new OpenLayers.Bounds( 41 -73.839111,40.287907,-68.214111,44.441624). 42 transform(map.displayProjection, map.getProjectionObject())); 43 } 44 </script> 45 </head> 46 <body onload="init()"> 47 48 <h1 id="title">WFS Reprojection Example</h1> 49 50 <div id="tags"> 51 </div> 52 <p id="shortdesc"> 53 Shows the use of the WFS layer reprojection support 54 </p> 55 56 <div id="map"></div> 57 58 <div id="docs"> 59 This example shows automatic WFS reprojection, displaying an 'unprojected' WFS layer projected on the client side over Google Maps. The key configuration here is the 'projection' option on the WFS layer. 60 </div> 61 62 63 64 </body> 65 </html> 66 67 -
examples/spherical-mercator.html
old new 24 24 OpenLayers.IMAGE_RELOAD_ATTEMPTS = 3; 25 25 OpenLayers.Util.onImageLoadErrorColor = "transparent"; 26 26 27 // Ability to load WFS data 28 OpenLayers.ProxyHost = '/proxy/?url='; 29 27 30 function init(){ 28 31 var options = { 29 32 projection: new OpenLayers.Projection("EPSG:900913"), … … 110 113 'isBaseLayer': false,'wrapDateLine': true 111 114 } 112 115 ); 116 // create WFS layer, which is in EPSG:4326 117 wfs = new OpenLayers.Layer.WFS("WFS", 118 "http://featureserver.org/featureserver.cgi/scribble?format=WFS", 119 {maxfeatures: "50"}, 120 { 121 extractAttributes: true, 122 projection: new OpenLayers.Projection("EPSG:4326") 123 } 124 ); 113 125 114 126 // create a vector layer for drawing 115 127 var vector = new OpenLayers.Layer.Vector("Editable Vectors"); 116 128 117 129 map.addLayers([gmap, gsat, ghyb, veroad, veaer, vehyb, 118 130 yahoo, yahoosat, yahoohyb, mapnik, osmarender, 119 wms, vector ]);131 wms, vector, wfs]); 120 132 map.addControl(new OpenLayers.Control.LayerSwitcher()); 121 133 map.addControl(new OpenLayers.Control.EditingToolbar(vector)); 122 134 map.addControl(new OpenLayers.Control.Permalink());
