Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

181
Views
how do create a geo location login system using Node.Js

I want to create a system where user can login only if the user is in a radius of the given location.
I am using node.js, express.js, MongoDB.
Can someone please guide me what packages/Services should I use and how do I approach this problem

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You have to make a boundary with geojson of your coverage area. To know your user location first of all get the user's current location with the device they use. store it in MongoDB. After getting the latitude or longitude of the user, use polygon-lookup npm package to identify the user is within your polygon radius or not.

If the user is in the location or not you can create a function like below -

    let geoJsonMapData =
    {
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {},
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [
              90.48509359359743,
              23.823275544984423
            ],
            [
              90.33422470092773,
              24.011030495565834
            ],
            [
              90.32435417175293,
              23.77529123645138
            ],
            [
              90.50283908843996,
              23.580546882813223
            ],
            [
              90.50519943237305,
              23.592031281422017
            ],
            [
              90.47208085656167,
              23.80909744710711
            ],
            [
              90.48509359359743,
              23.823275544984423
            ]
          ]
        ]
      }
    }
  ]
};
const check_in_radius_or_not = (longitude, latitude) =>{
            var lookup = new PolygonLookup( geoJsonMapData );
            var poly = lookup.search( longitude, latitude );
            
            if(poly){
                return 1;
            }else{
                return 0;
            }
        }

If the function returns 1 they will be within the radius and able to log in, else if return 0 they are not within the given boundary and not able to log in.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!