main.html 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. {% extends "panorama/base.html" %}
  2. {% load panorama_url %}
  3. {% load distance_filter %}
  4. {% block top-menu-title %}
  5. <a class="navbar-brand" href="{% url 'panorama:main' %}">Celutz</a>
  6. {% endblock %}
  7. {% block top-menu-items %}
  8. <ul class="nav navbar-right top-nav">
  9. <li class="dropdown">
  10. <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-info"></i>  à propos<b class="caret"></b></a>
  11. <ul class="dropdown-menu">
  12. <li>
  13. <p>Celutz is a tool for managing and referencing panoramic photos.
  14. <a href="https://code.ffdn.org/FFDN/celutz/">Project homepage</a>
  15. </li>
  16. </ul>
  17. </li>
  18. </ul>
  19. {% endblock %}
  20. {% block sidebar %}
  21. {% include "panorama/sidebar.html" %}
  22. {% endblock %}
  23. {% block content %}
  24. <div id="map" style="height: 400px;"></div>
  25. <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css" />
  26. <style>
  27. body{overflow : scroll;}
  28. </style>
  29. {% endblock content %}
  30. {% block css %}
  31. <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css" />
  32. {% endblock css %}
  33. {% block js %}
  34. <script src="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js"></script>
  35. <script src="https://code.jquery.com/jquery-3.0.0.min.js"></script>
  36. <script>
  37. var map;
  38. var ajaxRequest;
  39. var plotlist;
  40. var plotlayers=[];
  41. function initmap() {
  42. // set up the map
  43. map = new L.Map('map');
  44. // create the tile layer with correct attribution
  45. var osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
  46. var osmAttrib = 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors';
  47. var osm = new L.TileLayer(osmUrl, {attribution: osmAttrib});
  48. // start the map in Grenoble
  49. map.setView(new L.LatLng(45.1842, 5.7218),13);
  50. map.addLayer(osm);
  51. // Add in a crosshair for the map
  52. var crosshairIcon = L.icon({
  53. iconUrl: 'images/crosshair.png',
  54. iconSize: [20, 20], // size of the icon
  55. iconAnchor: [10, 10], // point of the icon which will correspond to marker's location
  56. });
  57. crosshair = new L.marker(map.getCenter(), {clickable:false});
  58. crosshair.addTo(map);
  59. // Move the crosshair to the center of the map when the user pans
  60. map.on('move', function(e) {
  61. crosshair.setLatLng(map.getCenter());
  62. });
  63. map.on('moveend', function(e) {
  64. var lat = map.getCenter().lat;
  65. var lng = map.getCenter().lng;
  66. $('#id_latitude').val(lat);
  67. $('#id_longitude').val(lng);
  68. $.get("http://api.geonames.org/astergdem?lat="+lat+"&lng="+lng+"&username=celutz&style=full" ).done(
  69. function(data) {
  70. $('#id_altitude').val(parseInt(data));
  71. });
  72. });
  73. }
  74. initmap();
  75. </script>
  76. {% endblock js %}