locationtech / locationtech/spatial4j
Given latitude and longitude, how to find in what country those coordinates are?
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 961
- Forks
- 172
- PR merge metrics
- No merged PRs in 30d
Description
This is more of a question as I need help to figure out...
So as ti title says:
Given latitude and longitude, how to find in what country those coordinates are?
I have geojson file with country borders. Each country is represented with either Polygon or MultiPolygon. If I understand correctly, those coordinates that are inside geojson file are longitude and latitude in EPSG:4236 CRS. Because of that I cannot just check relation between Point (longitude, latitude) and Polygon because it might give error because operation/methods from this library and JTS does not take into account curvature of earth.
So my idea is first to convert all geometries from EPSG:4326 to Google Mercator, and then convert given longitude and latitude, and finally perform contains and intersect operations?
Am I on the right way? Or can I directly use geometries without transformation from one CRS to another (I am willing to tolerate some error, like some near border cases)?
Also for the optimization purposes, I would build quad tree and boundary box checks...
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Begin with the issue's GeoJSON and EPSG:4326/JTS question; no source files, tests, or entry points are named. Before work can be considered done, the project would need a decided implementation or documented answer for country lookup, including acceptable border-case behavior and the optimization approach.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100