views:

61

answers:

1

I have us state border shape file and I want to read information from that file using openmap api for java.Also to find the states within 50 miles of a given city. How can i do it?

A: 

If you just want to inspect the contents of the file programmatically, you can read the information from the shape files using a com.bbn.openmap.dataAccess.shape.EsriGraphicList. There is a static getGraphicList(...) method that will load the shapes and the attributes stored in the dbf file.

If you want to display the contents of the file, use a com.bbn.openmap.layer.shape.ShapeLayer.

To do spatial analysis on the contents of a shape file, you'll need do to a little programmatic work, using the com.bbn.openmap.geo package:

  1. Create an ExtentIndex, which will be a collection of GeoExtents.
  2. Create GeoRegions from the EsriGraphicList EsriPolygons, add them to the ExtentIndex.
  3. Create GeoPoint for the city you want to test for.
  4. Create Intersection with MatchParameters being Length.MILE.toRadians(50).
  5. Call intersection.considerPointXRegions(GeoPoint, ExtentIndex);
  6. Call intersection.getCollector().iterator() to get results.
Don