Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <link rel="stylesheet" type="text/css" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css">
- <script type="text/javascript" src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
- <style type="text/css">
- <?php /* html, body, #map { width:100%; height:100%; margin:0; padding:0; }*/?>
- body {
- padding: 0;
- margin: 0;
- }
- html, body, #map {
- height: 100vh;
- width: 100vw;
- }
- </style>
- <title> by error</title>
- <link href="css/leaflet.css" rel="stylesheet" type="text/css">
- <script type='text/javascript'>//<![CDATA[
- window.onload=function(){
- var w = 120000;
- var h = 120000;
- var mapMinZoom = 3;
- var mapMaxZoom = 3;
- var _map = L.map('map', {
- zoom:1,
- maxBounds: new L.LatLngBounds([0,0], [120000, 120000]),
- touchZoom:false,
- scrollWheelZoom: false,
- doubleClickZoom:false,
- crs: L.CRS.Simple,
- zoomControl: false,
- attributionControl: false,
- detectRetina: false
- })
- var southWest = _map.unproject([0,120000], _map.getMaxZoom());
- var northEast = _map.unproject([120000,0], _map.getMaxZoom());
- _map.setMaxBounds(new L.LatLngBounds(southWest, northEast));
- var _mapBounds = new L.LatLngBounds(
- _map.unproject([1, h], mapMaxZoom),
- _map.unproject([w, 1], mapMaxZoom));
- _map.setMaxBounds(_mapBounds);
- //var _mapCenter = _map.unproject([w/2, h/2], mapMaxZoom);
- //_map.setView(_mapCenter, 3);
- <?php
- require('db.conf.php');
- $strImagePath = "";
- // Create connection
- $conn = new mysqli($servername, $username, $password, $dbname);
- // Check connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- $sql = "SELECT * FROM `kingdome` WHERE member_id = '1'";
- $result = $conn->query($sql);
- if ($result->num_rows > 0) {
- // output data of each row
- while($row = $result->fetch_assoc()) {
- $pieces = explode(",", $row['latlng']);
- $one = $pieces[0];
- $two = $pieces[1];
- /*?>alert(<?php echo "108" . " + '-' + " . $two;?>);<?php*/
- /*?>_map.setView([<?php echo $one;?>,<?php echo $two;?>], 3);<?php*/
- }
- } else {
- //do nothing
- }
- $conn->close();
- ?>
- var _tileLayer = L.tileLayer(
- //'http://127.0.0.1/wotu/map/img/{z}/map_{x}_{y}.png', {
- //'http://192.168.43.205/wotu/map/test/map_{x}_{y}.png', {
- 'http://192.168.43.205/wotu/map/image.php?space_id={x}r{y}', {
- //'http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
- bounds: _mapBounds,
- continuousWorld: true,
- noWrap:true,
- tileSize:100,
- crs: L.CRS.Simple,
- detectRetina:false
- }).addTo(_map);
- //var _mapCenter = _map.unproject([500, 300], mapMaxZoom);
- //_map.setView(_mapCenter, 3);
- //_map.setView([-2500, 300]);
- var london = new L.LatLng(-35, 20);
- _map.setView(london, 3);
- var markerLocation = new L.LatLng(-20, 20);
- var markerLocation2 = new L.LatLng(-35, 20);
- //Extend the Default marker class
- var RedIcon = L.Icon.Default.extend({
- options: {
- iconUrl: 'image/castle.png',
- iconSize:[100,100],
- }
- });
- var redIcon = new RedIcon();
- /*
- //Other things we could have changed
- iconSize: [25, 41], // size of the icon
- shadowSize: [50, 64], // size of the shadow
- iconAnchor: [12, 41] // point of the icon which will correspond to marker's location
- shadowAnchor: [4, 62], // the same for the shadow
- popupAnchor: [-3, -76] // point from which the popup should open relative to the iconAnchor
- */
- L.marker(markerLocation, {icon: redIcon}).addTo(_map);
- L.marker(markerLocation2, {icon: redIcon}).addTo(_map);
- _map.on('click', function(e) {
- alert("Lat, Lon : " + e.latlng.lat + ", " + e.latlng.lng)
- });
- function onMapClick(e) {
- e.originalEvent.defaultPrevented = true;
- var orig = e.originalEvent;
- console.log(orig);
- //_map.setView([orig.x,orig.y], 3);
- alert(orig.toElement.src);
- orig.toElement.src = "http://cdn.head-fi.org/b/b3/100x100px-LS-b331da36_1000x500px-LL-9b46fb2b_homer-headphones.jpeg";
- }
- _map.on('click', onMapClick);
- function onMapClick2(e) {
- console.log(e.latlng);
- }
- //Hadnel on right click functions TODO: MOVE THIS LATER
- _map.on('contextmenu', onMapClick2);
- }
Add Comment
Please, Sign In to add comment