[postgis-users] Google Maps API with PostGIS

Stephen Woodbridge woodbri at swoodbridge.com
Mon May 30 13:12:18 PDT 2011


On 5/30/2011 1:51 PM, Ahmad Aburizaiza wrote:
> Hello all,
>
> I am fairly new to PostGIS and I have to work on a project for my PhD. I
> hope you can help me. I want to build a web map where the user can
> select a building or more than one from a layer on top of Google Maps
> API and the code should create an automatic convex hull from the set of
> points generated from the selected polygon(s). I am not sure on what to
> use but I have general ideas and I do not know which is the best :
>
>     * Do I use Google Maps API and PostGIS without needing a WMS or WFS?
>     * Do I have to use with Google Maps API a WMS or a WFS?
>
> And if someone has beneficial samples I can use to build the website, I
> would really appreciate it.
>
> Thank you in advance.

I think you need to think through the whole flow of this application and 
answer questions like:

1. the user selects a polygon(s)
how does this happen?
where are the polygons? in the client, or on the your server, or on 
google's server?
How did they get display on the page because this will determine what 
the selection process needs to be.

2. create a convex hull from the select polygons
if you are creating the convex hull in postgis, then you need to get the 
selections to your postgis server.
where is the postgis server?
Where are the selected polygons?

3. now you have a convex hull
what do you want to do with it? display it on the map? do you want to 
draw it as a vector object or draw it as an image overlay? Do you need 
to store the convex hull for later use? Where do you plan to store it?

As you know there are many ways to skin a cat. Without more information 
on your specific use case, I would implement this using OpenLayers and 
not the Google API (in part because it open javascript api for mapping 
and feature manipulation and I know it better than the Google API), and 
I would probably write a simple PHP ajax handler to interact between the 
web application and the database. I assume the building are already 
loaded in postgis. If you need more then say 500 building display on the 
screen them you will probably want to draw them via mapserver as an 
image overlay, but if you have less then passing the features to 
OpenLayers and rendering them as a vector layer is probably fine.

Hope this helps,
   -Steve W



More information about the postgis-users mailing list