-
Export data from GDEX (Global Data Explorer) (https://gdex.cr.usgs.gov/gdex/)
-
Apply levels to data to make it a bit 'shorter'
-
Save the image as a bitmap.
-
Convert the bitmap to a RAW image
/// <summary> /// Convert a bitmap to a byte array /// </summary> /// <param name="bitmap">image to convert</param> /// <returns>image as bytes</returns> private static byte[] ConvertBitmapToRaw(Bitmap bitmap) { //Code excerpted from Microsoft Robotics Studio v1.5 BitmapData raw = null; //used to get attributes of the image byte[] rawImage = null; //the image as a byte[] try { //Freeze the image in memory raw = bitmap.LockBits( new Rectangle(0, 0, (int)bitmap.Width, (int)bitmap.Height), ImageLockMode.ReadOnly, PixelFormat.Format8bppIndexed ); int size = raw.Height * raw.Width; rawImage = new byte[size]; int rem = raw.Width % 4; int padding = rem == 0 ? 0 : 4 - rem; int basePtr = raw.Scan0.ToInt32(); //Copy the image into the byte[] for (int r = 0; r < raw.Height; r++) { int srcOffset = r * (raw.Width + padding); int dstOffset = r * raw.Width; Marshal.Copy(new IntPtr(basePtr + srcOffset), rawImage, dstOffset, raw.Width); } } finally { if (raw != null) { //Unfreeze the memory for the image bitmap.UnlockBits(raw); } } return rawImage; }
-
Import the RAW image into Unity.
- It should detect the settings.
-
Download GoogleMaps data for the given area.