You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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...
The text was updated successfully, but these errors were encountered:
Most libraries don't take into consideration curvature of the earth in a direct sense, but if the polygons have sufficient detail and if the data isn't too close to the poles (where some projections lose accuracy), then this is a moot point. Also keep in mind that some polygons were plotted/authored in one projection but the gets re-projected to another afterwards and then the polygon could become technically invalid according to the 2 dimensional rules that JTS and most 2D systems expect. Basically a line that didn't intersect another vertex will after re-projection. But again, with sufficient detail, it won't happen. Another problem that can happen is that you think/hope regional polygons don't overlap but they may actually slightly on the edges if there were re-projection / translations.
So in summary, I wouldn't worry about it but if you see polygon errors, you may need more detail.
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...
The text was updated successfully, but these errors were encountered: