small medium large xlarge

Generic-user-small
10 Apr 2009, 05:29
Shoaib Raza (15 posts)

Hi,

I have use the iPhone-google-map-component and rendering the point over map successfully. When I am using the polylines representing the distance travelled, after 10meters app crash. Without polylines it works fine. Is there any way to draw polylines without app crash?

Regards, Shoaib

Biopic_100x100_pragsmall
11 Apr 2009, 08:57
Bill Dudney (917 posts)

Sure you can draw poly lines without an app crash.

You probably have have a bug in your code.

Good luck!

Generic-user-small
11 Apr 2009, 20:12
Shoaib Raza (15 posts)

Thanks Bill,

I have drawn the polylines but after sometime app crash. I have checked more than once but code is fine. Secondly GEvent.addListener is also not working in UIWebview? Here is code for drawing polylines

  • (void) drawPolyline:(CLLocation *)previousLocation:(CLLocation *)newLocation { NSString *script = [NSString stringWithFormat:@”var polyline = new GPolyline([” “new GLatLng(%lf, %lf),” “new GLatLng(%lf, %lf)” “], "#0000ff",3,1);” “map.addOverlay(polyline);”, previousLocation.coordinate.latitude,previousLocation.coordinate.longitude,newLocation.coordinate.latitude,newLocation.coordinate.longitude];

    NSString *res = [self evalJS:script]; NSLog(@”setting polyline with latlng, script = %@, result = %@”, script, res); }

Regards, Shoaib

Generic-user-small
13 Apr 2009, 09:33
Shoaib Raza (15 posts)

Hi Bill,

An app which requires to show a google map in UIWebview. A google markers must rolls over map according to GPS coordinates. Also needs to draw the google polyline over the travelled way and calculate the speed km/hr.

As per above scenario, I have achieved the google map in UIwebview with markers rolls over the google map as per my physical movement. Now I have two requirements

1) Calculate Speed in km/hr To achieve this, I am doing like this

Speed = (distance / timeElapsed) * 3.6

where distance is in meters and timeElapsed is in seconds. Is this the right way for getting speed?

2) Google Polyline over Google Map I also created a function which draws google polyline as marker moves. It runs successfully for limited time and then app crash up. I have tried my best to draw the polyline over map but unsuccessfull. The main reason to draw polyline is “View travelled path”. Still I didn’t get any reason why the app crahes. Without polylines, I have tested upto 40km and runs successfully and marker moves smoothly. But I need to draw polyline. How to achieve it? Is there any bug in UIWebview or using old operating system.

Currently my iPhone is 8GB with 2.1 OS. I wants to finish this app in 2.1 OS. Only issue is draw polyline over google map. Later, I’ll upgrade to new 3.0OS for getting new features.

I shall be very thankful for your guidance and technical support.

Regards, Shoaib

Biopic_100x100_pragsmall
13 Apr 2009, 15:55
Bill Dudney (917 posts)

Hi Shoaib,

Sorry I’m not very up on google map api.

Good luck!

Generic-user-small
14 Apr 2009, 06:51
Shoaib Raza (15 posts)

Thanks Bill,

But I have solved it. This is only beacuse of memory management. Everything is ok but due to lack of memory I couldn’t draw polyline more than 10km. But I have released some resources like (don’t use double data type). Also I have change the width of polyline to 2 instead of 3.

I was creating more than one GPolyline object over the map but now I am keep increamenting the existing polyline object which shows the line over the map sequently.

I have tested upto 70km and found no bug.

Shoaib

Generic-user-small
15 Apr 2010, 16:34
Khaled Sh (1 post)

Dear Shoaib,

I’m trying to draw a line only between two points any suggestions? Would polyline will be the best way to go?

Thanks

  You must be logged in to comment