{"uid":"cap_E89X6pMm7pAYvRMaaKi4E","slug":"map-tile-maths-zoom-for-extent-f87dd0fe","name":"Map Tile Maths – Zoom for Extent","description":"Highest map zoom level at which a lat/lon bounding box fits a viewport of given pixel size, with centre and tile span.","url":"https://map-tiles.x402tookit.com/zoom-for-extent?utm_source=zero.xyz","method":"GET","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method"],"properties":{"type":{"type":"string","const":"http"},"method":{"enum":["GET"],"type":"string"},"queryParams":{"type":"object","required":["west","south","east","north"],"properties":{"east":{"type":"number","description":"East longitude"},"west":{"type":"number","description":"West longitude"},"north":{"type":"number","description":"North latitude"},"south":{"type":"number","description":"South latitude"},"paddingPx":{"type":"integer","description":"Padding on every side in pixels (default 0)"},"viewportWidth":{"type":"integer","description":"Map viewport width in pixels (default 800)"},"viewportHeight":{"type":"integer","description":"Map viewport height in pixels (default 600)"}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","properties":{"asOf":{"type":["null","string"]},"zoom":{"type":["null","number"]},"source":{"type":["null","string"]},"reasons":{"type":["array","null"],"items":{"type":"string"}},"summary":{"type":["null","string"]},"verdict":{"type":["null","string"]},"degraded":{"type":["boolean","null"]},"limitedBy":{"type":["null","string"]},"tileCount":{"type":["null","number"]},"tilesHigh":{"type":["null","number"]},"tilesWide":{"type":["null","number"]},"disclaimer":{"type":["null","string"]},"notChecked":{"type":["array","null"],"items":{"type":"string"}},"centerLatitude":{"type":["null","number"]},"fractionalZoom":{"type":["null","number"]},"centerLongitude":{"type":["null","number"]},"clampedToMaxZoom24":{"type":["boolean","null"]}}}}}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.02","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.02/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_xtjEtSu-Tv0FCd48xJsy_","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.02","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Calculates the highest slippy-map zoom level at which a lat/lon bounding box fits inside a given pixel viewport, returning the optimal zoom, map centre, and tile span.","exampleAgentPrompt":"What's the highest zoom level that fits the bounding box west=-0.35, south=51.38, east=0.15, north=51.70 into a 1024×768 pixel map viewport? Also tell me the center coordinates and how many tiles wide and high it will be.","exampleUseCases":[{"title":"Auto-zoom a city overview map","prompt":"I need to display Greater London on a map in an 800×600 pixel panel — what's the best zoom level that fits the bounding box west=-0.51, south=51.28, east=0.33, north=51.69, and where should I centre the map?"},{"title":"Tile budget planning for a map feature","prompt":"If I want to show the state of Colorado (west=-109.05, south=36.99, east=-102.04, north=41.00) in a 1280×720 viewport, what zoom level fits it all in, and how many tiles will that take?"},{"title":"Responsive map thumbnail generation","prompt":"For a thumbnail map that's only 256×256 pixels, what's the highest zoom that still fits the bounding box west=2.25, south=48.82, east=2.42, north=48.90 with 8 pixels of padding on each side?"}],"resultDescription":"Returns an integer zoom level (and fractional zoom), the centre latitude and longitude, the number of tiles wide and high needed, total tile count, which axis was the limiting constraint, whether the result was clamped to the maximum zoom of 24, and a human-readable summary string. Includes optional degraded/disclaimer flags.","failureModes":["Missing required bounding box parameters (west/south/east/north) returns a 4xx error","Bounding box crossing the antimeridian may produce unexpected results","Invalid coordinate ranges (e.g. north < south) may return an error or nonsensical zoom","Viewport dimensions of zero or negative values may cause computation errors","Payment failure or missing x402 payment header returns a 402 Payment Required response"],"whenToPreferThis":"Use this endpoint when you need to programmatically determine the correct slippy-map zoom level to fit a geographic bounding box into a specific pixel viewport — for example when generating map thumbnails, configuring map widgets, planning tile downloads, or preparing map embed parameters. It is the canonical choice over manual zoom estimation when you need the exact highest valid zoom, the map centre, and tile span in one call.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-29T13:08:19.142Z","isFirstParty":false,"canonicalSlug":"map-tile-maths-zoom-for-extent-f87dd0fe"}