RE: [OpenMap Users] shapefile checking bounds

From: Chapman, Martin <MChapman_at_sanz.com>
Date: Wed, 4 Aug 2004 17:48:29 -0600

Brian,
Another way to do it is like so, which can handle any shape as an AOI,
such as a circle:

// esriPolygon is your extents or AOI (area of Interest), or your view
extents
// m_list is your list of OMGraphics that you read in from your
shapefile
// basically, it loops through each shapefile feature and does a true
geometry intersection and returns a new OMGraphicList of shapes that
//intersect your AOI.

Shape p = esriPolygon.getShape();
OMGraphicList list = filter(esriPolygon.getShape(), oProjection);

public OMGraphicList filter(GeneralPath path, Projection projection)
throws Exception
    {
        try
        {
            if (m_list == null)
               return new OMGraphicList();

            OMGraphicList list = new OMGraphicList();

            Iterator it = m_list.iterator();

            while (it.hasNext())
            {
                OMGraphic graphic = (OMGraphic) it.next();
                boolean b = graphic.generate(projection);
                Rectangle2D rect = graphic.getShape().getBounds2D();
                boolean intersects = path.intersects(rect);

                if (intersects)
                    list.add(graphic);
            }

            return list;
        }
        catch(Exception e)
        {
            throw e;
        }
    }

Martin Chapman

-----Original Message-----
From: Hudson Brian R Contr AFRL/IFSF [mailto:Brian.Hudson_at_rl.af.mil]
Sent: Wednesday, August 04, 2004 4:26 PM
To: Ben Podoll; openmap-users_at_bbn.com
Subject: RE: [OpenMap Users] shapefile checking bounds


Hey,

If you have a spatial index file along with the shp file it should be
pretty easy.

You can just use the locateRecords function of the SpatialIndex class.

For an example, take a look at the ShapeLayer.

Brian Hudson

-----Original Message-----
From: owner-openmap-users_at_bbn.com [mailto:owner-openmap-users_at_bbn.com]
On Behalf Of Ben Podoll
Sent: Wednesday, August 04, 2004 5:49 PM
To: openmap-users_at_bbn.com
Cc: 'Don Dietrick'
Subject: [OpenMap Users] shapefile checking bounds


My problem is fairly complex but somewhat straightforward.

I have a shapefile of National Weather Service warnings and watches.

I want to be able to take the extents that the OpenMap is viewing (i.e.
the 4 lat/lon corners) and check if any /shape/ in the shapefile
intersects. Or in other words is within their viewing area (or at least
a piece of one)?

Is there any good way anyone knows of to do this?

Ben


--
[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"]
--
[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"]
--
[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 04 2004 - 19:49:52 EDT

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