Ahoj všichni. Snažím se vytvořit mapovou aplikaci pomocí CesiumJS s react přes knihovnu Resium. Chci zobrazit FAA VFR Sectional Charts, které jsou zde: https:\/\/faa.maps.arcgis.com\/home\/item.html?id=6ab79dc5de5743adb3e3b6e3c803aa59<\/A>Jsem poměrně nový v Cesium\/Resium. Četl jsem dokumentaci ArcGis\/CesiumJS umístěnou zde pro načítání mapových dlaždic: https:\/\/developers.arcgis.com\/cesiumjs\/layers\/add-map-tiles<\/A>, která samozřejmě používá základní CesiumJS. Ověřil jsem, že mé přístupové tokeny jsou správné a nejsou null ani nic podobného. Můj arcgis developer token má všechna dostupná oprávnění, která jsem mohl nastavit. Zkoušel jsem také použít URL mapových dlaždic pro santa monica parcels zde: https:\/\/developers.arcgis.com\/cesiumjs\/layers<\/A> a stále dostávám chybu 404. Předávám svůj přístupový token, jak vidíte, a našel jsem 1 arcgis URL, pro které JSEM mohl načíst dlaždice. Je potřeba nějaké nastavení oprávnění pro přístup k těmto FAA dlaždicím? Říká se, že jsou veřejné? Jsem v tom nový, takže určitě něco přehlížím, abych se správně připojil a získal tyto dlaždice. Díky za jakoukoli pomoc, kterou můžete poskytnout.<\/P> <\/P> <\/P>import { ArcGisMapServerImageryProvider, ArcGisMapService, ImageryLayer, Ion } from 'cesium'; import { useEffect, useState } from "react"; import { Viewer } from "resium"; function App() { const arcGisApiKey = import.meta.env.VITE_ARCGIS_API_KEY; const cesiumAccessToken = import.meta.env.VITE_CESIUM_API_KEY; Ion.defaultAccessToken = cesiumAccessToken; ArcGisMapService.defaultAccessToken = arcGisApiKey; Ion.defaultAccessToken = cesiumAccessToken; ArcGisMapService.defaultAccessToken = arcGisApiKey; const [vfrImagery, setVfrImagery] = useState<ImageryLayer | undefined>(undefined); useEffect(() => { async function loadImagery() { try { const vfrImageryProvider = await ArcGisMapServerImageryProvider.fromUrl( "https:\/\/tiles.arcgis.com\/tiles\/ssFJjBXIUyZDrSYZ\/arcgis\/rest\/services\/VFR_Sectional\/MapServer" ); const vfrImageryLayer = new ImageryLayer(vfrImageryProvider); setVfrImagery(vfrImageryLayer); } catch (error) { console.error("Chyba při načítání poskytovatelů snímků:", error); } } loadImagery(); }, [arcGisApiKey]); return ( <Viewer baseLayer={vfrImagery} timeline={false} animation={false} geocoder={false} > <\/Viewer> ); } export default App;<\/code><\/pre> <\/P> <\/P> <\/P>
<\/P>
import { ArcGisMapServerImageryProvider, ArcGisMapService, ImageryLayer, Ion } from 'cesium'; import { useEffect, useState } from "react"; import { Viewer } from "resium"; function App() { const arcGisApiKey = import.meta.env.VITE_ARCGIS_API_KEY; const cesiumAccessToken = import.meta.env.VITE_CESIUM_API_KEY; Ion.defaultAccessToken = cesiumAccessToken; ArcGisMapService.defaultAccessToken = arcGisApiKey; Ion.defaultAccessToken = cesiumAccessToken; ArcGisMapService.defaultAccessToken = arcGisApiKey; const [vfrImagery, setVfrImagery] = useState<ImageryLayer | undefined>(undefined); useEffect(() => { async function loadImagery() { try { const vfrImageryProvider = await ArcGisMapServerImageryProvider.fromUrl( "https:\/\/tiles.arcgis.com\/tiles\/ssFJjBXIUyZDrSYZ\/arcgis\/rest\/services\/VFR_Sectional\/MapServer" ); const vfrImageryLayer = new ImageryLayer(vfrImageryProvider); setVfrImagery(vfrImageryLayer); } catch (error) { console.error("Chyba při načítání poskytovatelů snímků:", error); } } loadImagery(); }, [arcGisApiKey]); return ( <Viewer baseLayer={vfrImagery} timeline={false} animation={false} geocoder={false} > <\/Viewer> ); } export default App;<\/code><\/pre> <\/P> <\/P> <\/P>
ugh....okay well this embaressing but it's because I didn't zoom in enough....once I zoomed in the tiles loaded in. I guess they have a min/max zoom for when they start to appear.
I also realize I have those two access tokens line twice. That was a typo.
@BrandonBerisfordI tried it and it worked for me. What service is giving you error 404? A 404 error indicates the resource you are attempting to request does not exist, so check your URLs and parameters. If the token was incorrect you would see an error 403 or 401.
I used this example code https://developers.arcgis.com/cesiumjs/scenes/display-a-scene/
I set my ArcGIS API key and Cesium token. Then changed
const arcGisImagery = Cesium.ArcGisMapServerImageryProvider.fromUrl("https://tiles.arcgis.com/tiles/ssFJjBXIUyZDrSYZ/arcgis/rest/services/VFR_Sectional/MapServer");
and that rendered the FAA map
I've attached some screenshots. I've set my cesium ion token and arcgis api key up, and you can see my code below. Idk if you've tried using resium/react instead of vanilla javascript, but this should definetely be possible. I get a ton 404's for like all kinds of tiles it's trying to load it seems?
const arcGisImageryProvider = await ArcGisMapServerImageryProvider.fromBasemapType( ArcGisBaseMapType.SATELLITE, { token: arcGisApiKey } );
If I try just loading the base satellite imagery as seen below it works fine, but when I try to swap to using the fromUrl and the vfr imagery, i get those 404's.
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.