[Geoserver-users] Geoserver + GoogleMaps EPSG:2170 problem

Hi,

I have geoserver on localhost and want to display Postgis data (with
geoserver WMS) over Google Maps.
I have no problems working with 4326, but when I use EPSG:2170 (Slovenia
grid) I get data at wrong geographical location (in Africa!).
There is no problem if the data is presented alone without Google Maps, but
I need it as base layer.
I tried storing the data in Point and MultyPolygon, the same happens.
I don't know there the problem is and why.

Any idea?
Here is the code I use:

            var options = {
                projection: "EPSG:900913",
            displayProjection: new OpenLayers.Projection("EPSG:2170"),
                 units: "m",
                 maxResolution: 156543.0339,
                 maxExtent: new OpenLayers.Bounds(-20037508,
-20037508,20037508, 20037508)
            };
            map = new OpenLayers.Map('map', options);
            var gmap = new OpenLayers.Layer.Google("Google
Streets",{'sphericalMercator': true});
          var canals = new OpenLayers.Layer.WMS("Canals",
"http://localhost:8080/geoserver/wms",
                    {
                        styles: '',
                        layers: 'topp:test',
                        srs: 'EPSG:2170',
                        format: 'image/gif',
                  transparent: true
                    },
                    {'reproject': true, 'opacity': 1, 'isBaseLayer': false,
singleTile: true, ratio: 1}
                );
  var usBounds = new OpenLayers.Bounds(1381064.226872, 5685386.163062,
1738789.519183, 5841929.196962);
  map.addLayers([gmap, gsat, canals]);
            map.addControl(new OpenLayers.Control.LayerSwitcher());
            map.addControl(new OpenLayers.Control.MousePosition());
            map.zoomToExtent(usBounds);

--
View this message in context: http://www.nabble.com/Geoserver-%2B-GoogleMaps-EPSG%3A2170-problem-tp20387132p20387132.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

Hi, I was the same problem, my shapes are WGS 84 UTM 14N, when I worked with google maps, they were appear in Africa, then I was change my EPSG of my shapes to 32614 and now my shapes have better reference on the map that the own ones of google danielas1 escribió:

···

Arturo Juárez Lima

Hi,

I have geoserver on localhost and want to display Postgis data (with
geoserver WMS) over Google Maps.
I have no problems working with 4326, but when I use EPSG:2170 (Slovenia
grid) I get data at wrong geographical location (in Africa!). 
There is no problem if the data is presented alone without Google Maps, but
I need it as base layer.
I tried storing the data in Point and MultyPolygon, the same happens. 
I don't know there the problem is and why.
 
Any idea?
Here is the code I use:

            var options = {
                projection: "EPSG:900913",
		        displayProjection: new OpenLayers.Projection("EPSG:2170"),
                 units: "m",
                 maxResolution: 156543.0339,
                 maxExtent: new OpenLayers.Bounds(-20037508,
-20037508,20037508, 20037508)
            };
            map = new OpenLayers.Map('map', options);
            var gmap = new OpenLayers.Layer.Google("Google
Streets",{'sphericalMercator': true});
	        var canals = new OpenLayers.Layer.WMS("Canals",
["http://localhost:8080/geoserver/wms"](http://localhost:8080/geoserver/wms),
                    {
                        styles: '',                        
                        layers: 'topp:test',
                        srs: 'EPSG:2170',
                        format: 'image/gif',
			            transparent: true
                    },
                    {'reproject': true, 'opacity': 1, 'isBaseLayer': false,
singleTile: true, ratio: 1} 
                );
	var usBounds = new OpenLayers.Bounds(1381064.226872, 5685386.163062,
1738789.519183, 5841929.196962);
	map.addLayers([gmap, gsat, canals]);
            map.addControl(new OpenLayers.Control.LayerSwitcher());
            map.addControl(new OpenLayers.Control.MousePosition());
            map.zoomToExtent(usBounds);

  

Doesn't work I tried...
--
View this message in context: http://www.nabble.com/Geoserver-%2B-GoogleMaps-EPSG%3A2170-problem-tp20387132p20388252.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

danielas1 wrote:

Hi,

I have geoserver on localhost and want to display Postgis data (with
geoserver WMS) over Google Maps.
I have no problems working with 4326, but when I use EPSG:2170 (Slovenia
grid) I get data at wrong geographical location (in Africa!). There is no problem if the data is presented alone without Google Maps, but
I need it as base layer.
I tried storing the data in Point and MultyPolygon, the same happens. I don't know there the problem is and why.
Any idea?
Here is the code I use:

            var options = {
                projection: "EPSG:900913",
            displayProjection: new OpenLayers.Projection("EPSG:2170"),
                 units: "m",
                 maxResolution: 156543.0339,
                 maxExtent: new OpenLayers.Bounds(-20037508,
-20037508,20037508, 20037508)
            };
            map = new OpenLayers.Map('map', options);
            var gmap = new OpenLayers.Layer.Google("Google
Streets",{'sphericalMercator': true});
          var canals = new OpenLayers.Layer.WMS("Canals",
"http://localhost:8080/geoserver/wms",
                    {
                        styles: '', layers: 'topp:test',
                        srs: 'EPSG:2170',
                        format: 'image/gif',
                  transparent: true
                    },
                    {'reproject': true, 'opacity': 1, 'isBaseLayer': false,
singleTile: true, ratio: 1} );
  var usBounds = new OpenLayers.Bounds(1381064.226872, 5685386.163062,
1738789.519183, 5841929.196962);
  map.addLayers([gmap, gsat, canals]);
            map.addControl(new OpenLayers.Control.LayerSwitcher());
            map.addControl(new OpenLayers.Control.MousePosition());
            map.zoomToExtent(usBounds);

I believe you may be confused about the different contexts in which the terms SRS, CRS and projection pop up.

- Because you are using Google Maps, your OpenLayers map will use EPSG:900913. You should not need a display projection parameter.
- Your data is defined in some CRS. This is the CRS that you define under the feature type configuration. Lets assume it is EPSG:X. This value depends on where the data came from and does not change.
- When you (through OpenLayers) make WMS request to GeoServer you specify ...&srs=EPSG:Y , where Y is the desired output projection. In this case it's EPSG:900913. GeoServer will reproject the data from EPSG:X to EPSG:Y on the fly.

So basically you need to make sure your feature type is configured correctly, and remove all references to EPSG:2170 below.

Hope that helps,
-Arne

--
Arne Kepp
OpenGeo - http://opengeo.org
Expert service straight from the developers

Anyway, I solve the problem by adding custom projection changing only the
PARAMETER["false_northing",0] to PARAMETER["false_northing",-50000000] in
the Slovenia Grid (srs=2170). The problem was I did not know for sure the
projection parameters so I had to try!

Thanks for your answers.
Daniela
--
View this message in context: http://www.nabble.com/Geoserver-%2B-GoogleMaps-EPSG%3A2170-problem-tp20387132p20457214.html
Sent from the GeoServer - User mailing list archive at Nabble.com.