You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@marySalvi and @annehaley, I thought I'd share how to use the RGD endpoints to display a raster in the Cesium viewer here. Figured a Discussion is more appropriate than an issue.
That's the information to display in a table view.
Displaying image tiles in the Cesium Viewer
In order to display the raster in the cesium viewer, the user will need to select a single image from the list of images in parent_raster->image_set->images. Once you have an image ID, you will use that ID to fetch a bit of metadata about the image with the endpoint /image_process/imagery/{id}/tiles and also generate a template for the /image_process/imagery/{id}/tiles/{z}/{x}/{y}.png endpoint. The formatting of this 2nd endpoint is a special case -- we only need to fill in the ID field and pass this URL template on to Cesium's UrlTemplateImageryProvider class. We'll do this in the following manner:
fetch(`${host}/api/image_process/imagery/${image_id}/tiles`).then(response=>response.json()).then(data=>{varextents=data["bounds"];varrectangle=Cesium.Rectangle.fromDegrees(extents.xmin,extents.ymin,extents.xmax,extents.ymax)varband=0;// Drop down menu of band choices (default is 0 / no choice)varlayers=viewer.scene.imageryLayers;// From main Cesium Viewer instancevartileProvider=newCesium.UrlTemplateImageryProvider({url: `${host}/api/image_process/imagery/${image_id}/tiles/{z}/{x}/{y}.png?projection=EPSG:3857&band=${band}`,subdomains: null,// We do not need or provide this in RGDrectangle: rectangle,// To prevent fetching tiles outside bounds of image});tileLayer=layers.addImageryProvider(tileProvider);});
That should be all you need to display an image from a raster in the CesiumViewer.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
@marySalvi and @annehaley, I thought I'd share how to use the RGD endpoints to display a raster in the Cesium viewer here. Figured a Discussion is more appropriate than an issue.
Access Raster Metadata
You'll want to use the
/rgd_imagery/raster/{spatial_id}
endpoint which serializes aRasterMeta
model. Here is an example response from that endpoint: https://www.resonantgeodata.com/api/rgd_imagery/raster/9That's the information to display in a table view.
Displaying image tiles in the Cesium Viewer
In order to display the raster in the cesium viewer, the user will need to select a single image from the list of images in parent_raster->image_set->images. Once you have an image ID, you will use that ID to fetch a bit of metadata about the image with the endpoint
/image_process/imagery/{id}/tiles
and also generate a template for the/image_process/imagery/{id}/tiles/{z}/{x}/{y}.png
endpoint. The formatting of this 2nd endpoint is a special case -- we only need to fill in the ID field and pass this URL template on to Cesium'sUrlTemplateImageryProvider
class. We'll do this in the following manner:That should be all you need to display an image from a raster in the CesiumViewer.
Beta Was this translation helpful? Give feedback.
All reactions