[Geoserver-users] British National Grid to Google projection problem

Hi every one,

here is the scenario

I have an Ubuntu server, tomcat runing on it, and the geoserver web
application.
I also have posgresql and opengis running in the same box.
together with a nice set of shapefiles.

I transfer the shapefile to an sql script file. using shp2psql command.
shp2pgsql -s 27700 myfile.shp mytable > myfile.sql

next I execute the script and load the database with the information
psql -f myfile.sql -d mydb

add schema, add data source (mydb)
Then open geoserver config>data>FeatureType = add new feature from
datasource

again, add SRS number 27700, generate bouding box, after adding style
...sumit, apply and save

check demo, open layer succesfully shows myMap...

Now change demo using openLayers and with the Google map as a background

            var gsat = new OpenLayers.Layer.Google(
                "Google Sattelite",
                {type: G_SATELLITE_MAP, 'sphericalMercator': true}
            );

add my layer

             //create WMS layer
             var mylayer = new OpenLayers.Layer.WMS(
                "My Layer",
                "http://127.0.0.1/geoserver/wms?",
                {
                   layers: 'myns:mymap',
                   styles: '',
                   srs: 'EPSG:27700', //again!!
       format: 'image/png',
                   tiled: 'true',
                   tilesOrigin : "143.60260815000004,-43.851764249999995",
                   transparent: true
                },
                {
                    'opacity': 0.75, 'isBaseLayer': false, 'wrapDateLine':
true
                }
            );

Excelent! I can see my (polylines) map on screen... old on a second, (zoom
in closer) they it is a bit shifted (around 100 meters). Provably it didnt
calculate the curve of the earth ... (?)

Check on nabble and other forums, I only found very confusing information.

Does any one know what is the problem? ( and how to solve it )

many thanks in advance.

--
View this message in context: http://www.nabble.com/British-National-Grid-to-Google-projection-problem-tp22785551p22785551.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

hinzsa ha scritto:

Hi every one,

here is the scenario

I have an Ubuntu server, tomcat runing on it, and the geoserver web
application.
I also have posgresql and opengis running in the same box.
together with a nice set of shapefiles.

I transfer the shapefile to an sql script file. using shp2psql command.
shp2pgsql -s 27700 myfile.shp mytable > myfile.sql

next I execute the script and load the database with the information
psql -f myfile.sql -d mydb

add schema, add data source (mydb)
Then open geoserver config>data>FeatureType = add new feature from
datasource

again, add SRS number 27700, generate bouding box, after adding style
...sumit, apply and save

check demo, open layer succesfully shows myMap...

Now change demo using openLayers and with the Google map as a background

            var gsat = new OpenLayers.Layer.Google(
                "Google Sattelite",
                {type: G_SATELLITE_MAP, 'sphericalMercator': true}
            );

add my layer

             //create WMS layer
             var mylayer = new OpenLayers.Layer.WMS(
                "My Layer",
                "http://127.0.0.1/geoserver/wms?",
                {
                   layers: 'myns:mymap',
                   styles: '',
                   srs: 'EPSG:27700', //again!!
       format: 'image/png',
                   tiled: 'true',
                   tilesOrigin : "143.60260815000004,-43.851764249999995",
                   transparent: true
                },
                {
                    'opacity': 0.75, 'isBaseLayer': false, 'wrapDateLine':
true
                }
            );

Excelent! I can see my (polylines) map on screen... old on a second, (zoom
in closer) they it is a bit shifted (around 100 meters). Provably it didnt
calculate the curve of the earth ... (?)

First off, by changing the projection you invalidated the tilesOrigin
parameter, better remove it from your request above.
If the problem still occurs, you should check if the Bursa-Wolf parameters for you projection are actually "good" for the area that
you're trying to work into. For example in Italy we have 3 sets of
them, but GeoServer does not offer a choice, and you have to
override that using the epsg_overrides.properties file (same format
as the epsg.properties file already found in the data directories,
but the WKT definitions that you insert there will override the
official EPSG database definition).

Cheers
Andrea

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