Question

Extract specific text from doc

  • 10 February 2021
  • 3 replies
  • 1 view

Badge +10

Hello there, I need to extract a all text between  

 var layer = L.geoJson

and

addTo(map)

 

from the below structure,

any suggestion, please

 

 

<!DOCTYPE html>

<html>

  <head>

   <title>Report</title>

   <meta charset="UTF-8">

   <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet">

  </head>

  <body>

   <div id="mapHTMLReportGenerator_41" style="width:100%;height:500px;"></div>

   <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.3.4/leaflet.css" />

   <script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.3.4/leaflet.js"></script>

        <script src="https://unpkg.com/esri-leaflet@2.2.3/dist/esri-leaflet.js"></script>

   <script>

     var map = L.map('mapHTMLReportGenerator_41').setView([0, 0], 3);

           L.esri.basemapLayer("Imagery").addTo(map);

     var layer = L.geoJson(

      [

 {

  "type":"Feature",

  "properties":{

   "name":"C8-R10",

   "popupContent":"C8-R10"

  },

  "geometry":{

   "type":"Polygon",

   "coordinates":[

    [

     [

      46.5804295755338,

      24.72322090684373

     ],

     [

      46.5804295755338,

      24.743220906843728

     ],

     [

      46.6004295755338,

      24.743220906843728

     ],

     [

      46.6004295755338,

      24.72322090684373

     ],

     [

      46.5804295755338,

      24.72322090684373

     ]

    ]

   ]

  }

 },

 {

  "type":"Feature",

  "properties":{

   "name":"C8-R11",

   "popupContent":"C8-R11"

  },

  "geometry":{

   "type":"Polygon",

   "coordinates":[

    [

     [

      46.5804295755338,

      24.743220906843728

     ],

     [

      46.5804295755338,

      24.763220906843728

     ],

     [

      46.6004295755338,

      24.763220906843728

     ],

     [

      46.6004295755338,

      24.743220906843728

     ],

     [

      46.5804295755338,

      24.743220906843728

     ]

    ]

   ]

  }

 }

],

      {

        onEachFeature: function (feature, layer) {

          layer.bindPopup(feature.properties.popupContent);

        },

        style:{"color": "rgb(0,0,255)"}

      }).addTo(map);

     map.fitBounds(layer.getBounds());

   </script>

  </body>

</html>

 


3 replies

Userlevel 1
Badge +10

Do you actually need this bit? Or are you just trying to extract the json?

 {
 
        onEachFeature: function (feature, layer) {
 
          layer.bindPopup(feature.properties.popupContent);
 
        },
 
        style:{"color": "rgb(0,0,255)"}
 
      }).addTo(map);

 

Badge +10

Do you actually need this bit? Or are you just trying to extract the json?

 {
 
        onEachFeature: function (feature, layer) {
 
          layer.bindPopup(feature.properties.popupContent);
 
        },
 
        style:{"color": "rgb(0,0,255)"}
 
      }).addTo(map);

 

Yes  I do need it ,  the goal is to use it into the HTML generator to construct multiple layer with different style 

Badge +2

Hi @boubcher​ 

 

Try a StringSearcher with the regex set to 

var layer.+(map)\);

Screen Shot 2021-02-12 at 12.17.48 PM

Reply