Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Glibnobin

macrumors newbie
Mar 6, 2009
1
0
GeoCoding

I'm trying to get the center of the map to return Lat, and Long variables to my app. Can someone point me in the right direction?
Thanks
 

johnsteve

macrumors newbie
Jun 20, 2008
4
0
Hello Mike have u got the solution to get tochable icons on the map???
If u can , Could you please share it here , it will be very help full for me.

Thanks,
Narendar
 

vt9r

macrumors newbie
May 26, 2009
1
0
I'm assuming you implemented these methods in the MapViewAppDelegate.m file. I'm getting errors because of the mapView variable reference in those methods....I'm assuming you did not put all the code you wrote in the example. I'm new to objective c so if you could please update with that code i'd be much obliged.

Wow, it seems like the author of this is totally out of the loop...

I've been playing/fighting with this Map View all day and am having several annoying headaches...

I'm just experimenting with the example app that came in R12.

I made the appDelegate also be a delegate for the MapWebView:

So in MapViewAppDelegate.h:

@interface MapViewAppDelegate : NSObject <UIApplicationDelegate, UIWebViewDelegate, MapWebViewDelegate>

then in MapViewAppDelegate.m, in applicationDidFinishLaunching():

[mapView.map setDelegate:self];

I then implemented the following:

- (void) mapZoomUpdatedTo: (int)zoomLevel
{
NSLog(@"Zoom level is now: %d",[mapView.mMapWebView getZoom]);
}
- (void) mapCenterUpdatedToLatLng: (GLatLng)latlng
{
GLatLng centerpoint = [mapView.mMapWebView getCenterLatLng];
NSLog(@"Center Lat = %f Long = %f", centerpoint.lat, centerpoint.lng);
}
- (void) mapCenterUpdatedToPixel: (GPoint)pixel
{
GPoint centerpoint = [mapView.mMapWebView getCenterPixel];
NSLog(@"Center Pt x,y = %d,%d",centerpoint.x,centerpoint.y);
}

- (void)webViewDidFinishLoad: (UIWebView *)webView
{
if(loadcounter==0)
{
GLatLng center;
center = [mapView.map getCenterLatLng];
NSLog(@"Current Center is: %f, %f",center.lat,center.lng);

center.lat = 37.137740;
center.lng = -76.652384;

[mapView.map setCenterWithLatLng:center];
[mapView.map setMapType:G_HYBRID_MAP];
[mapView.map setZoom:7];
loadcounter++;
}
else if(loadcounter==1)
{
GLatLng center;
center.lat = 37.137740;
center.lng = -76.652384;

[mapView.map setCenterWithLatLng:center];
loadcounter++;
}
else
NSLog(@"Finished Loading Page...");
}



My intention was to try to get the map to be centered on a specific point once the map loads up.

Unfortunately, I'm seeing the zoom level change, and the map type changes to Hybrid correctly, but I'm not seeing the map change to the specified center location. If I take that same code that is trying to set the center, and copy it into the MapView's touchesEnded method, if I try to move the map, it immediately re-centers on the point specified.

What am I doing wrong??? How do I get the map to start up at the point I want???!?!

Additionally, it doesn't seem like any of the MapWebView delegate methods are ever getting invoked.

Help!!!

And has anyone figured out a way to overlay touchable icons onto the map at specific Lat/Long points? I need a way to push and update some icons at specific Lat/Long points, and when you touch them have the display flip to another view that has detailed data about that item at that location.


And is there any way to get this to show up in the Interface Builder so I can make the Map not take up the whole display? I really want to add a toolbar of buttons at the bottom so the user can recenter the display, etc.

Any help would be GREATLY appreciated!!!

--Mike
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.