Skip to content

Instantly share code, notes, and snippets.

@PierrickKoch
Created October 4, 2013 10:44
Show Gist options
  • Select an option

  • Save PierrickKoch/6824096 to your computer and use it in GitHub Desktop.

Select an option

Save PierrickKoch/6824096 to your computer and use it in GitHub Desktop.
pom osm
<!doctype html>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="proj4js/dist/proj4.js"></script>
<style>
#map { height: 800px; }
</style>
<body>
<div id="map"/>
https://github.com/proj4js/proj4js - https://github.com/Leaflet/Leaflet
</body>
<script>
// https://wiki.laas.fr/robots/GlobalPositioningSystem/NovatelConfiguration
var utm_origin = [377023.24,4824377.15];
var utm_zone = "+proj=utm +zone=31";
var wgs84 = "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs";
function custom2latlong(custom) {
var utm = [ utm_origin[0] + custom[0] ,
utm_origin[1] + custom[1] ];
var longlat = proj4(utm_zone, wgs84, utm);
return [longlat[1], longlat[0]];
}
// create a map in the "map" div, set the view to a given place and zoom
var map = L.map('map').setView(custom2latlong([0,0]), 18);
// add an OpenStreetMap tile layer
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
// add a marker in the given location, attach some popup content to it and open the popup
L.marker(custom2latlong([0,0])).addTo(map)
.bindPopup('LAAS')
.openPopup();
// get pom pose from picoweb http://localhost:8080/pom?get=Pos
// http://api.jquery.com/jQuery.ajax/
$.ajax({
url: "/pom?get=Pos",
success: function( data ) {
console.log(data);
}
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment