**New here?**Learn about Bountify and follow @bountify to get notified of new bounties! Follow @bountify x

We have a geojson file with a lot of polygons in it. Here is an example geojson file of our data

https://gist.github.com/quotient/2b59d0cfa9d41127aabe78d283aa5334

What we need to do is accept a long lat input and then be able to lookup if the point is inside one of these geojson polygons or not. If it does match we will return some of the meta info about that polygon

For the bounty we have 3 inputs. Long, Lat, geojson file. (in repl.it you might be able to just have a static file with your code so we dont need to upload it at runtime). Then we have a button that says “Lookup”. If we dont have a match you can just return “false”, if we do have a match you can return a json reply with something like https://gist.github.com/quotient/7b665ca4cec77dca244cefedf2dc43ab i suppose we need to handle the case where there is more than 1 match, its rare but would be good to assume it.Last data piece we should include is processing time. This is so we can get an idea of the overall performance of the solution. I am thinking something like `Scanned X polygons in Y ms`

. We will use this as a metric in awarding the winner.

Bounty proof should be posted to Repl.it so we can run it easily and confirm it working. One note, it would be acceptable if you need to transform the geojson data structure to something more efficient( compact and fast), but we will need to understand the code of the transform so we can replicate it.

## 2 Solutions

Hi QDev,

I think this repl.it should do the work you need. I can't test solution precisely because I don't have a point that is inside one of the GeoJSON polygon you provided. Do you have any coordinate that is inside a polygon and that we can test with ?

- For MultiPolygon I assume that if one polygon is defined in another one, it's considered as an hole.
- For LineString, I ignore them as it is not a closed polygon.

The interface should ask for longitude and latitude at the beginning.

Best regards.

Hello Qdev,

here's my solution using Turf.js library: https://replit.com/@radosinsky/PointInPolygon

Here are some points you can test:

Check this map with the polygons: https://www.google.com/maps/d/u/0/viewer?mid=1ZTltfSN-pziGuUCU_Wp906LJtpY&hl=en_US&ll=40.80708639806739%2C-73.95120677357193&z=17

Coordinates of the VINATERÍA restaurant (outside of the polygon) are:

**40.80662358271101, -73.95403116539366**

`Point [40.80662358271101, -73.95403116539366] found in 0/140 polygon(s).`

- Coordinates of the Des Ambassades restaurant (inside of the polygon) are:
**40.806116202361565, -73.95388702757946**

`{ Name: 'New York, NY', description: '', tessellate: -1, OBJECTID: '79', EZECNAME: 'New York, NY Empowerment Zone',...`

`Point [40.806116202361565, -73.95388702757946] found in 1/140 polygon(s).`

I choose those two points to show that the script works with multipolygons too.

Note that the execution time is much longer while on repl.it (usually 1 to 3 seconds). It takes ~100ms on my computer to check all 140 polygons from the provided geojson file.

Let me know if this solves your problem or if you have any questions. Thank you!