adding data layers to google map

27 views
Skip to first unread message

API

unread,
Jun 10, 2008, 7:50:20 AM6/10/08
to Google AJAX API
Hi,

I have some basic register data of a city such as: Road( classified as
20 types), buildings( owner, purpose of use such as office building
type, school etc, area of building in m2, owner of buildings), forest
area, water area, park etc. It might be in ESRI shape file format,
dbase format or mapinfo format.

Is it possible to add those data layer under google map? So I can use
google map as background map which user interact with. But those data
mentioned above will be hiden under google map.

I want to make a program that when user make a buffer in google map,
the system can automatically count how many different real world
object within the buffer and also the area will be counted. For
example when user make a buffer in google map, the following message
come and save to database:

50 residential building : 5000 m2
20 office building: 300 m2
High way: 20km
Forest: 400m2

Of course those calculation must based on those basic register data.

Does any one know if it is possible with google map API?

Thank you.
Clare

jgeerdes [AJAX APIs "Guru"]

unread,
Jun 10, 2008, 8:02:44 AM6/10/08
to Google AJAX API
It is certainly possible. The biggest challenge I think you'll find,
though, is having to pull your data from so many different formats.
What I would recommend is setting up a database of some sort (e.g.,
MySQL, Postgres, etc.) that you can access via a server-side script.
Then you could add a moveend listener to your map and/or click
listener to some button so that, whenever the map view changes, you
can send an AJAX request with the map's (or selected area's) span to
the server-side script to get the updated tallies.

If you didn't want to show the user these tallies, you could just send
the map or selection span and wait for a simple confirmation of
completion.

Jeremy R. Geerdes
Effetive website design & development
Des Moines, IA

For more information or a project quote:
http://jgeerdes.home.mchsi.com
jgee...@mchsi.com

If you're in the Des Moines, IA, area, check out Debra Heights
Wesleyan Church!

API

unread,
Jun 10, 2008, 8:45:10 AM6/10/08
to Google AJAX API
Hello,

Thanks for your information. But one thing I am confusing is, if user
make a buffer on google map, what could be the connection between
google map and the data which I get from register. For example, in
google map, there is building1 which repersent my home. I have also
the same building stored in postgreSQLdatabase . Is that mean, when I
make a buffer in google map, the system start query from database, and
list the one which locate within the buffer. How do find the location?
By XY coordinate or lat/longtitite.

Is that mean, google map and my register data should have something
same, isn´t it? Maybe the coordinate for each object in real world.

Another problem is, if the buffer border cut a high way into two
pieces, how the system can count how many kilometer involved inside
buffer. The same situation also apply for sea, buildings etc. For
exampel the total area of a forest is 400m2, and we have the
information stored in postgreSQL like : forest name, total area... but
now I only want to count how many m2 of this forest inside
buffer( maybe only 3/4 of them inside buffer). I really don´t know how
these can be done. Do you have any good suggestions?

Best Regards,
Clare

On 10 kesä, 15:02, "jgeerdes [AJAX APIs \"Guru\"]"
<jgeer...@mchsi.com> wrote:
> It is certainly possible.  The biggest challenge I think you'll find,
> though, is having to pull your data from so many different formats.
> What I would recommend is setting up a database of some sort (e.g.,
> MySQL, Postgres, etc.) that you can access via a server-side script.
> Then you could add a moveend listener to your map and/or click
> listener to some button so that, whenever the map view changes, you
> can send an AJAX request with the map's (or selected area's) span to
> the server-side script to get the updated tallies.
>
> If you didn't want to show the user these tallies, you could just send
> the map or selection span and wait for a simple confirmation of
> completion.
>
> Jeremy R. Geerdes
> Effetive website design & development
> Des Moines, IA
>
> For more information or a project quote:http://jgeerdes.home.mchsi.com
> jgeer...@mchsi.com

jgeerdes [AJAX APIs "Guru"]

unread,
Jun 10, 2008, 9:10:33 AM6/10/08
to Google AJAX API
Well, that makes things a bit more complicated, especially since most
real-world objects are not perfectly square. But as long as you have
all of the vertices of the given object stored in your db, you should
be able to do the math. The only challenge would be that it could
become extremely taxing on performance. Anyway, what you would want
to do, in essence, is to go through each of the vertices for the given
object and cut it off whenever it leaves the bounds of the map. Then
you would calculate the area of the resulting polygon.

Jeremy R. Geerdes
Effective website design & development
Des Moines, IA

For more information or a project quote:
http://jgeerdes.home.mchsi.com
jgee...@mchsi.com

API

unread,
Jun 11, 2008, 3:52:25 AM6/11/08
to Google AJAX API
hi,

Another problem, if I draw a buffer or polygon on google map, and I
want to count how many buildings inside the buffer. This can be done
by query from database, which means search through database table and
find how many building ID inside polygon ID. But can we know the
drawing polygon locations? It means maybe coordinate of each vertices
of polygon. I read from google map API web page, and it said google
map is using latitude and longitude to assigne the location for each
real world object. Is it mean, in my postgreSQL file, I also have to
put same kind of coordinate system.

Thanks in advance.
Clare

On 10 kesä, 16:10, "jgeerdes [AJAX APIs \"Guru\"]"
<jgeer...@mchsi.com> wrote:
> Well, that makes things a bit more complicated, especially since most
> real-world objects are not perfectly square.  But as long as you have
> all of the vertices of the given object stored in your db, you should
> be able to do the math.  The only challenge would be that it could
> become extremely taxing on performance.  Anyway, what you would want
> to do, in essence, is to go through each of the vertices for the given
> object and cut it off whenever it leaves the bounds of the map.  Then
> you would calculate the area of the resulting polygon.
>
> Jeremy R. Geerdes
> Effective website design & development
> Des Moines, IA
>
> For more information or a project quote:http://jgeerdes.home.mchsi.com
> jgeer...@mchsi.com

jgeerdes [AJAX APIs "Guru"]

unread,
Jun 11, 2008, 6:59:30 AM6/11/08
to Google AJAX API
Yes, you can get the vertices of a polygon with a combination of the
polygon's .getVertexCount() and .getVertex() methods. You can see how
they function in the Maps API documentation, linked below:

http://code.google.com/apis/maps/documentation/reference.html#GPolygon

As for including a coordinate system in your database, yes, you'll
have to do something so you can figure out where objects are in
relation to the map. Lat/lng is by far the easiest and most flexible
way of cataloging geographic locations because, if you have lat/lng,
you can calculate positions on any projection (e.g., the Mercator
projection GMaps uses, etc.). With any other coordinate system,
should you ever change projections, you'll have to calculate lat/lng
and then calculate the new point. So I would include lat/lng pairs in
my database, but you can include any coordinate system you want as
long as you can map it to the projection you're using.

Jeremy R. Geerdes
Effective website design & development
Des Moines, IA

For more information or a project quote:
http://jgeerdes.home.mchsi.com
jgee...@mchsi.com

API

unread,
Jun 11, 2008, 7:45:43 AM6/11/08
to Google AJAX API
hi,

Thanks a lot for your help. I will try it.



On 11 kesä, 13:59, "jgeerdes [AJAX APIs \"Guru\"]"
> jgeer...@mchsi.com
Reply all
Reply to author
Forward
0 new messages