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 6792905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:02:02+00:00 2026-05-26T18:02:02+00:00

I am trying to load a basic ESRI ArcGIS map in a GWT project.

  • 0

I am trying to load a basic ESRI ArcGIS map in a GWT project. The javascript ArcGIS API is written in Dojo, and seems to require you to use dojo.addOnLoad() to make sure the code that initializes the map object doesn’t run until after the ArcGIS API is fully initialized. The code looks like this:

    var map;        
    dojo.require("esri.Map");
    function init() {
        map = new esri.Map("mapDiv");
        var basemapURL= "http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer";
        var basemap = new esri.layers.ArcGISTiledMapServiceLayer(basemapURL);
        map.addLayer(basemap);
    }
    dojo.addOnLoad(init);

The problem is that when I use this code in a GWT project, it never calls the function I passed into dojo.addOnLoad. The map never gets initialized and never shows up. I have verified with Firebug that the addOnLoad() is being called but init() is not.

I tried working around this by calling init() from GWT code in a timer, which works, but only around 50% of the time. The rest of the time I get the error “TypeError: dojox.gfx.createSurface is not a function,” so I’m pretty sure I’m creating a race condition when I do that.

Running the project in developer mode in Eclipse or hosting the compiled project in Tomcat makes no difference.

  • 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-05-26T18:02:03+00:00Added an answer on May 26, 2026 at 6:02 pm

    In this case, Dojo isn’t looking for an actual named function function init(), but rather a variable that contains a function var init = function() {...}.

    What you want to do is this:

    var map;        
    dojo.require("esri.Map");
    var init = function() {
      map = new esri.Map("mapDiv");
      var basemapURL= "http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer";
      var basemap = new esri.layers.ArcGISTiledMapServiceLayer(basemapURL);
      map.addLayer(basemap);
    }
    
    dojo.addOnLoad(init);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting the following error trying to load a basic project template: Error
I am trying to load a very basic XML document but everytime I get
When trying to load Microsoft.Xna.Framework.dll from any project, it throws a FileNotFoundException. The specified
I’m trying to eagerly load an entity and its related properties (basic one to
Trying to use OpenLayers to (eventually) load markers, vectors & WMS on top of
I'm trying to get a basic Apache 2.2 load balancer running on top of
I've been trying to get a basic app working that doesnt use an XIB.
So I am trying to implement a basic image lazy load feature to speed
I'm trying to figure out how to use HTML5's history functions. Here's my basic
I'm trying to build VERY basic model->controller->view structure with CodeIgniter. I'd rather use models

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.