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.

My page contains two layers: 1. Open Street Map as a basic layer and WMS layer from mapserver as a overlay layer. My map show this two layers but in a wrong position. I spent a lot of time trying everything but it doesn't work. I changed mapfile and file to EPSG4326 projection but it doesn't work to. This is my mapfile

MAP
IMAGETYPE   "png24"
EXTENT     20.682299 52.148211 21.078846 52.337025
UNITS DD
SHAPEPATH "C:\ms4w\Apache\htdocs\projekt3\dane"
SIZE 800 600
DEBUG ON
FONTSET "C:\ms4w\Apache\fonts\fonts.txt"
PROJECTION
'proj=longlat'
'datum=WGS84'
'no_defs'
END
IMAGECOLOR 255 255 255
IMAGEQUALITY 95
IMAGETYPE png

OUTPUTFORMAT
NAME png
DRIVER 'GD/PNG'
MIMETYPE 'image/png'
IMAGEMODE RGBA
EXTENSION 'png'
END

SYMBOL
NAME "circle"
FILLED true
TYPE ellipse
POINTS 1 1 END
END



LAYER

NAME kilometraz_popr
DATA kilometraz_popr
STATUS ON
DUMP false
TYPE POINT
TRANSPARENCY 100
 EXTENT 458986.052854 392913.684787 757412.357297 535008.411398
PROJECTION
'proj=tmerc'
'lat_0=0'
'lon_0=19'
'k=0.9993'
'x_0=500000'
'y_0=-5300000'
'ellps=GRS80'
'towgs84=0,0,0,0,0,0,0'
'units=m'
'no_defs'
END
CLASS
    STYLE
     SYMBOL "circle" 
     SIZE 7.0 
     OUTLINECOLOR 0 0 0
     COLOR 90 23 223
    END 
END
END

LAYER

NAME etykiety
DATA kilometraz_popr
STATUS ON
TYPE annotation
PROJECTION
  "init=epsg:2180"
END
LABELITEM OPIS_KM
TRANSPARENCY alpha
CLASS
    LABEL
        COLOR    0  0  0
        FONT  arial
        #BACKGROUNDCOLOR 255 255 255
        ENCODING "CP1250"
        TYPE  truetype
        SIZE  7
        POSITION  AUTO
        PARTIALS  FALSE
        BUFFER  5
        OUTLINECOLOR  255  255  255
        ANTIALIAS true
    END 
END
END
END

My index.html file is below:

<html lang='pl'>
<head>
<meta charset='utf-8' />
<title>Wawa</title>
<script type='text/javascript' src='OpenLayers.js'></script>
<script src="proj4js-combined.js"></script> 
<script type='text/javascript'>
var map;
function init() {
        epsg4326 = new OpenLayers.Projection("EPSG:4326");
        epsg900913 = new OpenLayers.Projection("EPSG:900913");
        epsg2180 = new OpenLayers.Projection("EPSG:2180");
var option = {
    projection: new OpenLayers.Projection("EPSG:900913"),
    displayProjection: new OpenLayers.Projection("EPSG:4326")
};
       map = new OpenLayers.Map('mapa', option);

olmapnik = new OpenLayers.Layer.OSM("OpenStreetMap Mapnik",    "http://tile.openstreetmap.org/${z}/${x}/${y}.png");
map.addLayer(olmapnik);
map.setBaseLayer(olmapnik);    


var warstwa_wektor = new OpenLayers.Layer.MapServer("OpenLayers Mapserver", "http://localhost/cgi-bin/mapserv.exe", {map: 'C:/ms4w/map/map_test1.map', layers: 'kilometraz_popr', srs:'EPSG:4326', projection:epsg900913,
isBaseLayer: false,
    visibility: true, transparent: true, format:'image/png'}, {opacity: 1});
map.addLayer(warstwa_wektor);

map.addControl
(new OpenLayers.Control.Scale());
map.addControl(new OpenLayers.Control.Navigation());
map.addControl(new OpenLayers.Control.MousePosition());
map.addControl(new OpenLayers.Control.PanZoomBar());
map.addControl(new OpenLayers.Control.SelectFeature());
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.addControl(new OpenLayers.Control.Permalink());

extent = new OpenLayers.Bounds(19.50,51.50,21.50,52.7).transform(new  OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:900913"));
map.zoomToExtent(extent,5);
}

</script>
</head>

<body onload='init();'>
<div id='mapa' style='width: 800px; height: 400px;'>
</div>
</body>
</html>

Please tell you me my mistake.


Yes I know what I should do. I really greatfull for your yelp. My main mistake was projection. I use 3857 and everything works. Thank you very much

share|improve this question

1 Answer 1

Ah, the old EPSG:900913 code... this was never a legitimate EPSG code.

The code you're looking for is EPSG:3857 which is the latest WGS84 Web/Pseudo-Mercator. Switch the 900913 to 3857 and make sure your proj4 library is up to date.

edit: Also remember that the default unit of measure for EPSG:3857 is XYs, whereas EPSG:4326 is a geographic projection with a lat/long unit of measure.

share|improve this answer
    
I think it is EPSGL 3875. I tried this but it doesn't work. –  Slawek Jakubiuk Apr 16 '13 at 22:47
    
Ihank you for your response. Yes I know. But it is important only in measure. Am I right? –  Slawek Jakubiuk Apr 16 '13 at 22:54
    
"C:\ms4w\Apache\htdocs\projekt3\dane" <-- This is in EPSG:4326 -- DATA kilometraz_popr <-- This is in EPSG:2180 -- OpenStreetMap is usually in EPSG:3857 –  Mintx Apr 16 '13 at 22:54
    
Yes I know but I thought that data in 2180 is transforming to 4326 by mapserver and then to 3857 by openlayers. So what should I do? –  Slawek Jakubiuk Apr 17 '13 at 11:11
    
I know I can transform in qgis oryginal data to 3857 and it will be ok but without it can I do something? –  Slawek Jakubiuk Apr 17 '13 at 11:28

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.