Problem with creating a ???blank??? basemap in application

5455
7
09-13-2013 07:36 AM
Town_ofSnowflake
Occasional Contributor
I'm building an application where I'd like the user to be able to select a blank basemap from a gallery of basemap options.

I've found that if I initialize the app with a "white" "blank" or "none," I get the blank basemap I desire. Unfortunately, when I set this property it seems to "lock" the basemap into the "blank" property. When the user selects a new basemap, such as "topo" from the gallery I've created, the basemap stays blank.

On the other hand, if I initialize the app with a basemap such as "topo," the user can switch between other basemaps, but if they try to select "blank" the basemap doesn't change.

Even though it isn't listed as an option in the API, is it possible to switch between a "blank" basemap and the others?
0 Kudos
7 Replies
JasonZou
Occasional Contributor III
I guess what you did is to create an empty basemap, and add it to the basemap gallery. Am I right? Please refer to the ESRI document.
All basemaps added to the gallery need to have the same spatial reference. If the default ArcGIS.com basemaps are used then all additional items added to the gallery need to be in Web Mercator (wkids: 102100, 102113 and 3857). If the default basemaps are not used you can add basemaps in any spatial reference as long as all the items added to the gallery share that spatial reference. To achieve the best performance, it is recommended that all basemaps added to the gallery are cached (tiled) layers.


Have you tried to create a blank map document with the spatial reference set to webMercator, and then publish it as a map service? In the code,

  • Create a basemapLayer with the service just published.

  • Create a basemap fed in the basemapLayer.

  • Add basemap to the basemap gallery.

0 Kudos
Town_ofSnowflake
Occasional Contributor
Can you clarify:

Create a basemapLayer with the service just published


Am I creating an ArcGISTiledMapServiceLayer?

Create a basemap fed in the basemapLayer


What does this mean?
0 Kudos
JasonZou
Occasional Contributor III
Am I creating an ArcGISTiledMapServiceLayer?

I would suggest to publish the empty map service as cached one, and DEFINE the scale levels exactly the same as any esri basemap, but do NOT create the tiled images. The ArcGIS Server will recognize it as tiled map service.

The sample code explains what I meant assuming using AMD code style.
var basemapLayer = new BasemapLayer({
    url:"url/of/empty/basemap/mapservice"
});

var emptyBasemap = new Basemap({
    layers: [basemapLayer],
    title: "Empty Basemap",
    thumbnailUrl: "url/of/empty/image"
});

basemapGallery.add(emptyBasemap);
0 Kudos
Town_ofSnowflake
Occasional Contributor
I was able to successfully put the blank basemap into the gallery.  However, I want the basemap gallery to also include: streets, satellite, hybrid, topo, gray, oceans, national-geographic, osm.  Do I need to manually add each one individually?  If so, what are updated links for them?  This is the only link I know of and it doesn't include them all.
0 Kudos
JasonZou
Occasional Contributor III
To include ESRI basemaps, make sure showArcGISBasemaps set to true when creating basemapGallery. If you like to only include subset of ESRI basemaps or like to reorder the basemaps in the gallery, you can create a basemap for each type, and add to the gallery in order.

Below is the sample for including the esri basemaps and adding yours at the end.

var basemapGallery = new esri.dijit.BasemapGallery({
  showArcGISBasemaps: true,
  map: map
}, "basemapGallery");

var basemapLayer = new BasemapLayer({
    url:"url/of/empty/basemap/mapservice"
});

var emptyBasemap = new Basemap({
    layers: [basemapLayer],
    title: "Empty Basemap",
    thumbnailUrl: "url/of/empty/image"
});

basemapGallery.add(emptyBasemap);

basemapGallery.startup();
YousefQuran
Occasional Contributor

Thank you very much.
This is really help me and it's work Great !
Regards.

0 Kudos
TobiasFimpel
Occasional Contributor
Have you explored this option already: use an esri basemap or other appropriate cached map service and set the transparency to 100%. Might not be acceptable for what you are doing, but it effectively gives you a blank basemap in just a few seconds.
0 Kudos