RE: [OpenMap Users] OMPoly and getShape woes

From: Lepkowski, Thomas M., CTR, OSD-PA&E <>
Date: Tue, 20 Dec 2005 10:01:08 -0500

Classification: UNCLASSIFIED
This is the tonic I needed:
Point xyTargetPos = proj.forward(ll);

Thanks, Carsten!

-----Original Message-----
From: []On
Behalf Of "Carsten . Madsen"
Sent: Tuesday, December 20, 2005 1:14 AM
To: ''
Subject: Re: [OpenMap Users] OMPoly and getShape woes


You have to convert the lat,lon to x,y via the forward method as contains
operates in x,y space. Something like the following:

LatLonPoint currentPos = new LatLonPoint(points[0], points[1], true);
Mercator proj = new Mercator(currentPos, 65000f, 1024, 768);
Point xyTargetPos = proj.forward(ll);
// prep for spatial analysis
OMPoly polyCopy = new OMPoly();
polyCopy.setLocation(poly.getLatLonArray(), OMGraphic.RADIANS);
if (polyCopy.getShape().contains(xyTargetPos)) {...


Lepkowski, Thomas M., CTR, OSD-PA&E wrote:
Hello all,

I have two things:

1) a valid and displayed OMGraphic with LatLonPoint (of course).
2) a valid and displayed OMPoly ( in the form of ESRIPolygon ).

The OMGraphic point is inside the OMPoly. It's like a town inside a state.
The state is represented by the OMPoly and the town is a simple OMGraphic.
I want to show programmatically that the town is inside the state.

My following code is not printing "true":


// some code bringing me here
// OMPoly is on map

EsriPolygon ep = (EsriPolygon) omg;

ep.setDoShapes( true );
ep.generate( projection );
GeneralPath gp = ep.getShape();

  // latLonPoint is inside the polygon
  // THIS PRINTS "false" EXPECT IT TO PRINT "true"
System.out.println( "Inside polygon: " + gp.contains(
latLonPoint.getLongitude(), latLonPoint.getLatitude() );


I expect gp.contains( ) wants another representation of x,y but I don't know

Any help is greatly appreciated.


[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 Dec 20 2005 - 10:02:24 EST

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