public GeoData(DS ds) { Iterable<Entity> tracksIterable = ds.fetchTracks(); Iterable<Entity> imageLocationsIterable = ds.fetchImageLocations(); Iterable<Entity> blogLocationsIterable = ds.fetchBlogLocations(); boxList = new HashMapList<>(); Date lastBegin = null; for (Entity track : tracksIterable) { BoundingBox bbTrack = new BoundingBox(track); for (Entity trackSeq : ds.fetchTrackSeqs(track.getKey())) { BoundingBox bbTrackSeq = new BoundingBox(trackSeq); boxList.add(bbTrack, new Pair<BoundingBox, Key>(bbTrackSeq, trackSeq.getKey())); Date begin = (Date) trackSeq.getProperty(BeginProperty); if (lastBegin == null || lastBegin.before(begin)) { lastBegin = begin; } } } Iterable<Entity> placemarksIterable; if (lastBegin != null) { placemarksIterable = ds.fetchPlacemarks(lastBegin); } else { placemarksIterable = ds.fetchPlacemarks(); } firstPlacemarkKey = null; placemarkBoundingBox = new BoundingBox(); for (Entity placemark : placemarksIterable) { if (firstPlacemarkKey == null) { firstPlacemarkKey = placemark.getKey(); } GeoPt location = (GeoPt) placemark.getProperty(LocationProperty); placemarkBoundingBox.add(location); } locationList = new ArrayList<>(); for (Entity metadata : imageLocationsIterable) { GeoPt location = (GeoPt) metadata.getProperty(LocationProperty); if (location != null) { locationList.add(new Pair<>(location, metadata.getKey())); } } for (Entity blog : blogLocationsIterable) { GeoPt location = (GeoPt) blog.getProperty(LocationProperty); if (location != null) { locationList.add(new Pair<>(location, blog.getKey())); } } }