From 211f7a789a60a529d33c86c6c0374aba4cdf6f68 Mon Sep 17 00:00:00 2001 From: Birk Skyum Date: Sat, 2 Nov 2024 13:13:00 +0100 Subject: [PATCH] Accurate projection naming --- src/reference/v8.json | 15 +++++++++------ src/validate/validate_projection.test.ts | 6 +++--- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/reference/v8.json b/src/reference/v8.json index be7d35092..0bc089b85 100644 --- a/src/reference/v8.json +++ b/src/reference/v8.json @@ -129,7 +129,7 @@ "type": "projection", "doc": "The projection configuration. **Note:** this definition is still experimental and is under development in maplibre-gl-js.", "example": { - "type": "globe" + "type": "web-mercator" } }, "terrain": { @@ -4538,7 +4538,7 @@ ] }, "transition": true, - "doc": "How to blend the atmosphere. Where 1 is visible atmosphere and 0 is hidden. It is best to interpolate this expression when using globe projection." + "doc": "How to blend the atmosphere. Where 1 is visible atmosphere and 0 is hidden. It is best to interpolate this expression when using globe-to-web-mercator projection." } }, "terrain": { @@ -4572,13 +4572,16 @@ "type": { "type": "enum", "doc": "The projection type.", - "default": "mercator", + "default": "web-mercator", "values": { - "mercator": { - "doc": "The Mercator projection." + "web-mercator": { + "doc": "Web Mercator projection." }, "globe": { - "doc": "The globe projection." + "doc": "\"Static Globe\". Spherical projection." + }, + "globe-to-web-mercator": { + "doc": "\"Adaptive Globe\". Transition from a Spherical projection to a Web Mercator projection on zoom." } } } diff --git a/src/validate/validate_projection.test.ts b/src/validate/validate_projection.test.ts index a0c02f8a3..4c395b2d5 100644 --- a/src/validate/validate_projection.test.ts +++ b/src/validate/validate_projection.test.ts @@ -26,13 +26,13 @@ describe('Validate projection', () => { test('Should return errors according to spec violations', () => { const errors = validateProjection({validateSpec, value: {type: 1 as any}, styleSpec: v8, style: {} as any}); expect(errors).toHaveLength(1); - expect(errors[0].message).toBe('type: expected one of [mercator, globe], 1 found'); + expect(errors[0].message).toBe('type: expected one of [web-mercator, globe, globe-to-web-mercator], 1 found'); }); test('Should pass if everything is according to spec', () => { - let errors = validateProjection({validateSpec, value: {type: 'globe'}, styleSpec: v8, style: {} as any}); + let errors = validateProjection({validateSpec, value: {type: 'spherical-to-web-mercator'}, styleSpec: v8, style: {} as any}); expect(errors).toHaveLength(0); - errors = validateProjection({validateSpec, value: {type: 'mercator'}, styleSpec: v8, style: {} as any}); + errors = validateProjection({validateSpec, value: {type: 'web-mercator'}, styleSpec: v8, style: {} as any}); expect(errors).toHaveLength(0); }); });