0% found this document useful (0 votes)
2 views

satelite code

Uploaded by

krutik
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

satelite code

Uploaded by

krutik
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

var countiesTiles = {

getTileUrl: function (coord, zoom) {

// Compose URL for overlay tile


var s = Math.pow(2, zoom);
var twidth = 512;
var theight = 512;

//latlng bounds of the 4 corners of the google tile


//Note the coord passed in represents the top left hand (NW) corner of
the tile.
var gBl = window.map.getProjection().fromPointToLatLng(new
google.maps.Point(coord.x * twidth / s, (coord.y + 1) * theight / s)); // bottom
left / SW
var gTr = window.map.getProjection().fromPointToLatLng(new
google.maps.Point((coord.x + 1) * twidth / s, coord.y * theight / s)); // top right
/ NE

// Bounding box coords for tile in WMS pre-1.3 format (x,y)

var bbox = parseFloat(gBl.lng()) + "," + parseFloat(gBl.lat()) + "," +


parseFloat(gTr.lng()) + "," + parseFloat(gTr.lat());

console.log(bbox);

//base WMS URL


var url = "https://api-dev.agrovis.io/partner-api/v1/image/wms/custom";

url += "?apiKeyImage=" + $('#aik').val();


url += "&imageTypeName=Sentinel-2";
//url += "&imageDate=2023-07-09T00%3A00%3A00.000Z";
url += "&imageDate=" + encodeURIComponent(date);
url += "&imageIndexName=" + layerTypeId;
if (layerTypeId == "PlantHealth")
url += "&imageIndexSubName=General";
//url += "&fieldId=3608471c-d580-4594-b5e8-673e4da9a638";
url += "&crs=EPSG%3A4326";
url += "&bbox=" + encodeURIComponent(bbox);
console.log(url);
return url
//return `wms(${url})`
},
tileSize: new google.maps.Size(512, 512),
opacity: 0.85,
isPng: true
};

var customMapType = new google.maps.ImageMapType(countiesTiles);


//window.map.overlayMapTypes.insertAt(0, customMapType);
window.map.overlayMapTypes.push(customMapType);

Url'deki
apiKeyImage => the key i me tioned
imageTypeName => thr Name in request
imageDate => rrquest Day
imageIndexName => layer name
imageIndexSubName => if imageIndexName = PlantHealth this vill be added and value
will be General
crs => EPSG%3A4326 (always)
bbox => calculate like upside. Corners of map . Haritanın köşe bilgileri bottom-
left lng, bottom-left lat, top-right lng, top-right lat

You might also like