Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have KML files (EPSG:4326) and a background map I made using EPSG:2039 projection (mandatory).

When I try reprojecting the KMLs to show in EPSG:2039 I don't succeed and still they don't appear on the map. Only when manually projecting everything to EPSG:4326 its working (But I need to be in EPSG:2039 for the client)

 init: function () {

    var transperantLayers = ["kml1", "kml2", "kml3"];

    var P2039 = new OpenLayers.Projection("EPSG:2039");
    var P4326 = new OpenLayers.Projection("EPSG:4326");

    var activeProjection = P2039;


    var options = {
        maxExtent: new OpenLayers.Bounds(-20037508, -20037508, 20037508, 20037508.34),
        projection: activeProjection,
        displayProjection: P4326

    var map = new OpenLayers.Map("map", options);

    var base = new OpenLayers.Layer.MapInfoRESTHandler("Background", "MapTileServer",
                            { mapname: "Background", output: 'image/png', tileType: 'MBR', transparent: false },
                            { isBaseLayer: true, buffer: 1, transitionEffect: 'resize' });


    for (var i = 0; i < transperantLayers.length; i++) {
        var layer = new OpenLayers.Layer.Vector(transperantLayers[i], {
            projection: map.projection,
            strategies: [new OpenLayers.Strategy.Fixed()],
            protocol: new OpenLayers.Protocol.HTTP({
                url: "KMLs/" + transperantLayers[i] + ".KML",
                format: new OpenLayers.Format.KML({
                    extractStyles: true,
                    extractAttributes: true

    map.addControl(new OpenLayers.Control.LayerSwitcher());
    map.addControl(new OpenLayers.Control.PanZoomBar());
    map.addControl(new OpenLayers.Control.ScaleLine());
    map.addControl(new OpenLayers.Control.MousePosition());

    map.setCenter(new OpenLayers.LonLat(220000, 632000), 9);        


I've also tried instead of :

projection: map.projection

doing :

projection: map.displayProjection

but still no luck... not seeing the KMLs.

Help will be appreciated.

share|improve this question
up vote 1 down vote accepted

Problem solved: I just noticed there wasnt epsg2039.js file in the def directory. I've added it and now it works.

share|improve this answer

Your Answer


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.