[OpenLayers-Users] WFS/WMS

chris Wild chrismwild at gmail.com
Tue Mar 3 18:29:46 EST 2009


Hi,
Can someone please tell me why my WFS layer is drifting off my WMS location.
Both layers are using WGS84 co-ord.
Have attached jpg of track that should display around lake.

Any help much appreciated.

Regards
Chris

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title>OpenLayers map preview</title>

<!-- Import OL CSS, auto import does not work with our minified OL.js build
-->

<link rel="stylesheet" type="text/css" href="
http://localhost:8080/geoserver/openlayers/theme/default/style.css"/>

<!-- Basic CSS definitions -->

<style type="text/css">

/* General settings */

body {

font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;

font-size: small;

}

/* Toolbar styles */

#toolbar {

position: relative;

padding-bottom: 0.5em;

display: none;

}

#toolbar ul {

list-style: none;

padding: 0;

margin: 0;

}

#toolbar ul li {

float: left;

padding-right: 1em;

padding-bottom: 0.5em;

}

#toolbar ul li a {

font-weight: bold;

font-size: smaller;

vertical-align: middle;

color: black;

text-decoration: none;

}

#toolbar ul li a:hover {

text-decoration: underline;

}

#toolbar ul li * {

vertical-align: middle;

}

/* The map and the location bar */

#map {

clear: both;

position: relative;

width: 800px;

height: 371px;

border: 1px solid black;

}

#wrapper {

width: 800px;

}

#location {

float: right;

}

#options {

position: absolute;

left: 13px;

top: 7px;

z-index: 3000;

}

/* Styles used by the default GetFeatureInfo output, added to make IE happy
*/

table.featureInfo, table.featureInfo td, table.featureInfo th {

border: 1px solid #ddd;

border-collapse: collapse;

margin: 0;

padding: 0;

font-size: 90%;

padding: .2em .1em;

}

table.featureInfo th {

padding: .2em .2em;

text-transform: uppercase;

font-weight: bold;

background: #eee;

}

table.featureInfo td {

background: #fff;

}

table.featureInfo tr.odd td {

background: #eee;

}

table.featureInfo caption {

text-align: left;

font-size: 100%;

font-weight: bold;

text-transform: uppercase;

padding: .2em .2em;

}

</style>

<script src="http://localhost:8080/geoserver/openlayers/OpenLayers.js"
type="text/javascript">

</script>

<script defer="defer" type="text/javascript">

var map;

var untiled;

var tiled;

var pureCoverage = true;

// pink tile avoidance

OpenLayers.IMAGE_RELOAD_ATTEMPTS = 5;

// make OL compute scale according to WMS spec

OpenLayers.DOTS_PER_INCH = 25.4 / 0.28;

function init(){

// if this is just a coverage or a group of them, disable a few items,

// and default to jpeg format

format = 'image/png';

if(pureCoverage) {

document.getElementById('filterType').disabled = true;

document.getElementById('filter').disabled = true;

document.getElementById('antialiasSelector').disabled = true;

document.getElementById('updateFilterButton').disabled = true;

document.getElementById('resetFilterButton').disabled = true;

document.getElementById('jpeg').selected = true;

format = "image/jpeg";

}

var bounds = new OpenLayers.Bounds(

174.38698427874348, -39.46185934677626,

174.4352962787435, -39.43797334677626

);

var options = {

controls: [],

maxExtent: bounds,

maxResolution: 0.00018871875,

projection: "EPSG:4326",

units: 'degrees'

};

map = new OpenLayers.Map('map', options);

// setup tiled layer

tiled = new OpenLayers.Layer.WMS(

"topp:RectifyTRC_APP_wgs - Tiled", "http://localhost:8080/geoserver/wms",

{

layers: 'topp:RectifyTRC_APP_wgs',

styles: '',

height: '371',

width: '800',

srs: 'EPSG:4326',

format: format,

tiled: 'true',

tilesOrigin : "174.38698427874348,-39.46185934677626"

},

{buffer: 0}

);

wfs = new OpenLayers.Layer.WFS(

'topp:walkingtrkwgs', "http://localhost:8080/geoserver/wfs",

{

srs: 'EPSG:4326',

typename:"walkingtrkwgs",

height: '544',

styles: '',

format: format,

tiled: 'true',

tilesOrigin : "174.39553846817478,-39.46070911608958"

},

{buffer: 0}

);

// setup single tiled layer

untiled = new OpenLayers.Layer.WMS(

"topp:RectifyTRC_APP_wgs - Untiled", "http://localhost:8080/geoserver/wms",

{

layers: 'topp:RectifyTRC_APP_wgs',

styles: '',

height: '371',

width: '800',

srs: 'EPSG:4326',

format: format

},

{singleTile: true, ratio: 1}

);

map.addLayers([untiled, tiled, wfs]);

// build up all controls

map.addControl(new OpenLayers.Control.PanZoomBar({

position: new OpenLayers.Pixel(2, 15)

}));

map.addControl(new OpenLayers.Control.Navigation());

map.addControl(new OpenLayers.Control.OverviewMap());

map.addControl(new OpenLayers.Control.Scale($('scale')));

map.addControl(new OpenLayers.Control.LayerSwitcher());

map.addControl(new OpenLayers.Control.MousePosition({element:
$('location')}));

map.zoomToExtent(bounds);

// wire up the option button

var options = document.getElementById("options");

options.onclick = toggleControlPanel;

// support GetFeatureInfo

map.events.register('click', map, function (e) {

document.getElementById('nodelist').innerHTML = "Loading... please wait...";

var params = {

REQUEST: "GetFeatureInfo",

EXCEPTIONS: "application/vnd.ogc.se_xml",

BBOX: map.getExtent().toBBOX(),

X: e.xy.x,

Y: e.xy.y,

INFO_FORMAT: 'text/html',

QUERY_LAYERS: map.layers[0].params.LAYERS,

FEATURE_COUNT: 50,

Layers: 'topp:RectifyTRC_APP_wgs',

Styles: '',

Srs: 'EPSG:4326',

WIDTH: map.size.w,

HEIGHT: map.size.h,

format: format};

OpenLayers.loadURL("http://localhost:8080/geoserver/wms", params, this,
setHTML, setHTML);

OpenLayers.Event.stop(e);

});

}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20090304/703f842f/attachment.html


More information about the Users mailing list