Hello.

When adding a "doughnut" polygon to Google Maps (See 
http://gmaps-samples-v3.googlecode.com/svn/trunk/poly/pentagon.html as an 
example), the "outer" boundary is plotted in a clockwise direction. The 
"inner" boundary has to be plotted anti-clockwise.

That makes sense once you see it.

The problem that exists though is there is no way to determine if a boundary 
is an inner or an outer boundary.

This becomes an issue when you want to use the paths in WKT queries (I'm 
using MS SQL Server 2008 R2 which has geography data types, allowing easy 
querying of this sort of data).

If you look at the sort of things WKT allows (
http://en.wikipedia.org/wiki/Well-known_text#Geometric_objects), then the 
syntax for the polygons is along these lines ...

*POLYGON((outer_boundary) [, (inner_boundary) ] )*

The polygon requires an outer boundary and an optional inner boundary. The 
ordering of the points in the boundary is not important.

For a multiple polygon construct (say multiple islands), then the syntax is 
...

*MULTIPOLYGON(((outer_boundary_1) [, (inner_boundary_1) ] ) [, 
((outer_boundary_2) [, (inner_boundary_2) ] ) [, ... ] ] )*

This is essentially multiple polygons, so each "island" can be a "doughnut".


I currently take each path, encoded it and pass that to a server-side script 
(nice and small amount of data which is decoded using a PHP script, based 
upon the logic described in 
http://code.google.com/apis/maps/documentation/utilities/polylinealgorithm.html
).

It was when I decided to plot Outer London and exclude Inner London that I 
found that there is no differentiation of the paths.


Given that, there seems to be no way to determine if the result of 
google.maps.Polygon.getPaths() contains islands, doughnuts or both. There is 
no connection between the different paths, so it would have to be assumed 
that each path was a separate polygon. Obviously, this wouldn't work for the 
paths defined in the Pentagon example.


I have many different ideas on a solution, but I am unable to test any of 
them due to the closed source nature of the project.


In comparison to this, Google Earth already has this logic within it (See 
http://code.google.com/apis/kml/documentation/kml_tut.html#polygons as an 
example of a polygon with 2 distinct boundaries, correctly identified as 
inner and outer).

So, it seems that this may be a simple (ha - I'm not writing the Google Maps 
API) oversight.

If there is some determination within Google Maps API that identifies inner 
/ outer for its own use, then if this could be exposed through a suitable 
mechansism and ideally supported by the encoding library, then that would be 
a step in the right direction. But I still don't think that would be enough. 
Without the ability to tag an inner boundary to an outer boundary, the paths 
still don't quite match the full requirement.

If there was a way of creating polygons for Google Maps with the proper 
inner/outer boundaries (inner being optional), then that would be perfect.

Having said all of that, I've no idea if you can have an outer boundary and 
multiple inner boundaries - a swiss cheese effect (lots of holes).

I hope this is the right place to ask this. If not, can you let me know 
where I should go.

Thank you.

Richard Quadling.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To post to this group, send email to google-maps-js-api-v3@googlegroups.com.
To unsubscribe from this group, send email to 
google-maps-js-api-v3+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to