[OpenLayers-Users] vectors atop of GoogleMaps in FF

Eric Lemoine eric.c2c at gmail.com
Sat Feb 23 07:42:52 EST 2008


On Sat, Feb 23, 2008 at 3:16 AM, bradleyspencer <brad at cubewerx.com.au> wrote:
>
>
>
>
> I have a situation where I do a WFS request against a remote server and
> successfully return geometry in EPSG: 4326. When I then plot these
> (highlighted objects) on a vector layer on top of GoogleMaps (and VE and
> MultiMap) they are aligned with the base map in IE but NOT in FF. If I swap
> the base to a base that was built in EPSG: 4326 there is no problem in
> either browser.
>
>
>
> I assume this is due to the different plotting software used in each browser
> in that one supports reprojecting in the client and the other does not
> (maybe?).
>
>
>
> Anyway, does any one have a suggestion as to what my options are to remedy
> this problem?

Hi Brad

If you're to display vector geometries atop a google layer, you'll
need to use SphericalMercator - see
<http://trac.openlayers.org/wiki/SphericalMercator>. With that,
features in the EPSG:900913 projection should align well with the
google layer.

If your WFS serves features in the EPSG:4326 projection, reprojection
from EPSG:4326 to EPSG:900913 will be required for the features. To
get OpenLayers to do that reprojection you just need to specify a
different projection for your WFS layer (EPSG:4326) than that of the
map (EPSG:900913). Something along these lines:

var wfs = new OpenLayers.Layer.WFS('wfs', url, {typename: 'name'},
{projection: 'EPSG:4326'});

 Hope this helps,

--
Eric



More information about the Users mailing list