T
T
tincap2018-05-25 22:39:05
PHP
tincap, 2018-05-25 22:39:05

How to determine the country by coordinates?

There is an array like:

location => Array(
   [lng] => 33.52
   [lat] => 44.60
)

How can I determine the location in PHP using these coordinates?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
pfg21, 2018-05-26
@tincap

use reverse geocoding from the Osmo nominatim i.e.
nominatim.openstreetmap.org/reverse.php?format=xml...
query language see Nominatim

M
Moskus, 2018-05-25
@Moskus

The task is called reverse geocoding.
https://github.com/daveross/offline-country-revers...
You can do it differently if you take border data, load it into a database with spatial functions (PostGIS, SpatiaLite) and make a simple query to find a point inside that or other geometry.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question