Sha256: 4d6dec311e59118a1cd093526cb7d8089b7f78653f4595be0659d6144c692144

Contents?: true

Size: 1.57 KB

Versions: 2

Compression:

Stored size: 1.57 KB

Contents

var <%= to_varname "track_", @filename %> =
{ "type": "FeatureCollection",
  "features": [
      { "type": "Feature",
        "geometry": {
            "type": "LineString",
            "coordinates": [
                <%= @track.range.each.map { |i| @track[i].lon_lat.to_s }.join(",") %>
            ]
        },
        "properties": {
            "name": "<%= @filename %>"
        }
      },

      <% [:first, :last].each do |x| %>
      { "type": "Feature",
        "geometry": {
            "type": "Point",
            "coordinates": <%= @track.send(x).lon_lat %>
        },
        "properties": {
            "name": "<%= x.to_s + " point" %>"
        }
      },
      <% end %>

      <% [:max_speed, :max_height, :min_height].each do |x| %>
      { "type": "Feature",
        "geometry": {
            "type": "Point",
            "coordinates": <%= @track[@track.send(x.to_s + "_idx")].lon_lat %>
        },
        "properties": {
            "name": "<%= x.to_s %>: <%= @track.send(x) %>"
        }
      },
      <% end %>
  ]
};

<%= to_leaflet_layername @filename %> = L.geoJson(<%= to_varname "track_", @filename %>, {
    onEachFeature: function onEachFeature(feature, layer) {
        if (feature.properties && feature.properties.name) {
            layer.bindPopup(feature.properties.name);
        }
    },
    /*
    pointToLayer: function (feature, latlng) {
	return L.circleMarker(latlng, {
	    radius: 8,
	    fillColor: "#ff7800",
	    color: "#000",
	    weight: 1,
	    opacity: 1,
	    fillOpacity: 0.8
	});
    }
    */
});
    <%= to_leaflet_layername @filename %>.addTo(map);

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
columbus3-0.5.1 lib/html/track.js.erb
columbus3-0.5.0 lib/html/track.js.erb