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 searching a solution for this problem for a long time (2 weeks) and i could not find any thing that solved my problem:

I am building a map application that i need to show some features (points and lines) on OSM background. I am getting the data with both GeoServer for WMS layer and with KML files and I am displaying them on the map.

my problem is that the layers are moving little bit from the place its have to be. examples: WMS vector layer: WMS KML vector layer: KML

the projection of the map is google projection. in the KML is wgs, and in WMS its ITM (israel TM). WMS layer code:

            format = 'image/png';
        var streets = new OpenLayers.Layer.WMS(
                "רחובות", "http://localhost:8080/geoserver/cite/wms",
                { "transparent": "true",
                    LAYERS: 'cite:entities_Layer__streets',
                    STYLES: '',
                    format: format,
                    tiled: true,
                    reproject: true,
                    tilesOrigin: map.maxExtent.left + ',' + map.maxExtent.bottom
                },
                {
                    buffer: 0,
                    isBaseLayer: false,
                    displayOutsideMaxExtent: true,
                    yx: { 'EPSG:2039': false }
                }
            );

KML layer code:

            var midshaha = new OpenLayers.Layer.Vector("KML layer", {
            sphericalMercator: true,
            projection: wgs,
            style: teuraStyle,
            strategies: [new OpenLayers.Strategy.Fixed()],
            protocol: new OpenLayers.Protocol.HTTP({
                url: "kml/midshaha.kml",
                format: new OpenLayers.Format.KML({
                    extractStyles: true,
                    extractAttributes: true,
                    maxDepth: 2
                })
            })
        });

Map code:

 map = new OpenLayers.Map({
            div: 'map',
            units: 'm',
            maxExtent: bounds,
            maxResolution: 22.342270169465337,
            projection: proj900913,
            numZoomLevels: 20,
            displayProjection: ITM,
            controls: [
        new OpenLayers.Control.TouchNavigation({
            dragPanOptions: {
                enableKinetic: true
            }
        }),
        new OpenLayers.Control.Zoom(),
        new OpenLayers.Control.Navigation(),
                   new OpenLayers.Control.ScaleLine(),
                   new OpenLayers.Control.MousePosition(),
                   new OpenLayers.Control.Attribution(),
                   new OpenLayers.Control.LayerSwitcher()..............

I have been told that maybe the problem its that the conversion beetwen the projections is making this shifting, but i belive that there is a solution for it. I hope someone know what can be the problem, i will be really greatfull, thanks.

share|improve this question
add comment

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.