Problem/Motivation

When using Esri Ocean Map, it returns a 500 error.

Steps to reproduce

Choose Esri Ocean Map on a Leaflet Map.

Proposed resolution

Change current $esri_name to 'Ocean/World Ocean Base'

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

jrochate created an issue. See original summary.

jrochate’s picture

I have used hook_leaflet_map_info_alter to change this to my use case.
Something like this:

function MYMODULE_leaflet_map_info_alter(array &$map_info) {
  // Use headless protocol rather than logic based on global $is_https;
  $prot = '//';
  $zyx = '{z}/{y}/{x}.png';
  $attr_esri = 'Tiles &copy; <a href="https://esri.com">Esri</a>';

  $esri_names = [
    'Ocean/World Ocean Base',
    'Ocean/World Ocean Reference',
  ];
  foreach ($esri_names as $esri_name) {
    $code = str_replace(' ', '_', $esri_name);
    $url_template = $prot . "server.arcgisonline.com/ArcGIS/rest/services/$code/MapServer/tile/$zyx";
    switch ($esri_name) {
      case 'Ocean/World Ocean Base':
        $label = 'New Esri Ocean (zoom 0..10)';
        $settings['maxZoom'] = 10;
        break;

        case 'Ocean/World Ocean Reference':
        $label = 'New Esri Ocean Reference (zoom 0..10)';
        $settings['maxZoom'] = 10;
        break;
    }
    $map_info['esri-' . mb_strtolower($code)] = [
      'label' => $label,
      'description' => $label,
      'settings' => $settings,
      'layers' => [
        'layer' => [
          'urlTemplate' => $url_template,
          'options' => ['attribution' => $attr_esri],
        ],
      ],
    ];
  }
}
ressa’s picture

Assigned: Unassigned » ressa

ressa’s picture

Version: 2.1.3 » 2.1.x-dev
Status: Active » Needs review
ressa’s picture

Thanks for reporting @jrochate, I create a Merge Request which should fix it, and tiles are now requested from this URL:

https://server.arcgisonline.com/ArcGIS/rest/services/Ocean/World_Ocean_B...

ressa’s picture

Assigned: ressa » Unassigned

  • berramou committed b7d22e8d on 2.1.x
    Issue #3335451: Current Esri Ocean Map is broken
    
berramou’s picture

I can't merge https://git.drupalcode.org/project/leaflet_more_maps/-/merge_requests/6 so i commit it directly.
Than you @ressa.

berramou’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.