maps-api-for-javascript-examples icon indicating copy to clipboard operation
maps-api-for-javascript-examples copied to clipboard

How to customize map-with-custom-map-settings-ui-control to Satelite or Terrain View to render in Raster Tile V3?

Open RaghavendraMdvc opened this issue 8 months ago • 1 comments
trafficstars

As i am using Raster Tile V3 to render maps along with custom-map-settings-ui-control to render Satellite or Terrain view , But once i click on the list the service is invoking for deprecated service and breaking the maps to render to show Satellite or Terrain Maps.

Here is the code How its been Rendering :

//Step 1 var platform = new H.service.Platform({ 'apikey': MapConfig.apikey()
}); //Step 2: initialize a map - this map is centered var mapTileService = platform.getRasterTileService({ queryParams: { lang: "en", ppi: 400, style: "explore.day", }, }); var rasterTileProvider = new H.service.rasterTile.Provider( mapTileService ); var rasterTileLayer = new H.map.layer.TileLayer(rasterTileProvider);

		var here_map = new H.Map(
			document.getElementById(mapDivId),
			rasterTileLayer,
			{
				zoom: zoomLevel,
				pixelRatio: pixelRatio,
	      		center: {lat:centerLat, lng:centerLng},
			}
		);

		//Step 3: make the map interactive
		behavior = new H.mapevents.Behavior(new H.mapevents.MapEvents(here_map));
		// Create the default UI components
		ui = H.ui.UI.createDefault(here_map, defaultLayers);
		// Set the UI unit system to imperial measurement
		ui.setUnitSystem(H.ui.UnitSystem.IMPERIAL);
		//remove default mapsettings control
		ui.removeControl("mapsettings");
		// create custom one
		var ms = new H.ui.MapSettingsControl( {
		    baseLayers : [ { 
		      label:"Map View",layer:defaultLayers.raster.normal.map
		    },{
		      label:"Satellite",layer:**defaultLayers.raster.satellite.map**
		    }, {
		      label:"Terrain",layer:**defaultLayers.raster.terrain.map**
		    }
		    ],
		  layers : [
		    {
		        label: "layer.incidents", layer: defaultLayers.vector.normal.trafficincidents
		    }
		]
		  });
		ui.addControl("customized",ms);

As soon as Either Satellite or Terrain is clicked defaultLayers.raster.satellite.map or defaultLayers.raster.terrain.map is breaking the maps and getting 429 error from network call.

RaghavendraMdvc avatar Feb 24 '25 12:02 RaghavendraMdvc