× Forum for the GPXTrackMap Content Plugin for Joomla! 2.5 and 3.x

Creating a custum map layer

Manard replied the topic: Creating a custum map layer

7 years 4 weeks ago

Hello,

After many hours of research, I just managed to show my own maps.

Here is the syntax of the file "CustomMapLayer1.js"

map = new OpenLayers.Map("basicMap");
var newLayer = new OpenLayers.Layer.OSM("Name of the layer", "Folder link localhost or server /${z}/${x}/${y}.png", {numZoomLevels: 14});
%MAPVAR%.addLayer(newLayer);

Bernard

Please Log in to join the conversation.

Manard created the topic: Creating a custum map layer

7 years 1 month ago

Hello Frank,

I created with Global Mapper map tiles based on "Openlayers.js" like
wiki.openstreetmap.org/wiki/OpenLayers_S...e_Example#Extensions

I have this html file

<html>
  <head>
    <title>My Map Set Name</title>
    <style type="text/css">
      html, body, #basicMap {
          width: 100%;
          height: 100%;
          margin: 0;
      }
    </style>
    <script src="http://www.openlayers.org/api/OpenLayers.js"></script>
    <script>
      function init() {
        map = new OpenLayers.Map("basicMap");
        var newLayer = new OpenLayers.Layer.OSM("New Layer", "Link localhost/${z}/${x}/${y}.png", {numZoomLevels: 14});
		map.addLayer(newLayer);
		map.setCenter(new OpenLayers.LonLat(1.235,44.1278) // Center of the map
          .transform(
            new OpenLayers.Projection("EPSG:4326"), // transform from WGS 1984
            new OpenLayers.Projection("EPSG:900913") // to Spherical Mercator Projection
          ), 7 // Zoom level
        );
      }
    </script>
  </head>
  <body onload="init();">
    <div id="basicMap"></div>
  </body>
</html>
Is it possible to transcribe this code into a file CustomMapLayer1.js ?

Thank you for your help

Bernard

Last edit: 7 years 1 month ago by Manard.

Please Log in to join the conversation.

Powered by Kunena Forum