ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Map Snippets

by newsroomdev ALL

A set of custom web mapping snippets for Sublime Text 2/3

Labels snippets

Details

  • 2015.10.06.18.12.21
  • github.​com
  • github.​com
  • 9 years ago
  • 45 minutes ago
  • 11 years ago

Installs

  • Total 717
  • Win 498
  • Mac 130
  • Linux 89
Jan 21 Jan 20 Jan 19 Jan 18 Jan 17 Jan 16 Jan 15 Jan 14 Jan 13 Jan 12 Jan 11 Jan 10 Jan 9 Jan 8 Jan 7 Jan 6 Jan 5 Jan 4 Jan 3 Jan 2 Jan 1 Dec 31 Dec 30 Dec 29 Dec 28 Dec 27 Dec 26 Dec 25 Dec 24 Dec 23 Dec 22 Dec 21 Dec 20 Dec 19 Dec 18 Dec 17 Dec 16 Dec 15 Dec 14 Dec 13 Dec 12 Dec 11 Dec 10 Dec 9 Dec 8
Windows 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0
Mac 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Linux 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Readme

Source
raw.​githubusercontent.​com

Sublime Text Web Mapping Snippets

Work in progress.

Type the snippet shortcode and then press Tab to complete the snippet. Each shortcut provides a basic HTML page skeleton for the latest version of popular JavaScript mapping APIs.

The snippets are listed below in alphabetical order. The '$1' indicates the position of the caret/s. Any snippet that has a $1/$2/$3/etc. uses this technique. Pressing tab will cycle you through these positions.

Feel free to expand upon these snippets as you please.


gmaps

<!DOCTYPE html>
<html>
  <head>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
    <style type="text/css">
      html { height: 100% }
      body { height: 100%; margin: 0; padding: 0 }
      #map-canvas { height: 100% }
    </style>
    <script type="text/javascript"
      src="https://maps.googleapis.com/maps/api/js?key=$1&sensor=$2">
    </script>
  </head>
  <body>
    <div id="map-canvas"/>
    <script type="text/javascript">
      function initialize() {
        var map = new google.maps.Map(document.getElementById("map-canvas");
      }
      google.maps.event.addDomListener(window, 'load', initialize);
    </script>
  </body>
</html>

leaflet

<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>$1</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
  <script src="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.js"></script>
  <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.css" />
  <style type="text/css">
    body { margin:0; padding:0; }
    #map { position:absolute; top:0; bottom:0; width:100%; }
  </style>
</head>
<body>
  <div id="map"></div>
  <script>
    var map = L.map('map');
    L.tileLayer('http://{s}.tile.cloudmade.com/{key}/{styleId}/256/{z}/{x}/{y}.png', {
        key: $2,
        styleId: "997",
        attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="http://cloudmade.com">CloudMade</a>'
    }).addTo(map);
    $3
  </script>
</body>
</html>

mapbox

<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>$1</title>
  <meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no' />
  <script src='//api.tiles.mapbox.com/mapbox.js/v1.6.0/mapbox.js'></script>
  <link href='//api.tiles.mapbox.com/mapbox.js/v1.6.0/mapbox.css' rel='stylesheet' />
  <style>
    body { margin:0; padding:0; }
    #map { position:absolute; top:0; bottom:0; width:100%; }
  </style>
</head>
<body>
  <div id="map"></div>
  <script type="text/javascript">
    var map = L.mapbox.map('map', 'examples.map-9ijuk24y');
    $2
  </script>
</body>
</html>

ol3 (OpenLayers 3) “html <!doctype html>

.map { height: 400px; width: 100%; } adsadas