Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old May 16, 2008, 07:16 AM   #1
Narmer
macrumors newbie
 
Join Date: May 2008
iphone sdk map

Hi,

How can I add google maps control to my applicacion?

Thanks
Narmer is offline   0 Reply With Quote
Old May 20, 2008, 12:38 AM   #2
shadowfaux
macrumors newbie
 
Join Date: May 2008
Quote:
Originally Posted by Narmer View Post
Hi,

How can I add google maps control to my applicacion?

Thanks
You can't, not really. There are no hooks for integrating into the google maps bit that apple ships the iPhone with. Also the licensing agreements for free use of the google maps API indicate that whatever you build must be freely available and it must be used in the context of a web browser. You might be able to get around this by hosting a google maps interaction inside a WebView but I don't know how much you can then go and integrate that with the rest of your application (like, I don't know if you can plot data from the phone on the map and cause code to run on the phone as a result of something being taped or moved on the map) *shrug*

Other than that you might be able to get an enterprise subscription to google maps that will let you embed it in your app but you'd probably end up having to rewrite all the map caching and pixel -> lat/long conversions etc yourself. I think they google maps enterprise license runs around 10k as well.
shadowfaux is offline   0 Reply With Quote
Old May 20, 2008, 04:42 PM   #3
StrAbZ
macrumors newbie
 
Join Date: Apr 2008
There is maybe a solution, you can look here :

http://code.google.com/p/iphone-google-maps-component/

mahm create a "MapView", which is an UIView, "over" a UIWebView, provide some functionnality such as zoom or moving.

And the WebView "translate" action from the UIView in javascript.

So if you want more than zooming, or moving, you should have to implements the other methods. That's why i'm going to try, since I need to add pin, and things like that.
StrAbZ is offline   0 Reply With Quote
Old May 20, 2008, 09:09 PM   #4
shadowfaux
macrumors newbie
 
Join Date: May 2008
Quote:
Originally Posted by StrAbZ View Post
There is maybe a solution, you can look here :

http://code.google.com/p/iphone-google-maps-component/

mahm create a "MapView", which is an UIView, "over" a UIWebView, provide some functionnality such as zoom or moving.

And the WebView "translate" action from the UIView in javascript.

So if you want more than zooming, or moving, you should have to implements the other methods. That's why i'm going to try, since I need to add pin, and things like that.
thanks for pointing that out, I had somehow missed it getting announced

if it's really like the android mapview then it should allow you to do some basic stuff like overlays (I just finished a project where we did some pretty extensive hacking with the MapView) but, of course, it's hard to tell without playing with the code

anyway, thanks again
shadowfaux is offline   0 Reply With Quote
Old May 21, 2008, 03:28 AM   #5
Narmer
Thread Starter
macrumors newbie
 
Join Date: May 2008
Thanks!!

I'm going to try it!!!


Best regards,
Narmer is offline   0 Reply With Quote
Old May 26, 2008, 03:38 PM   #6
gammal
macrumors newbie
 
Join Date: May 2008
It's easy to add overlays

I'm the author of that project, and I'd like to tell you that adding extra features, such as overlays, should be trivial. It was indeed inspired by Android's MapView, but I chose to stick to the Javascript API in naming the methods. There's even a generic method for calling any JS maps method that doesn't have an Objective-C wrapper yet. I'm using the component in a separate project I'm working on, and I actually need to add support for overlays beside other features as well. Naturally, when those features will be added, I'm going to update the Google Code project.
gammal is offline   0 Reply With Quote
Old Aug 27, 2008, 11:45 AM   #7
vosens
macrumors newbie
 
Join Date: Aug 2008
Google Maps Project Update?

I was wondering if there was still an updated version of this project in the works?

Also, I'm relatively new to Objective-C and development in general and was curious as to how I could implement overlays to customize the existing project to suit my needs.

Firstly, I'd like to create tappable markers on the map that can pull up driving directions from the phone's current location.

Any ideas? Thanks in advance!
vosens is offline   0 Reply With Quote
Old Aug 27, 2008, 06:22 PM   #8
johnellisdm
macrumors member
 
Join Date: Feb 2007
do the google maps terms of service still apply when using this api? can i, for instance, use this MapView in an app that i'm going to charge for on the app store?
johnellisdm is offline   0 Reply With Quote
Old Sep 1, 2008, 07:35 AM   #9
jagatnibas
macrumors regular
 
Join Date: Jul 2008
please share some ideas for overlay

Hi gammal,

Thanks a lot for such nice feature added.

I would appreciate you giving me some hints for adding overlays in this mapview.

please

regards
Jagat
jagatnibas is offline   0 Reply With Quote
Old Sep 1, 2008, 12:49 PM   #10
whooleytoo
macrumors 603
 
whooleytoo's Avatar
 
Join Date: Aug 2002
Location: Cork, Ireland.
Send a message via AIM to whooleytoo
Quote:
Originally Posted by jagatnibas View Post
I would appreciate you giving me some hints for adding overlays in this mapview.
You could try placing a UIView over it, setting opaque to NO, clear the view's rect; then drawing your overlay.
__________________
Mac <- Macintosh <- McIntosh apples <- John McIntosh <- McIntosh surname <- "Mac an toshach" <- "Son of the Chief"
whooleytoo is online now   0 Reply With Quote
Old Sep 2, 2008, 01:21 AM   #11
jagatnibas
macrumors regular
 
Join Date: Jul 2008
again problem

This map seems to have accessed http://www.enear.com/iphone-test/ ...

Cant I use it for google maps ?

I tried changing the url to google maps, but it resulted the screen being white. If i use enear ... iphone-test, then how can I specify lattitude and longitude of my choice ?

thanks and regards
Jagat
jagatnibas is offline   0 Reply With Quote
Old Sep 2, 2008, 07:49 AM   #12
jagatnibas
macrumors regular
 
Join Date: Jul 2008
uiview

secondly,

UIView* myView = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, 300.0, 300.0)];
myView.center = self.center;
self.iView = myView;
[myView release];
[self addSubview:iView];


