0

I'm reading this example snippet in googlemaps API.


The below is an extract from the snippet.

getNormalizedCoord(coord, zoom) is a separately defined function.

The value of the getTileUrl attribute is assigned to the output of the inline function which takes (coord, zoom) as arguements.

var moonMapType = new google.maps.ImageMapType({

     getTileUrl: function(coord, zoom) {
            var normalizedCoord = getNormalizedCoord(coord, zoom);
            ....
            ....
     },
     ....
     ....
});

Question: What are the values of the coord, zoom variables when they are called inside the inline function?

I don't see them assigned to anything prior to calling them.

1 Answer 1

1

It's taking the parameters from getTileUrl which belongs to the ImageMapTypeOptions object specification.

getTileUrl  
Type:  function(Point, number): string
Returns a string (URL) for given tile coordinate (x, y) and zoom level.

https://developers.google.com/maps/documentation/javascript/3.exp/reference#ImageMapTypeOptions

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.