Re: [OpenMap Users] Creating a shape from intersecting circles?

From: David Ward <>
Date: Tue, 1 Aug 2006 16:29:04 -0700 (PDT)


Sounds like you have the data for your circles, the locations and radii, you just need to find the extents of the coverage. I think to roughly calculate the scale a center location, I'd do the following (pseudo-code). This does not make any assumptions of intersection (which is good). It might behave strangly around the international date line.

ur_lat = -90f;
 ur_lon = -180f;
 ll_lat = 90f;
 ll_lon = 180f;
 for each circle {
   //Convert your radius to degrees from what ever your
    radius_in_degrees = ConvertToDegrees(circle.radius)
    south_lat = circle.getLatitude()- radius_in_degrees
     north_lat = circle.getLatitude()+ radius_in_degrees
     west_lon = circle.getLongitude()- radius_in_degrees
     east_lon = circle.getLongitude()+ radius_in_degrees
    ur_lat = max(ur_lat, north_lat);
     ur_lon = max(ur_lon, east_lon);
     ll_lat = min(ll_lat, south_lat);
     ll_lon = min(ll_lon, west_lon);
 scale = ProjMath.setScale(new LatLonPoint(ur_lat, ur_lon), new LatLonPoint(ll_lat, ll_lon), mapBean.getProjection())
center = new LatLonPoint((ur_lat+ll_lat)/2f, (ur_lon+ll_lon)/2f)

//Not the most efficient way to set scale and center, but gets the job done


----- Original Message ----
From: Oystein E. Thorvaldsen <>
Sent: Tuesday, August 1, 2006 2:31:36 PM
Subject: [OpenMap Users] Creating a shape from intersecting circles?


I'm trying to calculate and display a geographic region defined by the
intersection of a number of overlapping circles. (See, the red area) I know the
coordinates of the center of all the circles, and their radi. How do I
best go about doing this in OpenMap?

I've perused the list archives, and API and have some possible starting
points. I would appreciate feedback on the feasibility of these, and
which one is best suited. Of course I'm open to entirely different ways
of doing this.

1) Create the circles as OMCircles. Using getShape to extract the Shape
of every OMCircle and create Areas using Area(Shape). Intersecting the
created Areas to obtain my desired region in the form of an Area. Using
getPathIterator(),possibly with flattening, to create a GeneralPath and
create an OMPoly (or OMGraphicsList?) from it. I know this would be
costly performance wise, but that is not an issue for me.

One post ( )
mentioned the need for Projection.forward() in a similar situation. In
.forward() is not mentioned. And this situation also is similar to my
problem. Is the usage of Graphics2D straightforward, or do I have to use
forward(), and take screen resolution etc into account?

2) The .geo-package seems to deal with this type of functionality, but
I'm unable to find the specific functions I need. Additionally the
classes in the package are somewhat less well documented than the rest
of OpenMap.

3) Try to do the intersection algebraically and store the resulting
region in some kind of data structure containing the vertices and arcs
between them. Then create an OMPoly or OMGraphicsList based on the data
structure. This would still involve calculating the geographical
coordinates of the vertices somehow. (If anyone could point me to an
elegant way of doing the intersection algebraically I would appreciate it.)

Øystein E. Thorvaldsen

[To unsubscribe to this list send an email to ""
with the following text in the BODY of the message "unsubscribe openmap-users"]
[To unsubscribe to this list send an email to ""
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Tue Aug 01 2006 - 19:37:41 EDT

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:07 EDT