Get extent of WMS layer dynamically in Leafletjs

This page summarizes the projects mentioned and recommended in the original post on dev.to

Our great sponsors
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • axios

    Promise based HTTP client for the browser and node.js

  • For the geoJSON data, we can get the map to extend directly using getBounds function on the map object. The getBounds is not available for the WMS standard. So we can not get the map bounds and can not zoom the required WMS layer to the map dynamically. But Unfortunately, we can get the required bounding box information through getCapabilities request. I am using axios for the HTTP client as below,

  • wms-capabilities

    WMS GetCapabilities to JSON

  • The response from the above request will provide you the XML as the response data. Since the data output is in XML, first of all, you need to JSON and you can filter the bbox for the required layer. The easiest way to convert it is by using wms-capabilities. First of all, you need to include this library in your code.

  • SurveyJS

    Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.

    SurveyJS logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts