It’s Khayer, Bangladesh


POI Finding using Google map and PostGIS

Google map and PostGis both are very nice tools for GIS application development. PostGis is an Open Source spatial database which support almost every spatial operation. We can give unique features in web application by combining Google Map and PostGis.
GmapPostGis
I want to developed an web page where use input an lat/lon of a location and distance. Then the application search all the POI(points) within this buffer an display them in Google map. I have a shape file in ESRI format shape file.

In above scenario, we can give the solution very easily using google map and PostGis. To do that, first we need to import shape file to PostGis. Secondly, have to make a PostGis query based on point and buffer area.Then will display query result in the Google map. Check the below link,

Click Here

Another post in this blog i have described how to import shape file to postgis. Please check this,

Click Here

PostGis have a set of GIS function. You can read the PostGis manual. we have to use ST_Buffe and ST_INTERSECTION to implement our requirement. We will create a max extend box by giving the distance parameter of the ST_BUFFER. Then we intersect this box with our point map in the database. Below is the SQL,

SELECT gid, landmark_n, groupcode, lat, lon, the_geom
FROM landmark
WHERE the_geom && ST_Buffer(ST_GeomFromText(‘POINT(90.4142 23.7948)’), .01)

Here the landmark is our PostGis map table. Using && we make intersection with buffer box. Our input point lng/lat is 90.4142,23.7948(Gulshan-1, Dhaka).We make .01 unit buffer area.

This SQL will return landmarks information with Lat/Lng. Now we need to display this points using Google Map. This not a very challenging task. There are many simple example available in the web to that. Check the below links,
Click Here

If this article do any help to you, please make comments.

Thanks,
Khayer
GIS Programmer, CEGIS
Bangladesh.