[Geoserver-users] Problem with shape loaded from postgis

Hello everyone
I have a problem with uploading files to PostGIS shape.
Loading my shape files directly on Geoserver see that as using openlayer wms layer on a base map for google maps, it is exactly superimposed coordinates in value;

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

unesco = new OpenLayers.Layer.WMS(
“TOPP unesco”,
http://localhost:8080/geoserver/wms?”,
{
layers: ‘topp:unesco’,
styles: ‘’,
srs: ‘EPSG:4326’,
format: ‘image/png’,
tiled: ‘true’,
tilesOrigin : “143.60260815000004,-43.851764249999995”,
transparent: true
},
{
‘opacity’: 0.75, ‘isBaseLayer’: false, ‘wrapDateLine’: true,
}
};

hand, if the shape file on the first load PostGIS
with this sintax : shp2pgsql shape\unesco.shp unesco > unesco.sql
then the levy should Geoserver, the wms layer no longer appears in the same coordinates but is translated into another coordinate and shown only at a low level of zoom

I can not understand why each of the two wms layer (that is loaded from PostGIS, either directly shp files) are displayed in the DEMO of Geoserver with the same coordinates and the same scale

Marcello Brunaldi ha scritto:

Hello everyone
I have a problem with uploading files to PostGIS shape.
Loading my shape files directly on Geoserver see that as using openlayer wms layer on a base map for google maps, it is exactly superimposed coordinates in value;

var myBaseLayer = new OpenLayers.Layer.Google("Google",
            {
              'sphericalMercator': true,
              'maxExtent': new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34)
              });

unesco = new OpenLayers.Layer.WMS(
                "TOPP unesco",
                "http://localhost:8080/geoserver/wms?",
                {
                   layers: 'topp:unesco',
                   styles: '',
                   srs: 'EPSG:4326',
                   format: 'image/png',
                   tiled: 'true',
                   tilesOrigin : "143.60260815000004,-43.851764249999995",
                   transparent: true
                }, {
                    'opacity': 0.75, 'isBaseLayer': false, 'wrapDateLine': true, }
};

hand, if the shape file on the first load PostGIS
with this sintax : **shp2pgsql shape\unesco.shp unesco > unesco.sql**
then the levy should Geoserver, the wms layer no longer appears in the same coordinates but is translated into another coordinate and shown only at a low level of zoom

I can not understand why each of the two wms layer (that is loaded from PostGIS, either directly shp files) are displayed in the DEMO of Geoserver with the same coordinates and the same scale

First off, remove tilesOrigin, as that is no more a valid value
for the origins of one of the displayed tiles, since you changed
the projection.
Second, I don't think you're reprojecting the unesco layer.
Try setting srs: 'EPSG:900913' among its parameters

Cheers
Andrea

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

Marcello Brunaldi wrote:

Hello everyone
I have a problem with uploading files to PostGIS shape.
Loading my shape files directly on Geoserver see that as using openlayer
wms
layer on a base map for google maps, it is exactly superimposed
coordinates
in value;

var myBaseLayer = new OpenLayers.Layer.Google("Google",
            {
              'sphericalMercator': true,
              'maxExtent': new
OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34)
              });

unesco = new OpenLayers.Layer.WMS(
                "TOPP unesco",
                "http://localhost:8080/geoserver/wms?",
                {
                   layers: 'topp:unesco',
                   styles: '',
                   srs: 'EPSG:4326',
                   format: 'image/png',
                   tiled: 'true',
                   tilesOrigin : "143.60260815000004,-43.851764249999995",
                   transparent: true
                },
                {
                    'opacity': 0.75, 'isBaseLayer': false, 'wrapDateLine':
true,
                }
};

hand, if the shape file on the first load PostGIS
with this sintax : *shp2pgsql shape\unesco.shp unesco > unesco.sql*

Hi,
I think you shoud use the -s flag with shp2pgsql to specify your SRID. ( i.
-s 4326).
Is the postgis data woking using a Desktop Client ?

Bye

Luca Casagrande
--
View this message in context: http://www.nabble.com/Problem-with-shape-loaded-from-postgis-tp21996921p21997922.html
Sent from the GeoServer - User mailing list archive at Nabble.com.