0

I have the following code. On our dev environment (Server 2008 running IIS7) it creates the map and displays it fine. But on our staging enviroument (Server 2003 running IIS6) it gets a map object that cannot be used. Both servers are being hit by an IE11 client. I have also tried Chrome and Safari browsers and got the same results).

  var mapOptions = {
    scaleControl: false,
    draggable: true,
    //overviewMapControl: true,
    //overviewMapControlOptions:{opened:true},
    mapTypeId: google.maps.MapTypeId.HYBRID,
    mapTypeControl: false,
    panControl: false,
    rotateControl: true,
    zoomControl: true,
    scaleControl: true,
    streetViewControl: false

};

//divMap is the Id for the div I want the map to be container i
var mapElement = document.getElementById(divMap);
var m_objMap = new google.maps.Map(mapElement, mapOptions);

var m_cpo = new CanvasProjectionOverlay();
m_cpo.setMap(m_objMap);

CanvasProjectionOverlay code (taken from another StackOverflow post) CanvasProjectionOverlay (scroll down to answer)

function CanvasProjectionOverlay() { }
CanvasProjectionOverlay.prototype = new google.maps.OverlayView();
CanvasProjectionOverlay.prototype.constructor = CanvasProjectionOverlay;
CanvasProjectionOverlay.prototype.onAdd = function () { };
CanvasProjectionOverlay.prototype.draw = function () { };
CanvasProjectionOverlay.prototype.onRemove = function () { };

Anything I try to do with m_objMap from this point on seems to fail.

one example of the error message is:

"setMap: not an instance of Map, and not an instance of StreetViewPanorama".

Does anyone have any thoughts on a direction for debugging? I have been looking at this for a while. The google API service is the same, the only different between the HTML from both servers are the URL server names.

Community
  • 1
  • 1
adondero
  • 492
  • 2
  • 10
  • 26
  • What version of the API are you using? Did you try setting the center and the zoom (the required properties to initialize a [Map](https://developers.google.com/maps/documentation/javascript/reference#MapOptions)? – geocodezip Dec 09 '13 at 23:49
  • we are using version 3.14 these get called a little later on --- m_objMap.setCenter(new google.maps.LatLng(eaLatLong.latitude, eaLatLong.longitude)); //, zoom, givenmaptypes[layer]); m_objMap.setZoom(zoom); – adondero Dec 09 '13 at 23:53
  • Just realized that my code above was missing a couple of lines (CanvasProjectionOverlay). the .setMap call is what is blowing up but only on one of two servers. – adondero Dec 09 '13 at 23:57
  • Is the code the same on both servers? Including the API include? Can you provide a fiddle that exhibits the problem or a link to the map on the problematic server? – geocodezip Dec 10 '13 at 00:02
  • Yes the code is the same. I wish I could give a link but the two servers in question are on our private network. I can try to provide a working example (of the error), but not sure I will be able to. We think it is something with the Server configuration but can't tell. if the "new google.Maps.Map" is getting an error, I wish it would throw an error instead of returning a bad object (which I can not figure out how to validate). – adondero Dec 10 '13 at 00:33
  • Found the issue. Someone had put a version of the Google API (version 2.0) link into the web.config file that is under Microsoft.Net/Framework folder. All our other machines have that setting in Machine.config. – adondero Dec 16 '13 at 16:45
  • thank you.. I moved it and marked it. – adondero Dec 16 '13 at 17:06

1 Answers1

0

Found the issue. Someone had put a version of the Google API (version 2.0) link into the web.config file that is under Microsoft.Net/Framework folder. All our other machines have that setting in Machine.config.

When I was comparing the Google API, I was comparing the Machine.config files. I stared with a blank HTML page and copied one "section" of the page at time until it broke. As I did that, I noticed that the API line was different than what I had in my Machine.config. Took me another 30-45 minutes to realize someone else had put it into the web.config (which we normally do not touch)

adondero
  • 492
  • 2
  • 10
  • 26