I have restaurants for which I have the following information in postgis:
Last name
longitude
latitude
address.
The address is divided into several tables with the foreign key notios so that I have a country table, a region table, etc.
I want to know the restaurants located in a region of a country (eg France).
So I have 2 solutions:
search in the country table, then region, then display the list of restaurants attached to the region
or
use the postgis polygon system.
I would like to have your opinion on which is the most efficient / the most relevant.
currently I use this query (which in my opinion can be improved):
"select *
from data where ST_Intersects(st_point(lon, lat) ,
" +
" ST_GeomFromGeoJSON('
" +
" %polygone*
"+
"')
" +
") = 'true' order by name";
Here the polygon object with the list of points (too long to write I name it% polygon for this question)
Thanking you.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…