RE: [OpenMap Users] shapefile checking bounds

From: Chapman, Martin <MChapman_at_sanz.com>
Date: Wed, 4 Aug 2004 18:09:22 -0600

Ben,

The box in box is faster, but the intersects method is completely
accurate. I just sent another email describing why. The best solution
is to first use the box in box query to eliminate geometries that have
no chance of intersecting because their envelope (extents) don't
intersect. That will be fast because the math is easier. Then further
filter those geoms with the rigorous test to eliminate any false extents
intersections.

So the answer is, do both if you need both speed and accuracy, or do box
in box for speed but will return some false intersections if the slop
doesn't matter. By the way, the combined method is the approach most
spatial databases take. Really, the answer is usually specific to your
requirements. If you need the math to actually do point in poly
intersection, let me know and I will send it to you. It's really pretty
easy, although, the JDK has a ton of good support for this. The only
problems you may encounter is when geoms span the dateline. Then you
need to add 360 to every positive x point in the geom for the math to
work correctly.

Martin

-----Original Message-----
From: Ben Podoll [mailto:benjamin.podoll_at_und.edu]
Sent: Wednesday, August 04, 2004 5:54 PM
To: Chapman, Martin; 'Hudson Brian R Contr AFRL/IFSF';
openmap-users_at_bbn.com
Subject: RE: [OpenMap Users] shapefile checking bounds


Which way is better? (more efficient)

> -----Original Message-----
> From: Chapman, Martin [mailto:MChapman_at_sanz.com]
> Sent: Wednesday, August 04, 2004 6:48 PM
> To: Hudson Brian R Contr AFRL/IFSF; Ben Podoll;
openmap-users_at_bbn.com
> Subject: RE: [OpenMap Users] shapefile checking bounds
>
> 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 - 20:09:49 EDT

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