Select to view content in your preferred language

Bitmap to raster

201
4
2 weeks ago
Labels (2)
DharmeshPatel1
New Contributor II

Hi I am using ArcGIS Maps SDK 200.4.0.

I have a requirement to display in-memory bitmaps as rasters on the map.

How can I convert the in-memory bitmap images to raster images so they can be displayed on the map?

I have tried to save the bitmaps as .tif files and then loading them into a raster layer - this did not work.

I have tried to add georeferencing information using GDAL and then loading them into raster layer - this also did not work.

I do not have access to ArcGIS Pro.

I have access to local server - can i use this?

Any help is appreciated.

 

Thank you.

0 Kudos
4 Replies
Nicholas-Furness
Esri Regular Contributor

To open local raster files in the SDK, you'll generally need a couple of support files. A world file to describe the image-to-world transformation, and an aux file to specify a spatial reference, so that the SDK knows how to handle that georeferenced image file.

See this gist for an example. The links at the bottom talk about the world and aux files, as well as what to name them. I've found that just using the aux file from the gist wholesale (with an appropriate name) and writing out an appropriate world file based off the instructions in the links, and placing them alongside the image file on device storage works well.

This will require a Standard license or above, but if you're using Local Server, you're already there (and of course while you're developing, without applying any license, you can also test this out). You should also be able to use Local Server for serving up rasters, but if you can get the aux and world files working that might be a simpler approach.

MichaelBranscomb
Esri Frequent Contributor

Nick gives great info above. I would only add that Local Server doesn't really add much here, you should be able to use the direct raster support as outlined above. 

Also, depending on what your bitmaps represent, it may be worth considering the mobile mosaic dataset to which you can add individual rasters and apply mosaic rules to effectively treat them as a single image. For more info see Add raster data | ArcGIS Maps SDK for .NET | Esri Developer.

DharmeshPatel1
New Contributor II

Thank you both for your responses.

I have managed to get a bitmap to display on the map by fixing my GDAL conversion, now the in-memory bitmaps are saved locally as .tif files and then I use GDAL to set the projection to WGS84 and set geo transform information like lat/long.

 

My question now is now I have multiple raster files, how can I mosaic them together? The mobile mosaic dataset seems like an option but I do not have ArcGIS pro and these raster files are created on the fly - I don't see how I could create the mobile mosaic dataset on the fly either. 

 

I have looked into geoprocessing tools of local server but it seems they all require something like a .gdb file from Arcgis pro - again I don't have access to ArcGIS Pro so I'm unsure how to proceed from here.

 

Any help is appreciated.

0 Kudos
dotMorten_esri
Esri Notable Contributor

Look at the MosaicDatasetRaster:
https://developers.arcgis.com/net/api-reference/api/net/Esri.ArcGISRuntime/Esri.ArcGISRuntime.Raster...

It has methods for adding rasters to it.

0 Kudos