var map;
var polys;
function findCouncilOverlay(name,colour,granularity) {
$.getJSON('https://socap.informatics-ventures.co.uk/socap/unlock.php?url='+escape('nameAndFeatureSearch?format=json&name='+name+'&featureType=Unitary%20Authority&maxRows=20&startRow=1')+'&full_headers=1&full_status=1&callback=?',
function(data){
$.getJSON( 'https://socap.informatics-ventures.co.uk/socap/unlock.php?url='+escape('footprintLookup?format=json&identifier='+data.contents.features[0].id)+'&full_headers=1&full_status=1&callback=?',
function(data){
displayOverlay(data,colour,granularity);
}
);
}
);
}
/*
data: JSON object
colour: hex of colour of Overlay
granularity: number of points in a polygon above which they should be rendered
*/
function displayOverlay(data,colour,granularity) {
var polygons = new Array();
for (var i = 0; i < data.contents.footprints[0].geometry.coordinates.length; i++) {
var poly = data.contents.footprints[0].geometry.coordinates[i][0];
if(poly.length>granularity) {
polygon = new Array();
for (var j = 0; j < poly.length; j++) {
polygon.push(new google.maps.LatLng(poly[j][1],poly[j][0]));
}
polygons.push(polygon);
}
}
polys = new google.maps.Polygon({
paths: polygons,
strokeColor: colour,
strokeOpacity: 0.35,
strokeWeight: 1,
fillColor: colour,
fillOpacity: 0.35
});
polys.setMap(map);
}
function addDetail(marker, message) {
var infowindow = new google.maps.InfoWindow({
content: message
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map, marker);
$("#tabs").tabs();
});
}
function createMap() {
var latlng = new google.maps.LatLng(56.46856022804521,-3.3288571718749993);
var myOptions = {
zoom: 7,
center: latlng,
mapTypeControl: false,
navigationControl:true,
navigationControlOptions: {
style: google.maps.NavigationControlStyle.ZOOM_PAN
},
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById("map"), myOptions);
var c_markers = [];
var marker = new google.maps.Marker({position: new google.maps.LatLng(55.578636,-2.657556),title: 'Agenor Technology Ltd'});google.maps.event.addListener(marker, 'click', function() {company_information('short-18', 'Agenor Technology Ltd', true);});c_markers.push(marker);var marker = new google.maps.Marker({position: new google.maps.LatLng(55.957319,-3.185944),title: 'Loud Street Ltd (Bloop)'});google.maps.event.addListener(marker, 'click', function() {company_information('short-11', 'Loud Street Ltd (Bloop)', true);});c_markers.push(marker);var marker = new google.maps.Marker({position: new google.maps.LatLng(55.944435,-3.186767),title: 'CereProc Ltd'});google.maps.event.addListener(marker, 'click', function() {company_information('short-12', 'CereProc Ltd', true);});c_markers.push(marker);var marker = new google.maps.Marker({position: new google.maps.LatLng(55.926738,-3.189187),title: 'Blackford Analysis'});google.maps.event.addListener(marker, 'click', function() {company_information('short-5', 'Blackford Analysis', true);});c_markers.push(marker);var marker = new google.maps.Marker({position: new google.maps.LatLng(55.944435,-3.186767),title: 'Mobile Acuity'});google.maps.event.addListener(marker, 'click', function() {company_information('short-6', 'Mobile Acuity', true);});c_markers.push(marker);var marker = new google.maps.Marker({position: new google.maps.LatLng(55.931007,-3.174112),title: 'Anarkik3D Ltd'});google.maps.event.addListener(marker, 'click', function() {company_information('short-10', 'Anarkik3D Ltd', true);});c_markers.push(marker);var marker = new google.maps.Marker({position: new google.maps.LatLng(55.949619,-3.183082),title: 'The PODFather'});google.maps.event.addListener(marker, 'click', function() {company_information('short-13', 'The PODFather', true);});c_markers.push(marker);var marker = new google.maps.Marker({position: new google.maps.LatLng(55.950668,-3.211091),title: 'Peekabu Studios Ltd'});google.maps.event.addListener(marker, 'click', function() {company_information('short-15', 'Peekabu Studios Ltd', true);});c_markers.push(marker);var marker = new google.maps.Marker({position: new google.maps.LatLng(55.955337,-3.175329),title: 'Albagaia Ltd.'});google.maps.event.addListener(marker, 'click', function() {company_information('short-16', 'Albagaia Ltd.', true);});c_markers.push(marker);var marker = new google.maps.Marker({position: new google.maps.LatLng(55.938433,-3.059615),title: 'Factonomy Ltd'});google.maps.event.addListener(marker, 'click', function() {company_information('short-17', 'Factonomy Ltd', true);});c_markers.push(marker);var marker = new google.maps.Marker({position: new google.maps.LatLng(55.873905,-4.317851),title: 'Stream Index Limited'});google.maps.event.addListener(marker, 'click', function() {company_information('short-19', 'Stream Index Limited', true);});c_markers.push(marker);var marker = new google.maps.Marker({position: new google.maps.LatLng(55.932273,-3.180745),title: 'Axiope'});google.maps.event.addListener(marker, 'click', function() {company_information('short-20', 'Axiope', true);});c_markers.push(marker);var marker = new google.maps.Marker({position: new google.maps.LatLng(55.944435,-3.186767),title: 'Heads Up Development'});google.maps.event.addListener(marker, 'click', function() {company_information('short-21', 'Heads Up Development', true);});c_markers.push(marker);var marker = new google.maps.Marker({position: new google.maps.LatLng(55.933325,-3.213896),title: 'Inquisitive Systems'});google.maps.event.addListener(marker, 'click', function() {company_information('short-22', 'Inquisitive Systems', true);});c_markers.push(marker);var marker = new google.maps.Marker({position: new google.maps.LatLng(55.824220,-4.263900),title: 'Muxster'});google.maps.event.addListener(marker, 'click', function() {company_information('short-23', 'Muxster', true);});c_markers.push(marker);var marker = new google.maps.Marker({position: new google.maps.LatLng(55.839736,-2.933397),title: 'Moneydashboard'});google.maps.event.addListener(marker, 'click', function() {company_information('short-24', 'Moneydashboard', true);});c_markers.push(marker);var marker = new google.maps.Marker({position: new google.maps.LatLng(55.942943,-3.180285),title: 'Spectral Robotics'});google.maps.event.addListener(marker, 'click', function() {company_information('short-25', 'Spectral Robotics', true);});c_markers.push(marker);var marker = new google.maps.Marker({position: new google.maps.LatLng(55.954647,-3.197458),title: 'Spinsight'});google.maps.event.addListener(marker, 'click', function() {company_information('short-26', 'Spinsight', true);});c_markers.push(marker);var marker = new google.maps.Marker({position: new google.maps.LatLng(55.962547,-3.182403),title: 'Textensor Limited'});google.maps.event.addListener(marker, 'click', function() {company_information('short-27', 'Textensor Limited', true);});c_markers.push(marker);var marker = new google.maps.Marker({position: new google.maps.LatLng(55.944435,-3.186767),title: 'Contemplate Ltd'});google.maps.event.addListener(marker, 'click', function() {company_information('short-30', 'Contemplate Ltd', true);});c_markers.push(marker);var marker = new google.maps.Marker({position: new google.maps.LatLng(55.944435,-3.186767),title: 'Interface3'});google.maps.event.addListener(marker, 'click', function() {company_information('short-31', 'Interface3', true);});c_markers.push(marker);var marker = new google.maps.Marker({position: new google.maps.LatLng(55.973237,-3.172314),title: 'Tenbu Technologies'});google.maps.event.addListener(marker, 'click', function() {company_information('short-32', 'Tenbu Technologies', true);});c_markers.push(marker);var marker = new google.maps.Marker({position: new google.maps.LatLng(57.062999,-2.470313),title: 'Data2Text Limited'});google.maps.event.addListener(marker, 'click', function() {company_information('short-34', 'Data2Text Limited', true);});c_markers.push(marker);var marker = new google.maps.Marker({position: new google.maps.LatLng(55.944435,-3.186767),title: 'Flexpansion Limited'});google.maps.event.addListener(marker, 'click', function() {company_information('short-35', 'Flexpansion Limited', true);});c_markers.push(marker);var marker = new google.maps.Marker({position: new google.maps.LatLng(55.944878,-3.187469),title: 'MICAR'});google.maps.event.addListener(marker, 'click', function() {company_information('short-36', 'MICAR', true);});c_markers.push(marker); var mcOptions = {gridSize: 50, maxZoom: 9};
var mc = new MarkerClusterer(map,c_markers,mcOptions);
// Disable AJAX caching.
$.ajaxSetup({ cache: false });
// findCouncilOverlay("Highlands","#FF0000",0);
// findCouncilOverlay("Shetland%20Islands","#FF0000",0);
// findCouncilOverlay("Orkney%20Islands","#FF0000",0);
// findCouncilOverlay("Na%20H-Eileanan%20an%20Iar","#FF0000",0);
map.controls[google.maps.ControlPosition.RIGHT].push(createLegend());
}
function createLegend() {
// Create a div to hold the control.
var controlDiv = document.createElement('DIV');
// Set CSS for the control border
var controlUI = document.createElement('DIV');
controlUI.style.backgroundColor = 'white';
controlUI.style.borderStyle = 'solid';
controlUI.style.borderWidth = '2px';
controlUI.style.textAlign = 'center';
controlDiv.appendChild(controlUI);
// Set CSS for the control interior
var controlText = document.createElement('DIV');
controlText.style.fontFamily = 'Arial,sans-serif';
controlText.style.fontSize = '10px';
controlText.style.paddingLeft = '4px';
controlText.style.paddingRight = '4px';
controlText.innerHTML = 'Key

Cluster of Locations

Single Location
';
controlUI.appendChild(controlText);
return controlDiv;
}
// google.setOnLoadCallback(createMap);