LoadMapTiles

 

Description

retrieve map image by given url

Syntax

LPVOID LoadMapTiles( LPCSTR lpcszUrl, double dMinLongitude, double dMaxLongitude, double dMinLatitude, double dMaxLatitude, unsigned int nZoomLevel, MapTilesOptions* lpOptions )

Parameters

lpcszUrl
[input] url such as https://abc.example.com/tiles/{x}/{y}/{z}, where {x}, {y}, and {z} are mandatory.
dMinLongitude
[input] minimum longitude
dMaxLongitude
[input] maximum longitude
dMinLatitude
[input] minimum latitude
dMaxLatitude
[input] maximum latitude
nZoomLevel
[input] zoom level
lpOptions
[input] MapTilesOptions, can be NULL
struct MapTilesOptions
{
        bool bIsWebMercator; //true to be Web Mercator
        bool bConvertToWGS84; //if true, convert to the World Geodetic System WGS84 standard
        unsigned int nTimeout; //timeout limit
        unsigned int nDelay; //delay time
        unsigned int nRetry; //number of retry
        unsigned int nParallel; //parallel threads
        const char* lpcszRequestHeader; //request header
};

Return

return pointer to image matrix for success, otherwise return NULL

Examples

EX1

#include <Origin.h>
#include <../OriginLab/opencv_origin.h>
#include <OImage.h>

void LoadMapTiles_ex()
{
        LPCSTR lpcszUrlPattern;//set URL here
        
        double west = 110;
        double east = 120;
        double north = 25; 
        double south = 17;
        unsigned int nZoomLevel = 6;
        CvMat* ptrMat = (CvMat*)LoadMapTiles(lpcszUrlPattern, west, east, south, north, nZoomLevel, NULL);

        if(ptrMat)
        {
                ocvMat mat;
                mat.SetFromMat(ptrMat, false);
                ImagePage gp;
                gp.Create();
                ImageLayer img;
                img = gp.Layers();
                img.SetMat(mat, true);
        }

        return;

}

Remark

See Also

LoadGoogleMapTiles

Header to Included

OImage.h

Reference