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

From: Don Dietrick <dietrick_at_bbn.com>
Date: Wed, 9 Aug 2006 18:31:36 -0400

Hi Øystein,

On Aug 1, 2006, at 5:31 PM, Oystein E. Thorvaldsen wrote:

> Hi,
>
> I'm trying to calculate and display a geographic region defined by
> the intersection of a number of overlapping circles. (See http://
> folk.ntnu.no/oysteine/om/venn.jpg, 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 ( http://openmap.bbn.com/mailArchives/openmap-users/
> 2005-12/4466.html ) mentioned the need for Projection.forward() in
> a similar situation. In http://openmap.bbn.com/mailArchives/openmap-
> users/2004-08/3276.html .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?

The Projection.forward() method is used by the OMCircle to create
it's Shape objects in pixel space. Screen resolution doesn't affect
anything, but the Projection parameters will define what the Shape
looks like. Projection scale will affect the size of the shape, and
the type and location will affect the pixel locations and relative
shapes. It's something to think about, depending on the answer you
want.

If you want the circle points for a specific distance around a
location, You can use the com.bbn.openmap.proj.GreatCircle class for
that, and use the sphericalBetween method. You'd step around the
angles between 0-2*Pi and get the lat/lon points in the intervals
that work for you. Then you can just use those coordinates in JTS
(http://www.jump-project.org/project.php?PID=JTS&SID=OVER).

The GreatCircle class works on a spherical model, the Geo class works
on an ellipsoid, so you might want to use the
com.bbn.openmap.geo.Geo.geoAt(dist, angle) method if the earth model
is important.

> 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.

We hope to include geospatial operations (add, subtract) in the geo
package at some point, they aren't there yet.

I need to get a general calculation algorithm for shapes based on
intersections, and then it could be done by creating GeoRegions and
the Intersection class. The Intersection class figures out how/if/
where segments cross each other (and also some point/area
calculations that are similar).

The documentation for those classes will improve over time.

> 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.)

That's what I think JTS might have, the algorithm for creating
intersection areas based on points.

Hope this helps,

Don


=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Don Dietrick, dietrick_at_bbn.com
BBN Technologies, Cambridge, MA
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


--
[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Wed Aug 09 2006 - 18:31:56 EDT

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