Time for action – adding a GeoServer layer as a base layer
One lesser-known method allows you to use a GeoServer layer as a base layer with Google Maps, even without a Google Map layer. This example shows you how to use a GeoServer layer as a base layer:
Open your browser and point it to
http://localhost:8080/chapter7/index.html
.Then open GeoServer as the base layer link:
Now look at the
map.js
file. It is very similar to that of the previous sample, but in this case we are creatingcustommap
and we are passing the GeoServer's layer when creating themap
object and an overlay://custom base layer options var maptypeOptions = { getTileUrl: function(coord, zoom) { var lULP = new google.maps.Point(coord.x*256,(coord.y+1)*256); var lLRP = new google.maps.Point((coord.x+1)*256,coord.y*256); var projectionMap = new MercatorProjection(); var lULg = projectionMap.fromDivPixelToSphericalMercator(lULP, zoom); var lLRg...