I used this query to extract all village names with lat lon coords:
Example:
As you can see name Adamov listed 3 times. How to get all village names with lat lon coords without duplicate village names? Even if lat lon of the same village name are significantly different asked 27 Sep '21, 14:59 akulin |
I'm not familiar with PostgreSQL and PostGIS specifics but in general SQL you could do that with an aggregate function. Something like this:
answered 28 Sep '21, 09:04 TZorn 2
Agreed this is a standard SQL problem, solvable using Window functions. The Postgres reference is here https://www.postgresql.org/docs/9.1/functions-window.html
(28 Sep '21, 09:43)
SK53 ♦
Works ok with MIN()
(28 Sep '21, 10:32)
akulin
|
answered 27 Sep '21, 17:01 akulin I doubt that works since the coordinates are not DISTINCT and as such the query would still return all lines. But maybe DISTINCT is handled differently in PostgreSQL/PostGIS than in other SQL dialects.
(28 Sep '21, 09:06)
TZorn
|
Do you mean that where several different villages have the same name, you only want to extract one of them? But then which lat/lon do you want to extract?
I need the first available coordinates, just ignore the others. Like for Adamov will be used only first point from my "Example"
I guess it shoud be something with DISTINCT(name)