JSFiddle - React, Tailwind, and code Playground

by SIGC GUADALTEL

HTML

<script src="https://npmcdn.com/@turf/[email protected]/turf.min.js"></script>

JavaScript

var pt = {
  "type": "Feature",
  "properties": {
    "marker-color": "#0f0"
  },
  "geometry": {
    "type": "Point",
    "coordinates": [-111.873779, 40.647303]
  }
};
var poly1 = {
  "type": "Feature",
  "properties": {
  	"name": "poly1"
  },
  "geometry": {
    "type": "Polygon",
    "coordinates": [[
      [-112.074279, 40.52215],
      [-112.074279, 40.853293],
      [-111.610107, 40.853293],
      [-111.610107, 40.52215],
      [-112.074279, 40.52215]
    ]]
  }
};
var poly2 = {
  "type": "Feature",
  "properties": {
  	"name": "poly2"
  },
  "geometry": {
    "type": "Polygon",
    "coordinates": [[
      [-70.074279, 40.52215],
      [-70.074279, 40.853293],
      [-89.610107, 40.853293],
      [-89.610107, 40.52215],
      [-110.074279, 40.52215]
    ]]
  }
};
alert([poly1, poly2].filter(p => turf.inside(pt, p))[0].properties.name);