displaying pt.s on map by reverse geocodng

Put problem concerning MapActivities, MapViews, Overlays and GPS in this forum.

displaying pt.s on map by reverse geocodng

Postby mala » Mon Mar 28, 2011 1:42 pm

Hi all,

My problem is that for my app I have to send an API which contains some parameters among which one is the area of the map view. For that I have to calculate my map view area.
For the location search functionality when some address is given to the search box by reverse Geocoding I am getting the lat lng for that address. Considering that lat lng as center pt. when I calculate the map view area every time it gives some different lat lng value for left-top and right-bottom co-ordinates. :?
here is my codding:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. try {
  2.      searchfor = searchText.getText().toString();
  3.      geoCoder = new Geocoder(getBaseContext(), Locale
  4.                                 .getDefault());
  5.      List<Address> addresses = geoCoder.getFromLocationName(
  6.                                                 searchfor.toString(), 5);
  7.  
  8.         if (addresses.size() > 0) {
  9.                 point = new GeoPoint((int) (addresses.get(0)
  10.                                 .getLatitude() * 1E6), (int) (addresses.get(0)
  11.                                 .getLongitude() * 1E6));
Parsed in 0.032 seconds, using GeSHi 1.0.8.4
[*]

and for calculation the map view area:

Syntax: [ Download ] [ Hide ]
  1. [*]  
  2.      GeoPoint p = mapView.getProjection() 
  3.                 .fromPixels((int) mapView.getHeight(), 
  4.                 (int) mapView.getWidth()); 
  5.     Double lat = p.getLatitudeE6() / 1E6; 
  6.     Double lng = p.getLongitudeE6() / 1E6; 
  7.     topCoordinate = "" + lng + "," + lat; 
  8.     GeoPoint q = mapView.getProjection().fromPixels((int) 0,(int) 0); 
  9.     Double lat1 = q.getLatitudeE6() / 1E6; 
  10.     Double lng1 = q.getLongitudeE6() / 1E6; 
  11.     bottomCoOrdinate = "" + lng1 + "," + lat1; 
[*]

But I should get same value every time. Is not it! :oops:
Please help as soon as possible.


Thanks.
mala
Junior Developer
Junior Developer
 
Posts: 17
Joined: Thu Jan 07, 2010 5:57 am
Location: bangalore

Top

Return to Map Problems

Who is online

Users browsing this forum: No registered users and 7 guests