Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am trying to overlay features from a WFS using OpenLayers, my geometries in database are in EPSG:27700 and my map's projection is EPSG:3857. My mapfile returns data in EPSG:27700.

Is there any way I can transform points into the map projection?

Here is my code which is not working.

var wfs = new OpenLayers.Layer.Vector(
            'layername',
            {
                strategies : [new OpenLayers.Strategy.BBOX()],
                protocol : new OpenLayers.Protocol.WFS({
                    url : 'proxy.php?url=xxx',
                    featureType : 'typename',
                    "geometryName": "msGeometry",
                    "featurePrefix": "ms",
                    "srsName": 'EPSG:3857',
                    "maxFeatures": 1000,
                    "version": "1.0.0"
                })                    
            }
    );
share|improve this question
    
You can create postgis view which uses ST_TRANSFORM(geom,srid) to geom column (or other way around ) –  simplexio Aug 29 '13 at 12:50
    
Thanks for your comment, I have tried using ST_Transform but unfortunately it creates a shift of 10 meters for each point. –  ARsl Aug 29 '13 at 12:59
    
it seems that your postgig db has "wrong" proj4 definitions for EPSG:27700. Easiest way is create new custom projection and use it or fix existing one in. "+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +datum=OSGB36 +units=m +no_defs" is from spatialreference.org/ref/epsg/27700/proj4 and "+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy+towgs84=446.448,-125.157,542.06,0.15,0.247,0.842,-20.489 +units=m +no_defs" is from my spatial_ref_sys table (postgis 2.0.3 r11132) (same happened 2063 vs 3857 while ago) –  simplexio Aug 30 '13 at 6:33
    
Also there is proj4js for openlayers , but that will create same transformation with same parameters –  simplexio Aug 30 '13 at 6:36
    
Thanks simplexio. its work for me :) –  ARsl Sep 2 '13 at 6:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.