Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8214925
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T11:37:01+00:00 2026-06-07T11:37:01+00:00

I’m trying to show a custom map using the Google Maps Javascript API. In

  • 0

I’m trying to show a custom map using the Google Maps Javascript API. In particular, I’m trying to show it using a couple of jquery scripts to allow rotation of the map. I’m not sure if that part is relevant.

When running the code using standard Google Map data (ie, tiles of Earth), it works fine. So here is my map-creation code:

     // Standard google map
     var map = new google.maps.Map2(document.getElementById('map'));
     map.setCenter(new google.maps.LatLng(37.4419, -122.1419), 13);

This works fine. However, when I try to use a custom map, feeding it my own tiles (which I have already achieved in another project, without map rotation), I get “undefined is not a function”. Here is the code that has been added to use custom tiles instead of standard Google Maps data:

google.load("maps", "2.x");

var customTypeOptions = {
        getTileUrl: function (coord, zoom) {
            var normalizedCoord = getNormalizedCoord(coord, zoom);
            if (!normalizedCoord) {
                return null;
            }
            var bound = Math.pow(2, zoom);
            return "http://MYTILESURL/" + zoom + "/" + normalizedCoord.x + "/" + (bound - normalizedCoord.y - 1) + ".jpg";
        },
        tileSize: new google.maps.Size(256, 256),
        maxZoom: 3,
        minZoom: 0,
        radius: 1024,
        name: 'custom'
    };

var customMapType = new google.maps.ImageMapType(customTypeOptions);

and then in my initialize() function:

// Custom map
  var myLatlng = new google.maps.LatLng(0, 0);
  var myOptions = {
    center: myLatlng,
    zoom: 0,
    streetViewControl: false,
    mapTypeControlOptions: {
    mapTypeIds: ['custom']
    }
 };

 var map = new google.maps.Map(document.getElementById('map'), myOptions);
 map.mapTypes.set('custom', customMapType);
 map.setMapTypeId('custom');

The error I’m getting is showing “line 46”, which in my code is “tileSize: new google.maps.Size(256, 256),”. I’m not sure, however, if the 46 reported here is the same 46 I’m reading, ie, the 46th line of the file.

Does anyone have any ideas why I’m getting this “undefined is not a function” error?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T11:37:02+00:00Added an answer on June 7, 2026 at 11:37 am

    This is happening because google.maps.Size is being accessed before the GMap library has finished loading. Simply move anything that refers to google.maps inside your initialise function (or use the callback option in your google.load call to do the same thing).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making a simple page using Google Maps API 3. My first. One marker
I am reading a book about Javascript and jQuery and using one of the
I am trying to render a haml file in a javascript response like so:
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.