0

Given a Country Code and a Lat Lng pair, I want to find whether it is inside that country or not? What is the way to do it? Is there an algorithmic way to do this? I can accept certain amount of error.

I am node.js to implement this. Currently I do API call for Google to find the Country of the point. https://developers.google.com/maps/documentation/javascript/examples/geocoding-reverse But that doesn't full fill my performance requirement.

3
  • What software are you using? There are a number of ways but much depends on the tools you have available. Sep 26, 2014 at 14:24
  • 1
    @andunslg This question does not meet the site requirements. Please provide more detail. i.e. software, programming capability, api experience, etc.
    – Brad Nesom
    Sep 26, 2014 at 14:25
  • Sorry, I have edit the question!
    – andunslg
    Sep 26, 2014 at 14:27

1 Answer 1

1

Since you are using Node.js, you can use the Node.js module for GDAL. Get country outlines (e.g. GSHHS data set from here). Then simply script a point in a polygon algorithm using GDAL (several approaches are possible but a simple one is to test for an intersect between your point and the appropriate country polygon).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.