Hello everyone, I have the isocode of each user’s country and I want it to be displayed in that country when the map is loaded when they log in. I am doing it from coordinates in the sample code below, but I need to specify different zoom in each country. I think I can do it using Geocoder. Can you help me, thanks in advance
useEffect(() => {
if (cesiumViewer.current === null && cesiumContainerRef.current) {
CesiumJs.Ion.defaultAccessToken = `${process.env.NEXT_PUBLIC_CESIUM_TOKEN}`;
cesiumViewer.current = new CesiumJs.Viewer(cesiumContainerRef.current, {
requestRenderMode: true,
geocoder: true,
navigationHelpButton: false,
animation: false,
timeline: false,
skyBox: false,
fullscreenButton: false,
globe: false,
});
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
useEffect(() => {
if (isLoaded) return;
initializeCesiumJs();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [isLoaded]);
useEffect(() => {
if (cesiumViewer.current && selectedCountry) {
const coordinates = {
'TR': { longitude: 35.0, latitude: 39.0 }, // Türkiye için örnek koordinatlar
// Other countries...
};
const { longitude, latitude } = coordinates[selectedCountry] || { longitude: 0, latitude: 0 };
cesiumViewer.current.camera.flyTo({
destination: CesiumJs.Cartesian3.fromDegrees(longitude, latitude, 900000),
duration: 3,
});
}
}, [selectedCountry]);