var poly;
var map;
var pointA;
var pointB;
var infowindow_A;
var infowindow_B;
function initMap() {
var mapDiv = document.getElementById('map');
map = new google.maps.Map(mapDiv, {
center: {
lat: 30.565244,
lng: -97.671010
},
zoom: 14
});
var svLayer = new google.maps.StreetViewCoverageLayer();
svLayer.setMap(map);
var txstate = {
lat: 30.569858,
lng: -97.655918
};
var panorama = new google.maps.StreetViewPanorama(
document.getElementById('pano'), {
position: txstate,
pov: {
heading: 34,
pitch: 10
}
});
google.maps.event.addListener(panorama, 'pano_changed', function() {
addLatLng({
latLng: panorama.getPosition()
});
if (!map.getBounds().contains(panorama.getPosition())) {
map.setCenter(panorama.getPosition());
}
})
map.setStreetView(panorama);
poly = new google.maps.Polyline({
strokeColor: '#000000',
strokeOpacity: 1.0,
strokeWeight: 3
});
poly.setMap(map);
// Add a listener for the click event
map.addListener('position_change', addLatLng);
}
// Handles click events on a map, and adds a new point to the Polyline.
function addLatLng(event) {
var path = poly.getPath();
// Because path is an MVCArray, we can simply append a new coordinate
// and it will automatically appear.
path.push(event.latLng);
//point A
//hard-coded as Texas State University right now
var image = "https://upload.wikimedia.org/wikipedia/commons/7/73/Farm-Fresh_star.png"; //STAR
if (!pointA) {
pointA = new google.maps.Marker({
position: {
lat: 30.567989,
lng: -97.655153
},
map: map,
title: 'tx state',
label: 'A',
// animation: google.maps.Animation.DROP
});
var circle = new google.maps.Circle({
map: map,
radius: 120,
center: pointA.getPosition()
});
var contentString_A = '<h5>texas state university at round rock</h5>';
infowindow_A = new...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.