I understand i will have to do something like this. But I want to display that view only when I tap on the map. on that location
please guide me how to do that. again on second tap it should hide

regards
Jagat
jagatnibas is offline   0 Reply With Quote
Old Sep 11, 2008, 12:11 PM   #13
jagatnibas
macrumors regular
 
Join Date: Jul 2008
image overlay

I am trying to display an image overlay over the mapview. I changed the code to following, map displays but the image does not display. image displays if i draw the same code in blank view

please help

if (! (self = [super initWithFrame:frame]))
return nil;

self.onClickHandler = nil;
self.autoresizesSubviews = YES;
self.multipleTouchEnabled = YES;

mMapWebView = [[[MapWebView alloc] initWithFrame:self.bounds] autorelease];
//[self addSubview:mMapWebView];

overlayView = [[UIImageView alloc] initWithFrame:CGRectMake(0.0, 0.0, 100.0, 150.0)];
overlayView.image = [UIImage imageNamed:@"spongebg.jpg"];
//[self.overlayView setAlpha:0.5];
overlayView.center = self.center;
[overlayView setOpaque:YES];
[self addSubviewverlayView];

[self resetTouches];

return self;
jagatnibas is offline   0 Reply With Quote
Old Sep 11, 2008, 12:14 PM   #14
jagatnibas
macrumors regular
 
Join Date: Jul 2008
oops

correction!

//[self addSubview:mMapWebView];

this line is not commented ... still it is not showing image on top of the webview

Jagat
jagatnibas is offline   0 Reply With Quote
Old Sep 11, 2008, 12:22 PM   #15
whooleytoo
macrumors 603
 
whooleytoo's Avatar
 
Join Date: Aug 2002
Location: Cork, Ireland.
Send a message via AIM to whooleytoo
Could the layering be an issue? Perhaps try addSubview: positioned: relativeTo: to make sure the overlay is in front of the map view?

Edit - ignore the above, that's Mac-only. Look at the iPhone view class docs, there are methods that can order the subviews for you - if that's the issue. I don't want to give any iPhone specific details with the NDA still in place!
__________________
Mac <- Macintosh <- McIntosh apples <- John McIntosh <- McIntosh surname <- "Mac an toshach" <- "Son of the Chief"

Last edited by whooleytoo; Sep 11, 2008 at 12:28 PM.
whooleytoo is online now   0 Reply With Quote
Old Sep 11, 2008, 12:42 PM   #16
jagatnibas
macrumors regular
 
Join Date: Jul 2008
no luck

it seems positioned : relativeto is not there in iphone sdk. tried

[self bringSubviewToFrontverlayView]; in touches ended, but when i tap and release nothing happens !
jagatnibas is offline   0 Reply With Quote
Old Sep 11, 2008, 12:49 PM   #17
whooleytoo
macrumors 603
 
whooleytoo's Avatar
 
Join Date: Aug 2002
Location: Cork, Ireland.
Send a message via AIM to whooleytoo
Some things you could try:

