<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head><body dir="auto"><div class="WordSection1"><p class="MsoNormal"><span style="mso-fareast-language:EN-US">Hi,</span></p><p class="MsoNormal"><span style="mso-fareast-language:EN-US"> </span></p><p class="MsoNormal"><span style="mso-fareast-language:EN-US"><a href="https://jumpinjackie.github.io/mapguide-maestro/userguide/mgtileseeder.html">https://jumpinjackie.github.io/mapguide-maestro/userguide/mgtileseeder.html</a></span></p><p class="MsoNormal"><span style="mso-fareast-language:EN-US"> </span></p><p class="MsoNormal"><span style="mso-fareast-language:EN-US">Pierre</span></p><p class="MsoNormal"><span style="mso-fareast-language:EN-US"> </span></p><p class="MsoNormal"><span style="mso-fareast-language:EN-US"> </span></p><div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm"><p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" lang="FR">De :</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" lang="FR"> mapguide-users <mapguide-users-bounces@lists.osgeo.org> <b>De la part de</b> Nimrod Cnaan via mapguide-users<br><b>Envoyé :</b> 1 mai 2024 13:20<br><b>À :</b> MapGuide Users Mail List <mapguide-users@lists.osgeo.org><br><b>Cc :</b> Nimrod Cnaan <nimcnaan@gmail.com><br><b>Objet :</b> [mapguide-users] Precache MapGuide REST tile.png</span></p></div><p class="MsoNormal"> </p><div><div><p class="MsoNormal"><span style="font-family:"Segoe UI",sans-serif;color:#0D0D0D">Hi, </span></p></div><div><p class="MsoNormal"> </p></div><div><p class="MsoNormal"><span style="font-family:"Segoe UI",sans-serif;color:#0D0D0D">Is there a way to write a script that makes requests to the MapGuide REST API,</span></p></div><div><p class="MsoNormal"><span style="font-family:"Segoe UI",sans-serif;color:#0D0D0D">causing the server to generate and store precache tiles ?</span></p></div><div><p class="MsoNormal"> </p></div><div><div><p class="MsoNormal"><span style="font-family:"Segoe UI",sans-serif;color:#0D0D0D">Assuming this will improve performance for the "External General XYZ Layer".</span></p></div></div><div><p class="MsoNormal"><span style="font-family:"Segoe UI",sans-serif;color:#0D0D0D">Something like:</span></p></div><div><p class="MsoNormal"> </p></div><div><p class="MsoNormal">import requests<br><br>server_url = '<a href="http://myserverurl/mapguide/rest/">http://myserverurl/mapguide/rest/</a>'<br>map_name = 'library/projectname/Maps/mymap.MapDefinition'<br>base_map_url = f'{server_url}tile/{map_name}/'<br><br># Define the zoom levels and tile ranges to precache<br>zoom_levels = [0, 1, 2, 3] # Example zoom levels<br>tile_range = range(0, 10) # Example tile range for x and y<br><br># Loop through each zoom level and tile range to request tiles<br>for zoom in zoom_levels<br> for x in tile_range<br> for y in tile_range<br> tile_url = f'{base_map_url}{zoom}{x}{y}.png'<br> response = requests.get(tile_url)<br> print(f'Requesting {tile_url} - Status {response.status_code}')<br><br> # Optional Implement some error handling and retry logic<br> if response.status_code != 200<br> print(f'Error retrieving tile at {zoom}{x}{y}')</p></div><div><p style="text-align:right;direction:rtl;unicode-bidi:embed" dir="RTL" class="MsoNormal"><span dir="LTR"> </span></p></div><p style="text-align:right;direction:rtl;unicode-bidi:embed" dir="RTL" class="MsoNormal"><span dir="RTL"></span><span dir="RTL"></span><span class="gmailsignatureprefix"><span style="font-family:"Times New Roman",serif" lang="AR-SA"><span dir="RTL"></span><span dir="RTL"></span>-- </span></span><span lang="AR-SA"></span></p><div><div><div><p style="text-align:right;direction:rtl;unicode-bidi:embed" dir="RTL" class="MsoNormal"><span style="font-family:"Arial",sans-serif" lang="HE">בכבוד רב,</span><span lang="AR-SA"></span></p></div><div><p style="text-align:right;direction:rtl;unicode-bidi:embed" dir="RTL" class="MsoNormal"><span style="font-family:"Times New Roman",serif" lang="AR-SA"> </span><span lang="AR-SA"></span></p></div><div><p style="text-align:right;direction:rtl;unicode-bidi:embed" dir="RTL" class="MsoNormal"><b><span style="font-family:"Arial",sans-serif;color:#000099" lang="HE">נמרוד כנען </span></b><b><span style="font-family:"Arial",sans-serif" lang="HE"> | </span></b><span style="font-family:"Arial",sans-serif;color:#7F7F7F" lang="HE">גיאומינד שירותי </span><span style="font-family:"Calibri",sans-serif;color:#7F7F7F" dir="LTR">GIS</span><span dir="RTL"></span><span dir="RTL"></span><span style="font-family:"Arial",sans-serif;color:#7F7F7F" lang="HE"><span dir="RTL"></span><span dir="RTL"></span> – פיתוח, ייעוץ ושירותי ענן</span><span lang="AR-SA"></span></p></div><div><p style="text-align:right;direction:rtl;unicode-bidi:embed" dir="RTL" class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:#7F7F7F" lang="HE">ישיר: 048101268 | נייד: 0525355483</span><span style="font-family:"Arial",sans-serif;color:#7F7F7F" lang="HE"> |</span><span style="font-family:"Arial",sans-serif" lang="HE"> <span style="color:#595959"><a href="mailto:nimrod@geomind.co.il"><span style="font-family:"Calibri",sans-serif;color:#595959" dir="LTR" lang="EN-US">nimrod@geomind.co.il</span></a></span></span><span lang="AR-SA"></span></p></div><div><p style="text-align:right;direction:rtl;unicode-bidi:embed" dir="RTL" class="MsoNormal"><span style="color:#1F497D" dir="LTR"><img src="http://geomind.co.il/GeomindLogo.png" id="_x0000_i1025" style="width:1.8437in;height:.5416in" height="52" width="177" border="0"></span><span lang="AR-SA"></span></p></div><p style="margin:0cm;text-align:right;direction:rtl;unicode-bidi:embed" dir="RTL"><span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:black" lang="HE">נא בקרו באתר החדש שלנו</span><span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:red" lang="HE"> </span><span style="font-size:10.0pt;font-family:"Arial",sans-serif" lang="HE"><a href="http://geomind.co.il/"><span style="font-family:"Calibri",sans-serif" dir="LTR" lang="EN-US">http://geomind.co.il</span></a></span><span lang="AR-SA"></span></p></div></div></div></div></body></html>