28 August 2009

Which location column more trusted?

You have database from your client with fields state, district (description of locations), and the_geom (latitude/longitude) column. Example of the db

| state | district | the_geom |
| Selangor | Petaling | POINT(101.497838106615 3.27468487066054) |


Anyone doing GIS should know that, the state, district fields is duplicate with the_geom since once we know the latitude/longitude we will know the state, district.
The problem is the_geom is not within Selangor, Petaling. Then when do group by st_intersects, the value is wrong since the_geom is refer to other place!

So, need to decide, which location column more trusted?
The latitude/longitude or description of locations.