[Geoserver-users] Problem with marker Georss on Google maps base layer

I have a problem with the display of the marker layer, because the coordinates do not match
this is my code:

function init()
{
options={
projection: new OpenLayers.Projection(“EPSG:900913”),
displayProjection: new OpenLayers.Projection(“EPSG:4326”),
numZoomLevels:18,
units: “m”,
maxResolution: 156543.0339,
maxExtent: new OpenLayers.Bounds(-20037508, -20037508,20037508, 20037508)
};

map = new OpenLayers.Map(‘map’, options);

var myBaseLayer = new OpenLayers.Layer.Google(“Google”,
{
‘sphericalMercator’: true,
‘maxExtent’: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34)
});

new1[0] = new OpenLayers.Layer.GeoRSS( ‘GeoRSS’, ‘georss/blu.xml’, {‘icon’:color[0]} );
new1[1] = new OpenLayers.Layer.GeoRSS( ‘GeoRSS’, ‘georss/rosso.xml’, {‘icon’:color[1]} );
new1[2] = new OpenLayers.Layer.GeoRSS( ‘GeoRSS’, ‘georss/verde.xml’, {‘icon’:color[2]} );
new1[3] = new OpenLayers.Layer.GeoRSS( ‘GeoRSS’, ‘georss/giallo.xml’, {‘icon’:color[3]} );
new1[4] = new OpenLayers.Layer.GeoRSS( ‘GeoRSS’, ‘georss/marrone.xml’, {‘icon’:color[4]} );
new1[5] = new OpenLayers.Layer.GeoRSS( ‘GeoRSS’, ‘georss/arancio.xml’, {‘icon’:color[5]} );
new1[6] = new OpenLayers.Layer.GeoRSS( ‘GeoRSS’, ‘georss/celeste.xml’, {‘icon’:color[6]} );
new1[7] = new OpenLayers.Layer.GeoRSS( ‘GeoRSS’, ‘georss/viola.xml’, {‘icon’:color[7]} );

map.addLayers([myBaseLayer,unesco]);

for (n=0; n < 8; n++)
{
map.addLayer(new1[n]);
}

map.addControl(new OpenLayers.Control.LayerSwitcher());
loadsetmap();
map.addControl(new OpenLayers.Control.Permalink());
map.addControl(new OpenLayers.Control.MousePosition());
}

  • I build the GeoRSS xml file, drawing from PostGIS database coordinates “SELECT ST_AsText (the_geom)”

  • The shape is inserted into the database type utm32 ED50.

  • when loading from the same PostGIS database file in Geoserver, the wms layer perfectly see that on the map!

Marcello Brunaldi ha scritto:

I have a problem with the display of the marker layer, because the coordinates do not match
this is my code:

function init()
{ options={
                projection: new OpenLayers.Projection("EPSG:900913"),
                displayProjection: new OpenLayers.Projection("EPSG:4326"),
                numZoomLevels:18,
                units: "m",
                maxResolution: 156543.0339,
                maxExtent: new OpenLayers.Bounds(-20037508, -20037508,20037508, 20037508)
            };
             map = new OpenLayers.Map('map', options);
               var myBaseLayer = new OpenLayers.Layer.Google("Google",
              {
              'sphericalMercator': true,
              'maxExtent': new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34)
              });

    new1[0] = new OpenLayers.Layer.GeoRSS( 'GeoRSS', 'georss/blu.xml', {'icon':color[0]} );
    new1[1] = new OpenLayers.Layer.GeoRSS( 'GeoRSS', 'georss/rosso.xml', {'icon':color[1]} );
    new1[2] = new OpenLayers.Layer.GeoRSS( 'GeoRSS', 'georss/verde.xml', {'icon':color[2]} );
    new1[3] = new OpenLayers.Layer.GeoRSS( 'GeoRSS', 'georss/giallo.xml', {'icon':color[3]} );
    new1[4] = new OpenLayers.Layer.GeoRSS( 'GeoRSS', 'georss/marrone.xml', {'icon':color[4]} );
    new1[5] = new OpenLayers.Layer.GeoRSS( 'GeoRSS', 'georss/arancio.xml', {'icon':color[5]} );
    new1[6] = new OpenLayers.Layer.GeoRSS( 'GeoRSS', 'georss/celeste.xml', {'icon':color[6]} );
    new1[7] = new OpenLayers.Layer.GeoRSS( 'GeoRSS', 'georss/viola.xml', {'icon':color[7]} );

    map.addLayers([myBaseLayer,unesco]);
       for (n=0; n < 8; n++)
    {
        map.addLayer(new1[n]);
    }

    map.addControl(new OpenLayers.Control.LayerSwitcher());
    loadsetmap();
    map.addControl(new OpenLayers.Control.Permalink());
    map.addControl(new OpenLayers.Control.MousePosition()); }

- I build the GeoRSS xml file, drawing from PostGIS database coordinates "SELECT ST_AsText (the_geom)"
- The shape is inserted into the database type utm32 ED50.
- when loading from the same PostGIS database file in Geoserver, the wms layer perfectly see that on the map!

So GeoServer works, but your custom setup not using GeoServer does not?
Sorry, but this does not look like a question for the GeoServer users
list, as you're not really using it.

My guess is that you're having some reprojection issue, but I don't know
where. Last time I checked the GeoRSS specification mandated the
usage of WGS84 coordinates, did you convert your ED50 ones into
WGS84? Also, you might have precision errors in the conversion
between ED50 and WGS84 (if that is happening you're probably
seeing a 50-100 meters displacement, not more).

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.