Re: [android-developers] how to filter the objects (addresses) to display only the onscreen objects on map
If you use:
com.google.android.maps.MapView.getCenter(),
com.google.android.maps.MapView.getLatitudeSpan(),
com.google.android.maps.MapView.getLongitudeSpan()
you can compute a lat/long bounding rectangle to filter the items you
add to the List<PoiOverlayItem>, for the given map's state of zoom and
pan.
Please refer to the MapView reference page:
http://code.google.com/android/add-ons/google-apis/reference
The reason I recommend using lat/long instead of pixels is because the
filtering at that level is closer to the model instead of the view,
respecting the MVC architecture for UIs. In my applications, the raw
items or points of interest (POI) are already geocoded. Actually in
the Bank of America application, the lat/long bounds are sent as
request parameters to the server, which does the filtering. Also, if
your data were coming from a GeoRss feed, it's highly likely that the
lat/long bounds would be provided in the request, not the pixel
bounds.
Another way of looking at it is if we assume the raw data is
goeocoded, why bother mapping each of those lat/longs to pixels in
order to filter them?
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home