-
Notifications
You must be signed in to change notification settings - Fork 8
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
Track actual bus locations #30
Comments
They do in fact! An example URL request would look like this: The response body looks like this: |
Very cool! Now I have to figure out how to extend the Cordova MapKit plugin to do other types of annotations besides pins (like, say, a little bus icon) and we'd be in business! |
Never used Cordova before but when I get a chance I'll dive into your code to see how I can help. |
Cool! I'm assuming what you'll want to extend is this file: https://github.com/j-ro/WheresTheBusDC/blob/master/WheresTheBusDC/Plugins/MapKit.m And maybe MapKit.h, too. Objective-C is not my strong suit... But basically what we'd need is a function similar to the one that's there to create pins, which allows me to build a pin array like this: pins.push(
{
lat: [latitude of my pin],
lon: [latitude of my pin],
title: [title of my pin when tapped],
pinColor: "green", [<-- maybe this is replaced by a link to an image? or some variable that refers to an objective-C image that we assign, like a little bus icon?]
selected: false, [<-- choose whether or not the pin drops and immediately selects, I always say false]
index: i [<-- I don't use this...]
}
); And then drop the pins on the map like this: window.plugins.mapKit.addMapPins(pins); And clear them like this: window.plugins.mapKit.clearMapPins(); So, if we have a version that was addMapIcons and clearMapIcons that dealt with these icons, that would do it I think! |
The above code is all javascript, BTW -- probably obvious, but worth clarifying. So the plugin takes those javascript functions/data and turns them into objective-C somehow and displays them on the native map. |
Not sure if WMATA publishes this data, and would involve different pin styles in the mapkit plugin, but would be cool if we could track actual buses on the roads.
The text was updated successfully, but these errors were encountered: