1

to make WFS map

<script type="text/javascript">

 
    var map = L.map('map').setView([37.576044, 126.977019], 15);
    
    var tiles = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
        minZoom: 1,
        maxZoom: 19,
        attribution: '© OpenStreetMap'
    }).addTo(map);
    
     $.ajax('http://localhost:8888/geoserver/TestWorkspace/wfs', {
         type : 'GET',
         data : {
             service : 'WFS',
             version : '1.1.1',
             request : 'GetFeature',
             typename : 'TestWorkspace:Test',
             srsname : 'EPSG:4326',
             outputFormat : 'json'
         },
         dataType : 'json',
         transparent : true,
         success : function(data) {
             debugger;
             L.geoJson(data).addTo(map);
             
         },
         error : function(e) {
             debugger;
             console.log("err : " + e);
         }
     });
     
    //click for max zoom
    map.on('click', function zoomToFeature() {
        map.fitBounds();
    });
    

I made my map to show with polygon. after that I try to zoom it with click but it's not working.

if you have any idea about option plz give me advise.

Ian Turton
  • 10,018
  • 1
  • 28
  • 47
  • 1
    L.FitBounds expect a L.LatLngBounds as parameter and L.LatLngBounds expects two L.LatLng objects as parameter. – Gurgolo Aug 24 '22 at 06:16

0 Answers0