New map javascript

Here is an example of how to create a new map using JavaScript:

Using Google Maps

function initMap() {
  var map = new google.maps.Map(document.getElementById('map'), {
    center: {lat: 40.7128, lng: -74.0060},
    zoom: 12
  });
}

In this example, we create a new Google Map object and pass it an HTML element (#map) to render the map in. We also set the center of the map to New York City and the zoom level to 12.

Using Leaflet

var map = L.map('map').setView([40.7128, -74.0060], 12);

L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  attribution: '&copy; <a rel="nofollow" target="_blank" href="https://www.openstreetmap.org/">OpenStreetMap</a>',
  subdomains: ['a', 'b', 'c']
}).addTo(map);

In this example, we create a new Leaflet map object and set the center of the map to New York City and the zoom level to 12. We also add a tile layer to the map using OpenStreetMap tiles.

Using Mapbox

mapboxgl.accessToken = 'YOUR_MAPBOX_ACCESS_TOKEN';
var map = new mapboxgl.Map({
  container: 'map', // container id
  style: 'mapbox://styles/mapbox/streets-v11', // style URL
  center: [-74.0060, 40.7128], // starting position [lng, lat]
  zoom: 12 // starting zoom
});

In this example, we create a new Mapbox map object and set the center of the map to New York City and the zoom level to 12. We also set the style of the map to the "Streets" style.

Common attributes

Note: You will need to replace YOUR_MAPBOX_ACCESS_TOKEN with your actual Mapbox access token.