Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
RaghavendraMdvc opened this issue Feb 24, 2025 · 0 comments

Comments

@RaghavendraMdvc
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant