This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
boundary="----_=_NextPart_001_01C155A4.858AFB00"
------_=_NextPart_001_01C155A4.858AFB00
Hello List,
I am using MapXtreme and trying to find the closest feature using the
searchWithinRadius.
The following text is in the documentation regarding searchWithinRadius.
searchWithinRadius
BM_1019853Returns a FeatureSet Collection made up of features within a
specified distance of a point object. This search can be used to locate the
nearest dealer to a given location, or it could return the number of
customers within a certain radius of a store.
BM_1020605//Assume columnNames is a vector of the desired columns to
BM_1020606//be returned.
BM_1020607//Assume qp is the QueryParams object.
BM_1020608//Assume myLayer is a Layer object.
BM_1020609
BM_1020630DoublePoint dblPt = new DoublePoint(-73.889444,42.765555);
BM_1019859double dRadius = 10.03;
BM_1020616try
{
FeatureSet = myLayer.searchWithinRadius
(columnNames,dblPt,dRadius,LinearUnit.mile,qp);
}
BM_1019876catch(exception e)
{
e.printStackTrace();
}
What I want to do is find the closest street to a given x,y location. This
is my code
// search around the radius, get closest feature?
double dRadius = .1;
FeatureSet fSet = lyrTemp.searchWithinRadius(vecColName, dp, dRadius,
LinearUnit.mile, null);
// return feature for that column
Feature feat = fSet.getNextFeature();
String attrName;
attrName = feat.getAttribute(0).getString();
System.out.println("attribute name is: " + attrName);
However, the search finds all features within the given radius. I am not
sure how to set the variable feat to the feature that is
actually the closest. Seems like there should be a .getClosest method or
some such?
Thanks in advance,
Kristi.
Kristi Lombard
Software Engineer
3e Technologies International, Inc.
15800 Crabbs Branch Way, Ste 290
Rockville, MD 20855
(301) 670-6770
[EMAIL PROTECTED]
------_=_NextPart_001_01C155A4.858AFB00
_______________________________________________________________________
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, send e-mail to [EMAIL PROTECTED] and
put "unsubscribe MapInfo-L" in the message body.