Question

Okay, I'm feeling fairly dense for not being able to figure the last part of this out, so hopefully somebody can show me the last piece of the puzzle. I have one example of a polygon that always needs to be visible and another example that uses map.fitBounds() with the same area defined so it IS always visible. The last step is displaying that polygon overlaid on the map.fitBounds() map.

    var southWest = new google.maps.LatLng(41.49623534616764, -88.209228515625);
    var northEast = new google.maps.LatLng(42.64810165693524, -86.4019775390625);
    var bounds = new google.maps.LatLngBounds(southWest,northEast);
    map.fitBounds(bounds); 

Essentially, the code above needs to either replace or supplement the center functionality, which is what I don't get:

var mapOptions = {
    zoom: 8,
    zoomControl: true,
    scaleControl: true,
    scrollwheel: false,
    disableDoubleClickZoom: false,
    mapTypeControl: true,
    navigationControl: true,
    streetViewControl: true,
    center: new google.maps.LatLng(41.845644,-87.766685),
    mapTypeId: google.maps.MapTypeId.ROADMAP
};
var serviceAreaSealMaster;

I recreated it on codepen: http://codepen.io/Realto619/pen/EbmJi

Thanks in advance!

Was it helpful?

Solution

As I mentioned in my comment, geocodezip's confirmation that I was on the right track and a fresh set of eyes solved the problem and I posted the solution in a forked codepen http://codepen.io/Realto619/pen/Dirfn

(Nevermind, the following is no longer an issue:) PS: In case anyone looks at that and wonders why it doesn't appear to be resizing correctly in a few instances, I'm pretty sure that its the boundary that I defined not being as accurate as it needs to be. I'll be fixing that next, but I didn't want to confuse anyone that might see it before then...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top