GeoLocation[] locs = new GeoLocation[5]; locs[0] = new GeoLocation( map, "Redlands, CA", 34.0528, -117.1531); locs[1] = new GeoLocation( map, "Loma Linda, CA", 34.0484, -117.2629); locs[2] = new GeoLocation( map, "Bloomington, CA", 34.0704, -117.3976); locs[3] = new GeoLocation( map, "San Bernardino, CA", 34.1214, -117.3046); locs[4] = new GeoLocation( map, "Highland, CA", 34.1282, -117.2106); GeoPointsImpl gp = new GeoPointsImpl(); for(int i = 0; i < locs.Length; i++) gp.addPoint( locs[i].x, locs[i].y); searchDef.addPolygon( gp, 0);
3) To find locations within a rectangle:
GeoLocation[] locs = new GeoLocation[2]; locs[0] = new GeoLocation( map, "San Bernardino, CA", 34.1214, -117.3046); locs[1] = new GeoLocation( map, "Redlands, CA", 34.0528, -117.1531); GeoRectangle rc = new GeoRectangle(); rc.left = locs[0].x; rc.top = locs[0].y; rc.right = locs[1].x; rc.bottom = locs[1].y; searchDef.addRectangle( rc, 0);
4) To find locations along a line:
GeoLocation[] locs = new GeoLocation[2]; locs[0] = new GeoLocation( map, "Redlands, CA", 34.0528, -117.1531); locs[1] = new GeoLocation( map, "San Bernardino, CA", 34.1214, -117.3046); GeoPointsImpl gp = new GeoPointsImpl(); for(int i = 0; i < locs.Length; i++) gp.addPoint( locs[i].x, locs[i].y); searchDef.addLineBuffer( gp, map.convertDistance( 10, map.getMeasureUnits(), MeasureUnit.rmMapUnits), 0);
5) To find locations along a route:
GeoLocation[] locs = new GeoLocation[2]; locs[0] = new GeoLocation( map, "Redlands, CA", 34.0528, -117.1531); locs[1] = new GeoLocation( map, "San Bernardino, CA", 34.1214, -117.3046); // see the Routing section for details string RouteID = findRoute( locs); searchDef.addRouteBuffer( RouteID, map.convertDistance( 10, map.getMeasureUnits(), MeasureUnit.rmMapUnits), 0);