Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Offline map #19

Closed
dagatsoin opened this issue Mar 3, 2016 · 15 comments
Closed

[Feature] Offline map #19

dagatsoin opened this issue Mar 3, 2016 · 15 comments

Comments

@dagatsoin
Copy link

Any plans to support offline features? Coming march the 15 on ios/android

mapbox/mapbox-gl-native#4178

@EddyVerbruggen
Copy link
Contributor

We love to support all major sweet features of Mapbox so yeah! Please remind me when you see it released and want to use it.

@dagatsoin
Copy link
Author

Roger that. If you need some help to do it I would love to collaborate on the JS part if you think I have the level for.

@EddyVerbruggen
Copy link
Contributor

I don't have high standards anyway ;) Any help is truly welcome 👍

@dagatsoin
Copy link
Author

@EddyVerbruggen I just git flow feature start offlineMap so I am ready to help!
In addition to support offline map I would need also to expose some useful methods like:

My goal is to be expose essential information to sync a 2d or a 3d overlay (with three.js/pixi.js). That also could serves #15

Do you think we can include that in the next release? What could be improve/add? Maybe #20 and #21?

@EddyVerbruggen
Copy link
Contributor

Woohoo! Excited :)

It's probably best to keep the changes (PR's) small so they're easy to merge and test for everybody.

👍

@dagatsoin
Copy link
Author

Ok. This is the first time for me to collaborate on a github repo so I am not very confortable with PR's yet.
I have forked the repo and I am working on exposing convertCoordinate. I will try to do a PR just for this when it will work.

@dagatsoin
Copy link
Author

@EddyVerbruggen I think I need help to kickstart my work. It is the first time I customize a Cordova plugin.
I try to test my method exposition but receive

2016-03-25 17:55:16.203 HelloCordova[26812:753763] ERROR: Method '<null>:' not defined in Plugin 'Mapbox'
2016-03-25 17:55:16.203 HelloCordova[26812:753763] -[CDVCommandQueue executePending] [Line 142] FAILED pluginJSON = ["Mapbox1695989219","Mapbox",null,[]]

in CDVMapbox.h
- (void) convertCoordinate:(CDVInvokedUrlCommand*)command;
in CDVMapbox.m

- (void) convertCoordinate:(CDVInvokedUrlCommand *)command {
    NSDictionary *args = [command.arguments objectAtIndex:0];

    NSNumber *lat = [args valueForKey:@"lat"];
    NSNumber *lng = [args valueForKey:@"lng"];

    CGPoint screenPoint = [_mapView  convertCoordinate:CLLocationCoordinate2DMake(lat.doubleValue, lng.doubleValue)
                                         toPointToView:_mapView];

    NSArray * point = [NSArray arrayWithObjects:
                       [NSNumber numberWithFloat:screenPoint.x],
                       [NSNumber numberWithFloat:screenPoint.y],
                       nil];

    CDVPluginResult *pluginResult = [ CDVPluginResult
                                     resultWithStatus: CDVCommandStatus_OK
                                     messageAsArray: point
                                     ];
    [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}

in Mapbox.js

   convertCoordinate: function(options, successCallback, errorCallback){
    cordova.exec(successCallback, errorCallback, "Mapbox", "convertCoordinate" [options]);
  },

Do I miss a declaration somewhere?

@EddyVerbruggen
Copy link
Contributor

That's all looking fine. Can you commit and push that code to your fork? Then I'll take a look if you like.

@dagatsoin
Copy link
Author

@EddyVerbruggen
Copy link
Contributor

Take a long 👓 at this:

screen shot 2016-03-25 at 22 14 49

@dagatsoin
Copy link
Author

5s later --> OMG!!

@dagatsoin
Copy link
Author

WIP. Close this :)

@vinibiso
Copy link

Hi guys.

I read the thread and don't know what's the state of the implementation of using the offline feature of the native Mapbox with cordova?

I didn't see anything in the docs. Furthermore, I would love to help out with anything I can.

@dagatsoin
Copy link
Author

dagatsoin commented Jun 28, 2016

I will work on it next weeks for iOS and Android in #29 and it should already work with #22

@vinibiso
Copy link

Oh hey.

Thanks for the update. I was kind of lost.

Thanks you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants