Jump to content
Sign in to follow this  

Vatsim map leaflet problem

Recommended Posts

I make a simple VATSIM card and have a problem. It is impossible to output an array of all coordinates, now only one is displayed.

<h3 id="example">Example:</h3>

<link rel="stylesheet" href="https://unpkg.com/leaflet@1.0.1/dist/leaflet.css" />

<script src="https://unpkg.com/leaflet@1.0.1/dist/leaflet.js"></script>

<div id="map" style="width: 800px; height: 400px"> </div>
<script src="http://code.jquery.com/jquery-2.0.3.min.js"> </script>

//var map = L.map('map').setView([0,0], 2);
var map = L.map('map', {
  'center': [48.11815, 16.55964],
  'zoom': 3,
  'layers': [
    L.tileLayer('http://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png', {
      attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://cartodb.com/attributions">CartoDB</a>'

function moveISS (data) {
function(data) {
data.forEach(function(item, index) {
        var lat = item.latitude;
        var lon = item.longitude;
		 iss.setLatLng([lat, lon]);
        isscirc.setLatLng([lat, lon]);
        map.panTo([lat, lon], animate=true);

       // iss.setLatLng([lat, lon]);
       // isscirc.setLatLng([lat, lon]);
       // map.panTo([lat, lon], animate=true);
    setTimeout(moveISS, 10000); 

var ISSIcon = L.icon({
    iconUrl: 'http://open-notify.org/Open-Notify-API/map/ISSIcon.png',
    iconSize: [50, 30],
    iconAnchor: [25, 15],
    popupAnchor: [50, 25],
    shadowUrl: 'http://open-notify.org/Open-Notify-API/map/ISSIcon_shadow.png',
    shadowSize: [60, 40],
    shadowAnchor: [30, 15]

var iss = L.marker([0, 0], {icon: ISSIcon}).addTo(map);
var isscirc = L.circle([0,0], 2200e3, {color: "#c22", opacity: 0.3, weight:1, fillColor: "#c22", fillOpacity: 0.1}).addTo(map); 



Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this