2.1.12.8 LoadGoogleMapTiles


Description

retrieve google map image

Syntax

LPVOID LoadGoogleMapTiles( double dMinLongitude, double dMaxLongitude, double dMinLatitude, double dMaxLatitude, unsigned int nZoomLevel, LPCSTR key, string * pstrCopyright, LPCSTR request_header, LPCSTR request_data, bool bConvertToWGS84, LPCSTR session_token )

Parameters

dMinLongitude
[input] minimum longitude
dMaxLongitude
[input] maximum longitude
dMinLatitude
[input] minimum latitude
dMaxLatitude
[input] maximum latitude
nZoomLevel
[input] zoom level
key
[input] google map API key
pstrCopyright
[output] Copyright
request_header
[input] referrer URL, can be NULL
request_data
[input] display options, include mapType, layerTypes... etc
bConvertToWGS84
[input] if true, convert to the World Geodetic System WGS84 standard
session_token
[input] NULL, reserved

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 LoadGoogleMapTiles_ex()
{
	double dMinLongitude = 110;
	double dMaxLongitude = 120;
	double dMinLatitude = 17;
	double dMaxLatitude = 25;
	int nZoomLevel = 6;
	
	LPCSTR key;//set api key here
	LPCSTR request_header;//set referrer URL here
	
	string request_data;
	request_data.Format("{\"mapType\":\"satellite\", \"layerTypes\":[\"layerRoadmap\"]}");
	
	string strCopyright;
	CvMat* ptrMat = (CvMat*)LoadGoogleMapTiles(
		dMinLongitude, dMaxLongitude, dMinLatitude, dMaxLatitude, nZoomLevel,
		key, &strCopyright, request_header, request_data, false, NULL);
	printf("Copyright: %s\n", strCopyright);
	if(ptrMat)
	{
		ocvMat mat;
		mat.SetFromMat(ptrMat, false);
		ImagePage gp;
		gp.Create();
		ImageLayer img;
		img = gp.Layers();
		img.SetMat(mat, true);
	}
}


Remark

See Also

LoadMapTiles

Header to Included

OImage.h

Reference