Made zoom a variable, changed Social/maps to use OpenStreetMap

This commit is contained in:
= 2018-11-26 20:24:14 +00:00
parent c33865a8c5
commit fd6e815b93
6 changed files with 30 additions and 58 deletions

View File

@ -23,6 +23,7 @@ class Social extends CI_Controller {
function json_map($date) {
$this->load->model('logbook_model');
$this->load->library('qra');
$qsos = $this->logbook_model->map_day($date);

View File

@ -31,6 +31,7 @@
<?php } ?>
var qso_loc = '<?php echo site_url('dashboard/map');?>';
var q_zoom = 2;
$(document).ready(function(){
initmap();

View File

@ -23,47 +23,17 @@
<script type="text/javascript" src="<?php echo base_url();?>js/leaflet/leafembed.js"></script>
<script type="text/javascript">
function create_map() {
var latlng = new google.maps.LatLng(40.313043, -32.695312);
var myOptions = {
zoom: 2,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var infowindow = new google.maps.InfoWindow();
var q_lat = 40.313043;
var q_lng = -32.695312;
var q_zoom = 2;
var marker, i;
var qso_loc = '<?php echo site_url("social/json_map/" . $date); ?>';
/* Get QSO points via json*/
$.getJSON("/logbook/index.php/social/json_map/<?php echo $date; ?>", function(data) {
$.each(data.markers, function(i, val) {
/* Create Markers */
marker = new google.maps.Marker({
position: new google.maps.LatLng(this.lat, this.lng),
map: map
});
/* Store Popup Text */
var content = this.html;
/* Create Popups */
google.maps.event.addListener(marker, 'click', (function(marker, i) {
return function() {
infowindow.setContent(content);
infowindow.open(map, marker);
}
})(marker, i));
});
});
var map = new google.maps.Map(document.getElementById("map"),
myOptions);
}
$(document).ready(function(){
create_map();
$(document).ready(function(){
initmap();
});
</script>

View File

@ -42,6 +42,7 @@
<?php } ?>
var qso_loc = '<?php echo site_url('dashboard/map');?>';
var q_zoom = 2;
$(document).ready(function(){
initmap();

View File

@ -19,10 +19,12 @@ line-height: 1.7;
margin: 10px 0;
}
</style>
<script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false&key=<?php echo $this->config->item('gmaps_api_key');?>"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>js/jquery-1.5.1.min.js"></script>
<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>js/leaflet/leaflet.css" />
<script type="text/javascript" src="<?php echo base_url(); ?>js/leaflet/leaflet.js"></script>
</head>
<body onload="initialize()">
<body>
<?php if ($query->num_rows() > 0) { foreach ($query->result() as $row) {
?>
<h1>QSO with <?php echo $row->COL_CALL; ?> on the <?php $timestamp = strtotime($row->COL_TIME_ON); echo date('d/m/y', $timestamp); $timestamp = strtotime($row->COL_TIME_ON); echo " at ".date('H:i', $timestamp); ?></h1>
@ -134,7 +136,7 @@ margin: 10px 0;
<div id="stat">
<div id="map_canvas" style="width: 340px; height: 250px"></div>
<div id="map" style="width: 340px; height: 250px"></div>
<?php
if($row->COL_GRIDSQUARE != null) {
@ -157,23 +159,20 @@ margin: 10px 0;
}
?>
<script type="text/javascript">
function initialize() {
var myLatlng = new google.maps.LatLng(<?php echo $lat; ?>,<?php echo $lng; ?>);
var myOptions = {
zoom: 4,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title:"<?php echo $row->COL_CALL; ?>"
});
}
</script>
<script type="text/javascript" src="<?php echo base_url();?>js/leaflet/leafembed.js"></script>
<script type="text/javascript">
var q_lat = <?php echo $lat; ?>;
var q_lng = <?php echo $lng; ?>;
var qso_loc = '<?php echo site_url('dashboard/map');?>';
var q_zoom = 6;
$(document).ready(function(){
initmap();
});
</script>
</div>
</div>

View File

@ -22,7 +22,7 @@ function initmap() {
var osm = new L.TileLayer(osmUrl, {minZoom: 1, maxZoom: 9, attribution: osmAttrib});
// start the map in South-East England
map.setView(new L.LatLng(q_lat, q_lng), 2);
map.setView(new L.LatLng(q_lat, q_lng), q_zoom);
map.addLayer(osm);
askForPlots();