Select to view content in your preferred language

Converting XYZ tile request to govmap.gov.il requset which use EPSG:2039

598
1
10-18-2023 09:59 AM
FIXERROR
New Contributor II

Hi

How to convert tile (x,y) as is the case with Google Maps, which is based on a regular Mercator. To columns and rows for the govmap website that the coordinates are Israel Transverse Mercator (ITM)

How do I set the coordinates to this URL: https://cdn.govmap.gov.il/020522B0B20R/L10/R00012d82/C0001013f.jpg

Based on this: https://cdn.govmap.gov.il/020522B0B20R/L{level}/R{row}/C{col}.png or jpg

I am using C# .net

I tried this but it didn't work:

var url = "https://cdn.govmap.gov.il/M2023ORT3TS/{zoom_gov}/{y_gov}/{x_gov}.jpg";

int til_x = (Convert.ToInt32(x));
int til_y = (int)Math.Pow(2, z) - Convert.ToInt32(y) - 1;
url = url.Replace("{zoom_gov}", "L" + ZOOM_LAYER_ALI.Split(',')[0]);
url = url.Replace("{y_gov}", "R" + til_y.ToString("X8").ToLower());
url = url.Replace("{x_gov}", "C" + til_x.ToString("X8").ToLower());`

Tags (2)
0 Kudos
1 Reply
FIXERROR
New Contributor II

//Scale,CenterTileX,CenterTileY,CenterTileOffsetX,CenterTileOffsetY
static string ZOOM_LAYERS_ALI(int zoom_mercator)
{
if (zoom_mercator == 10)
{
return "02,500000,164,190,226,120";
}
else if (zoom_mercator == 11)
{
return "03,250000,329,380,193,242";
}
else if (zoom_mercator == 12)
{
return "04,100000,824,952,104,96";
}
else if (zoom_mercator == 13)
{
return "05,50000,1648,1904,209,190";
}
else if (zoom_mercator == 14)
{
return "06,25000,3297,3809,160,119";
}
else if (zoom_mercator == 15)
{
return "07,10000,8244,9523,22,164";
}
else if (zoom_mercator == 16)
{
return "08,5000,16488,19047,48,70";
}
else if (zoom_mercator == 17)
{
return "09,2500,32976,38094,95,135";
}
else if (zoom_mercator == 18)
{
return "10,1250,65952,76189,191,12";
}
else if (zoom_mercator == 19)
{
}
return "";
}

0 Kudos