Debug the code, and see if overlayView is actually allocated.
Also check if imageNamed: is actually returning a valid image.
Maybe you could try making the overlay a subview of the mapview, instead of a subview of "self" in the code above.
You could try using a setNeedsDisplay to force the overlay view to redraw.
__________________
Mac <- Macintosh <- McIntosh apples <- John McIntosh <- McIntosh surname <- "Mac an toshach" <- "Son of the Chief"
whooleytoo is online now   0 Reply With Quote
Old Sep 11, 2008, 01:20 PM   #18
jagatnibas
macrumors regular
 
Join Date: Jul 2008
not yet

tried everything u said, even tried making it

window addsubview

... no luck !
jagatnibas is offline   0 Reply With Quote
Old Sep 15, 2008, 02:09 AM   #19
jagatnibas
macrumors regular
 
Join Date: Jul 2008
got it

I was able to show an view as overlay, by adding it as a separate view in the window.

thanks and regards
Jagat
jagatnibas is offline   0 Reply With Quote
Old Sep 15, 2008, 08:22 AM   #20
ranjit
macrumors newbie
 
Join Date: Apr 2008
Quote:
Originally Posted by StrAbZ View Post
There is maybe a solution, you can look here :

http://code.google.com/p/iphone-google-maps-component/

mahm create a "MapView", which is an UIView, "over" a UIWebView, provide some functionnality such as zoom or moving.

And the WebView "translate" action from the UIView in javascript.

So if you want more than zooming, or moving, you should have to implements the other methods. That's why i'm going to try, since I need to add pin, and things like that.
Hi guys,


I am new to this plateform and I need to integrate the google map in one of my iphone project. I have downloaded the project from given link, but I need to highlight the current location where I am. Please let me know how can I point this google map to current location by using latitude and longitude values.


Thanks & Regards,
Ranjit Singh
ranjit is offline   0 Reply With Quote
Old Sep 30, 2008, 09:27 PM   #21
bluedolphin
macrumors newbie
 
Join Date: Sep 2008
I am wondering how to specify position of overlay?

We have the center location, but we don't know the size...

Also, even we do , do we have to calculate the overlay position based on the map by ourselves? It means every time user moves the map, or rezoom, we have to redraw the overlay?
bluedolphin is offline   0 Reply With Quote
Old Sep 30, 2008, 10:29 PM   #22
Niiro13
macrumors 68000
 
Join Date: Feb 2008
Location: Illinois
Send a message via AIM to Niiro13 Send a message via MSN to Niiro13 Send a message via Yahoo to Niiro13
Oh, so in order to get maps, you have to call external API? No wonder why the applications with maps were so slow.
Niiro13 is offline   0 Reply With Quote
Old Oct 4, 2008, 01:16 PM   #23
varchar
macrumors member
 
Join Date: Aug 2008
In case it helps, I am using static google maps, although it does not provide the zooming and other functionality, it does go very quick and allow you to create overlays (basic).
varchar is offline   0 Reply With Quote
Old Oct 12, 2008, 12:32 PM   #24
2002cbr600f4i
macrumors 6502
 
Join Date: Jun 2008
Likewise, I have a need to embed the map functionality inside of an app I'm writing at work. Basically I want the map in the top 2/3 of the screen, and a table on the bottom 1/3. I need to be able to have pushpins show up on the map at specific locations (based on the data in the table).

Couple questions:

1) how does one go about putting the pushpins or icons or something like that onto the map?

2) Is there a way to add this component into the Interface Builder Palette?

3) I noticed in the code for the MapView that there's a call to:

"http://maps.google.com/iphone-test?width=%d&height=%d&zoom=%d"

If #1 has to be done via KML, how do I get the KML injected into the page? Don't I have to host the KML somewhere else? (sorry, I have only very limited experience dealing with Google Maps/Earth.)

Any help is appreciated. I'm on a tight deadline to get this all working....

--Mike
2002cbr600f4i is offline   0 Reply With Quote
Old Oct 14, 2008, 01:28 PM   #25
2002cbr600f4i
macrumors 6502
 
Join Date: Jun 2008
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
2002cbr600f4i is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Do you need to know programming to make a informational app for the iPhone? cootersgarage6 Mac Basics and Help 1 Jan 28, 2011 08:44 PM
What is the easiest language to program in for iPhone apps? cootersgarage6 iPhone and iPod touch Apps 1 Jan 28, 2011 03:40 PM
How hard is making an app on Iphone SDK? cootersgarage6 iPhone/iPad Programming 4 Dec 24, 2010 12:54 PM
help please...i install the iphone sdk package I can't find IPhone SDK tools kuanhsuh iPhone/iPad Programming 2 Dec 25, 2008 08:09 PM
no mashable maps for the iphone SDK? nujjus Mac Programming 3 Apr 20, 2008 07:47 PM


All times are GMT -5. The time now is 11:31 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC