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 supports almost every spatial operation. We can develop unique features for web application by combining Google Map and PostGis.
I want to developed an web page where user 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.

In above scenario, the solution can be given 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.Finally customize google map for display query result. Check the below link for live demo,

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 functions. All are very usefull and very compatible for web development. we can use ST_Buffe and ST_INTERSECTION to implement our requirement. Using ST_BUFFER We can create a max extend box by giving the distance parameter. Then the box will be intersected 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 geo table. Using && we make intersection with buffer box. Our sample input location lng/lat is 90.4142,23.7948(Gulshan-1, Dhaka).We use .01 unit buffer area.

This SQL will return landmarks information with Lat/Lng. Now we need to display this points using Google Map which is quite simple 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.

GIS Programmer, CEGIS