[OpenLayers-Users] Google and WFS Overlay problem
Cecily
g.c.chen.mac at gmail.com
Sun Jun 27 02:12:50 EDT 2010
I am trying to add WFS to Google base layers, but failed.
The problem may be Poxyhost setting, but I am not sure...
I am just a beginner using OpenLayers. I really appreciate any help !!
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>OpenLayers: Spherical Mercator</title>
<link rel="stylesheet"
href="http://localhost:8080/geoserver/OpenLayers/theme/default/style.css"
type="text/css" />
<link rel="stylesheet" href="style.css" type="text/css" />
<script
src='http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhR_wWLPFku8Ix9i2SXYRVK3e45q1BQUd_beF8dtzKET_EteAjPdGDwqpQ'></script>
<script
src="http://localhost:8080/geoserver/OpenLayers/OpenLayers.js"></script>
<script type="text/javascript">
var map;
var geographic = new OpenLayers.Projection("EPSG:4326");
var mercator = new OpenLayers.Projection("EPSG:900913");
var wfsBounds = new OpenLayers.Bounds(-74.027, 40.684, -73.907, 40.878);
OpenLayers.IMAGE_RELOAD_ATTEMPTS = 3;
function init(){
var options = {
projection: mercator,
displayProjection: geographic,
units: "m",
numZoomLevels: 18,
maxResolution: 156543.0339,
maxExtent: new OpenLayers.Bounds(-20037508, -20037508, 20037508, 20037508)
};
map = new OpenLayers.Map('map', options);
// create Google Mercator layers
var gmap = new OpenLayers.Layer.Google(
"Google Streets",
{sphericalMercator: true}
);
var gsat = new OpenLayers.Layer.Google(
"Google Satellite",
{type: G_SATELLITE_MAP, sphericalMercator: true}
);
var ghyb = new OpenLayers.Layer.Google(
"Google Hybrid",
{type: G_HYBRID_MAP, sphericalMercator: true}
);
var wfs = new OpenLayers.Layer.Vector(" Manhattan (NY) roads",
{strategies: [new OpenLayers.Strategy.BBOX()],
protocol: new OpenLayers.Protocol.WFS({
version: "1.0.0",
url:"http://localhost:8080/geoserver/wfs",
featureType: "tiger_roads",
featureNS: "http://www.census.gov"}),
projection:geographic
})
map.addLayers([gmap, gsat, ghyb, wfs]);
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.addControl(new OpenLayers.Control.MousePosition());
map.zoomToExtent(wfsBounds.transform(geographic, mercator));
}
</script>
</head>
<body onload="init()">
<h1 id="title">OpenLayers Spherical Mercator Example</h1>
<div id="tags">
</div>
<p id="shortdesc">
Shows the use of the Spherical Mercator Layers, for overlaying
Google and wfs.
</p>
<div id="map" class="smallmap"></div>
<div id="docs">
</div>
</body>
</html>
--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Google-and-WFS-Overlay-problem-tp5227089p5227089.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list