Re: [mapguide-users] Precache MapGuide REST tile.png
Hi, https://jumpinjackie.github.io/mapguide-maestro/userguide/mgtileseeder.html Pierre De : mapguide-users De la part de Nimrod Cnaan via mapguide-usersEnvoyé : 1 mai 2024 13:20À : MapGuide Users Mail List Cc : Nimrod Cnaan Objet : [mapguide-users] Precache MapGuide REST tile.png Hi, Is there a way to write a script that makes requests to the MapGuide REST API,causing the server to generate and store precache tiles ? Assuming this will improve performance for the "External General XYZ Layer".Something like: import requestsserver_url = 'http://myserverurl/mapguide/rest/'map_name = 'library/projectname/Maps/mymap.MapDefinition'base_map_url = f'{server_url}tile/{map_name}/'# Define the zoom levels and tile ranges to precachezoom_levels = [0, 1, 2, 3] # Example zoom levelstile_range = range(0, 10) # Example tile range for x and y# Loop through each zoom level and tile range to request tilesfor zoom in zoom_levels for x in tile_range for y in tile_range tile_url = f'{base_map_url}{zoom}{x}{y}.png' response = requests.get(tile_url) print(f'Requesting {tile_url} - Status {response.status_code}') # Optional Implement some error handling and retry logic if response.status_code != 200 print(f'Error retrieving tile at {zoom}{x}{y}') -- בכבוד רב, נמרוד כנען | גיאומינד שירותי GIS – פיתוח, ייעוץ ושירותי ענןישיר: 048101268 | נייד: 0525355483 | nim...@geomind.co.ilנא בקרו באתר החדש שלנו http://geomind.co.il___ mapguide-users mailing list mapguide-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapguide-users
Re: [mapguide-users] Precache MapGuide REST tile.png
I have never tried this, but it looks promising for priming any xyz layer. https://github.com/dechristopher/xyz On Wed, 1 May 2024, 18:20 Nimrod Cnaan via mapguide-users, < mapguide-users@lists.osgeo.org> wrote: > Hi, > > Is there a way to write a script that makes requests to the MapGuide REST > API, > causing the server to generate and store precache tiles ? > > Assuming this will improve performance for the "External General XYZ > Layer". > Something like: > > import requests > > server_url = 'http://myserverurl/mapguide/rest/' > map_name = 'library/projectname/Maps/mymap.MapDefinition' > base_map_url = f'{server_url}tile/{map_name}/' > > # Define the zoom levels and tile ranges to precache > zoom_levels = [0, 1, 2, 3] # Example zoom levels > tile_range = range(0, 10) # Example tile range for x and y > > # Loop through each zoom level and tile range to request tiles > for zoom in zoom_levels > for x in tile_range > for y in tile_range > tile_url = f'{base_map_url}{zoom}{x}{y}.png' > response = requests.get(tile_url) > print(f'Requesting {tile_url} - Status {response.status_code}') > > # Optional Implement some error handling and retry logic > if response.status_code != 200 > print(f'Error retrieving tile at {zoom}{x}{y}') > > -- > > בכבוד רב, > > *נמרוד כנען** | *גיאומינד שירותי GIS – פיתוח, ייעוץ ושירותי ענן > ישיר: 048101268 | נייד: 0525355483 | nim...@geomind.co.il > > נא בקרו באתר החדש שלנו http://geomind.co.il > > ___ > mapguide-users mailing list > mapguide-users@lists.osgeo.org > https://lists.osgeo.org/mailman/listinfo/mapguide-users > ___ mapguide-users mailing list mapguide-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapguide-users
[mapguide-users] Precache MapGuide REST tile.png
Hi, Is there a way to write a script that makes requests to the MapGuide REST API, causing the server to generate and store precache tiles ? Assuming this will improve performance for the "External General XYZ Layer". Something like: import requests server_url = 'http://myserverurl/mapguide/rest/' map_name = 'library/projectname/Maps/mymap.MapDefinition' base_map_url = f'{server_url}tile/{map_name}/' # Define the zoom levels and tile ranges to precache zoom_levels = [0, 1, 2, 3] # Example zoom levels tile_range = range(0, 10) # Example tile range for x and y # Loop through each zoom level and tile range to request tiles for zoom in zoom_levels for x in tile_range for y in tile_range tile_url = f'{base_map_url}{zoom}{x}{y}.png' response = requests.get(tile_url) print(f'Requesting {tile_url} - Status {response.status_code}') # Optional Implement some error handling and retry logic if response.status_code != 200 print(f'Error retrieving tile at {zoom}{x}{y}') -- בכבוד רב, *נמרוד כנען** | *גיאומינד שירותי GIS – פיתוח, ייעוץ ושירותי ענן ישיר: 048101268 | נייד: 0525355483 | nim...@geomind.co.il נא בקרו באתר החדש שלנו http://geomind.co.il ___ mapguide-users mailing list mapguide-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapguide-users