In general, you will need to convert those boundaries to areal representations first to be able to query them for cointaining your point. I opt for ST_Polygonize
as it constructs exact (minimal possible) polygons from a collection of (MULTI)LINSESTRINGs, closing any gaps of the input geometries.
I had a quick look at the data; the boundary geometries are rather tricky...
It seems every subdistrict consists of multiple MULTILINESTRINGs, each matching only the border line to another subdistrict. The common attribute for each subdistrict is the fid_tha_ad, while the names for the administrative areas can have duplicates throughout the country.
The following query returns the areal representation, grouped by by fid_tha_ad and the non-thai admin names, that contains your point:
SELECT *
FROM (
SELECT fid_tha_ad,
prov_name,
amp_name,
tam_name,
(ST_Dump(ST_Polygonize(geom))).geom AS geom
FROM <your_boundary_table_name>
GROUP BY fid_tha_ad,
prov_name,
amp_name,
tam_name
) AS area
WHERE ST_Contains(
area.geom,
st_transform(
st_setsrid(
st_makepoint(100.634330, 13.669349),
4326
),
32647
)
)
You can add/replace the necessary column names both in the SELECT
and GROUP BY
clauses of the subquery. If you want to refer your original data to the results, use the fid_tha_ad column.
Hope that helps?