/// <summary>
    /// Set up the map texture. The texture will be projected orthographically onto
    /// the geometry and tile plane so we need to work out the correct orthographic
    /// size to use. We need the size (in Unity coords of the tile floor plane) and also the
    /// map image and associated metadata. The metadata will tell us which sub rect of the
    /// supplied image we want to project onto the Tile Floor plane.
    /// </summary>
    /// <param name="TilePlaneWidth"></param>
    /// <param name="TilePlaneHeight"></param>
    /// <param name="TileMetadata"></param>
    private void CreateTexture(int TilePlaneWidth, int TilePlaneHeight, MetadataRootobject TileMetadata)
    {
        var bbox = _tileMetadata.resourceSets[0].resources[0].bbox;

        var bMinLat = bbox[0];
        var bMinLon = bbox[1];
        var bMaxLat = bbox[2];
        var bMaxLon = bbox[3];

        float propLon = (bMaxLon - bMinLon) / (maxLon - minLon);
        float propLat = (bMaxLat - bMinLat) / (maxLat - minLat);

        var prop      = propLat < propLon ? propLat : propLon;
        int orthoSize = 0;

        if (propLat < propLon)
        {
            orthoSize = (int)(prop * TilePlaneHeight / 2.0f);
        }
        else
        {
            orthoSize = (int)(prop * TilePlaneWidth / 2.0f);
        }

        if (_useProjector == true)
        {
            // Don't want to call this until all  of the data is loaded..
            CreateProjector(_satelliteTexture, orthoSize, _tilePlane);
        }
    }
    /// <summary>
    /// Take a 2D map coordinate (in lat/lon) and convert to a UV coordinate which will
    /// index into the map image tile
    /// </summary>
    /// <param name="coord"></param>
    /// <returns></returns>
    Vector2 MapCoordToUV(Vector2 coord, MetadataRootobject tiledata)
    {
        // bbox of the tile image in lat/lon
        var bbox = _tileMetadata.resourceSets[0].resources[0].bbox;

        var bMinLat = bbox[0];
        var bMinLon = bbox[1];
        var bMaxLat = bbox[2];
        var bMaxLon = bbox[3];

        var min = GM.LatLonToMeters(bMinLat, bMinLon);
        var max = GM.LatLonToMeters(bMaxLat, bMaxLon);

        double lon = coord.x + min.x + 0.5 * (max.x - min.x);
        double lat = coord.y + min.y + 0.5 * (max.y - min.y);

        double u = (lon - min.x) / (max.x - min.x);
        double v = (lat - min.y) / (max.y - min.y);

        return(new Vector2((float)u, (float)v));
    }