Concentric Circles with inner circle transparent

862 views
Skip to first unread message

Barada Sahu

unread,
Sep 29, 2010, 2:09:24 AM9/29/10
to Google Maps JavaScript API v3
Hi,
How do we create 2 circles so only the area between the circles is
highlighted (in defined colour)?
whenever we create a circle and apply a fill then the area from the
center to the circumference is filled with a certain colour? Is it
possible to override the fill effects from a previous circle when a
new circle overlay is drawn above it?

Regards
Barada

Martin

unread,
Sep 29, 2010, 3:21:18 AM9/29/10
to Google Maps JavaScript API v3
Have you tried drawing the larger filled circle then a smaller
transparent circle inside the larger circle?

Martin.

Chad Killingsworth

unread,
Sep 29, 2010, 9:27:54 AM9/29/10
to Google Maps JavaScript API v3
You'd need to do that with KML: http://code.google.com/apis/kml/documentation/kmlreference.html#polygon

Note that you won't be able to create a true circle though.

Chad Killingsworth

Chris Broadfoot

unread,
Sep 30, 2010, 5:12:10 AM9/30/10
to google-map...@googlegroups.com
See Larry's example here:


You'll need to generate a polygon, unfortunately there is no way to do this with the built in Circle class.


--
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-map...@googlegroups.com.
To unsubscribe from this group, send email to google-maps-js-a...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.


cbos

unread,
Jan 6, 2011, 2:39:30 PM1/6/11
to google-map...@googlegroups.com
A similar question is: is it possible to create more than one circle on a map using the circle class?  Can the Overlay method add the circle generated by the circle class?

i..e circle.setMap(map); works
map.addOverlay(circle); doesn't

or does GPolygon have to be used for this.

Thanks.

Rossko

unread,
Jan 6, 2011, 3:27:44 PM1/6/11
to Google Maps JavaScript API v3
> map.addOverlay(circle); doesn't
>
> or does GPolygon have to be used for this.

Those are v2 syntax. Do not mix API v2 and v3 syntax.

geoco...@gmail.com

unread,
Jan 6, 2011, 3:37:40 PM1/6/11
to Google Maps JavaScript API v3
On Jan 6, 11:39 am, cbos <c...@execulink.com> wrote:
> A similar question is: is it possible to create more than one circle on a
> map using the circle class?  Can the Overlay method add the circle generated
> by the circle class?
>
> i..e circle.setMap(map); works
> map.addOverlay(circle); doesn't

That is v2 code.

>
> or does GPolygon have to be used for this.

GPolygon is a v2 class; the v3 equivalent is google.maps.Polygon

They have very different constructors, see the documention:
http://code.google.com/apis/maps/documentation/javascript/reference.html#Polygon

-- Larry

>
> Thanks.

bratliff

unread,
Jan 6, 2011, 4:50:52 PM1/6/11
to Google Maps JavaScript API v3
See:

http://polylib.us/polycluster/circle

The black circle is constant radius / constant weight. The red circle
is scaled according to zoom level.

cbos

unread,
Jan 6, 2011, 7:12:52 PM1/6/11
to Google Maps JavaScript API v3
Sorry, your right. My code is in v2.

I can switch to v3 for this problem, but the original question still
remains.

I am working off of: http://koti.mbnet.fi/ojalesa/v3/circleAndBounds.htm

The circle created is a spherical cap, which is important at more
extreme latitudes and for larger circles.

With my original code, in v2, using GPolygon, I am able to project
more than one circle on a map.

I would like to do that with the google.Maps.Circle class, if
possible.

Thanks.

Clarence

geoco...@gmail.com

unread,
Jan 6, 2011, 7:41:33 PM1/6/11
to Google Maps JavaScript API v3
Is this what you are trying to do?
http://www.geocodezip.com/v3_polygon_example_donut.html
(v3 code, doesn't use the google.maps.Circle though)

-- Larry

>
> Thanks.
>
> Clarence

cbos

unread,
Jan 6, 2011, 9:48:45 PM1/6/11
to Google Maps JavaScript API v3
>
> Is this what you are trying to do?http://www.geocodezip.com/v3_polygon_example_donut.html
> (v3 code, doesn't use the google.maps.Circle though)
>
Sort of. But more with circles side by side or overlapping. I am
looking to use a spherical cap (circle class) as it is more accurate
at extreme latitudes and for larger areas.

geoco...@gmail.com

unread,
Jan 7, 2011, 1:05:04 AM1/7/11
to Google Maps JavaScript API v3
Reply all
Reply to author
Forward
0 new messages