'
        }),
        new ol.Attribution({
          html: 'Map data © OpenStreetMap contributors, ODbL'
        })
      ],
      url: 'http://otile{1-4}.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.jpg'
    })
  });
  map.addLayer(osmLayer);
  map.on('moveend', function() {
    showContent();
  });
  vectorSource = new ol.source.Vector();
  var markerLayer = new ol.layer.Vector( {
    source: vectorSource
  });
  map.addLayer(markerLayer);
  view.setCenter(ol.proj.transform(origin, 'EPSG:4326', 'EPSG:3857'));
  view.setZoom(zoom);
  navigator.geolocation.getCurrentPosition(
    function(pos) {
      view.setCenter(
        ol.proj.transform([pos.coords.longitude, pos.coords.latitude],
          'EPSG:4326', 'EPSG:3857'
        )
      );
      view.setZoom(zoom);
    },
    function(err) {
      // do nothing
    },
    {maximumAge: 5000, timeout: 3000, enableHighAccuracy: true}
  );
});
function showContent() {
  if(req) {
    req.abort();
  }
  var zoom = view.getZoom();
  var rect = getRect();
  var sparql = 
    'SELECT distinct ?name, ?abstract, ?lat, ?lon, ?url, ?link ' + 
    'WHERE { ' +
    '?s rdfs:label ?name ; ' +
    'dbpedia-owl:abstract ?abstract ; ' +
    'foaf:isPrimaryTopicOf ?url ; ' +
    'geo:lat ?lat ; ' +
    'geo:long ?lon . ' +
    'OPTIONAL { ?s foaf:homepage ?link } ' +
    'FILTER ( ?lon > "' + rect[0] + '"^^xsd:float && ?lon < "' + rect[2] + '"^^xsd:float && ' +
    '?lat > "' + rect[1] + '"^^xsd:float && ?lat < "' + rect[3] + '"^^xsd:float ) ' +
    lang_filter +
    '} ' +
    'LIMIT ' + maxInf;
  var query = {
    query : sparql,
    format: 'application/sparql-results+json'
  };
  req = $.getJSON(server, query, function(data){
    req = null;
    vectorSource.clear();
    var list = data.results.bindings;
    bodydiv.innerHTML = '';             // clear
    for(i=0 ; i' + list[i].abstract.value + '
'; if(list[i].link) { bodydiv.innerHTML += '' + '' + list[i].link.value + '
'; } var iconFeature = new ol.Feature({ geometry: new ol.geom.Point( ol.proj.transform( [parseFloat(list[i].lon.value), parseFloat(list[i].lat.value)], 'EPSG:4326', 'EPSG:3857')) }); var iconStyle = new ol.style.Style({ text: new ol.style.Text({ fill: new ol.style.Fill({ color: '#FFF', opacity: 0.5}), stroke: new ol.style.Stroke({ color: '#00F', opacity: 0.5, width: 5}), text: i+1, opacity: 0.5, font: '20px Verdana' }), opacity: 0.5 }); iconFeature.setStyle(iconStyle); vectorSource.addFeature(iconFeature); } if(list.length > 0) { bodydiv.innerHTML += '