Hello,
i looking to show a ShapeFile on a Google Maps with GeoServer WMS functionality.
I have code that gets tiles from GeoServer but i can not find the right way to calculate the bbox for the WMS url.
I can get out with Google Maps a Latitude and Longitude boundingbox values, here is one example:
BBOX=5.625,55.7765730186677,8.4375,57.32652122521709
But when i trying the “Layer Preview” and shows the shapefile with OpenLayer i finds in the calls to GeoServer the BBOX is like this:
BBOX=1562483.09425,2004362.9156249,1563547.292875,2005427.1142499
The “Native SRS” is set to “UNKOWN” on the Layer settings but on the right side its says “World_Mercator” that i know the projection for ShapeFile is and the “Declared SRS” is set to “EPSG:3395” whish says on the right side: “EPSG:WGS 84 / World Mercator”.
I know my BBOX i get from Google Maps is WGS84 position but how do i calculate this to be “World_Mercator”.
I even try to change in GeoServer to run WGS84 as SRS but then i get almost the same BBOX as when i running it like “World_Mercator”.
Someone has idea or code for this?
// Rickard
On Wed, Nov 3, 2010 at 9:08 AM, Rickard Pettersson
<rickard.pettersson@anonymised.com> wrote:
Hello,
i looking to show a ShapeFile on a Google Maps with GeoServer WMS
functionality.
I have code that gets tiles from GeoServer but i can not find the right way
to calculate the bbox for the WMS url.
I can get out with Google Maps a Latitude and Longitude boundingbox values,
here is one example:
BBOX=5.625,55.7765730186677,8.4375,57.32652122521709
But when i trying the "Layer Preview" and shows the shapefile with OpenLayer
i finds in the calls to GeoServer the BBOX is like this:
BBOX=1562483.09425,2004362.9156249,1563547.292875,2005427.1142499
The "Native SRS" is set to "UNKOWN" on the Layer settings but on the right
side its says "World_Mercator" that i know the projection for ShapeFile is
and the "Declared SRS" is set to "EPSG:3395" whish says on the right side:
"EPSG:WGS 84 / World Mercator".
I know my BBOX i get from Google Maps is WGS84 position but how do i
calculate this to be "World_Mercator".
I even try to change in GeoServer to run WGS84 as SRS but then i get almost
the same BBOX as when i running it like "World_Mercator".
You need to find out what the projection of your shapefile is and set
that in the declared projection/SRS box.
Once you have done this you then need to calculate what your required
map bounds are in EPSG:900913 (the Google Maps Projection) - of the
ones above 1562483.09425,2004362.9156249,1563547.292875,2005427.1142499
looks most plausible (big numbers are what you are looking for as
Google measures in meters from the equator/Greenwich meridian) to use
in your WMS request.
Ian
--
Ian Turton