An Android App that displays a path between a start and end address. It incorporates the Google Maps API, JNI for creating a layer between OpenGL, C++, GLSL, GLM and Java.
Partial View of the Map
The entire map view of this app is generated using C++, OpenGL, GLSL, and GLM. This is done by creating an Android Activity that uses the OpenGL API and then using a JNI layer to call native functions as things change within the app. The app starts off by asking for a start and end address. When the Enter button is clicked by the user, a call is made to the Google GeoCoder API to get the latitude and longitude for the both the start and end address. Then, a call is made to the Google Maps API to generate routes between the points. The call can specify how many routes to take, I do not ask for alternative routes - this can be updated as the app expands. This call will generate a JSON Object that needs to be parsed for the points that create the path from start to end. An example of the JSON Object is shown below.
Routes JSON Object returned by Google Maps API
Example of JSON Object returned by call to Google Maps API
View of Path from Start to End
How to Maneuver the Map
- Slide one finger up - Zoom in
- Slide one finger down - Zoom out
- Slide one finger to the left - Strafe left
- Slide one finger to the right - Strafe right
- Slide two fingers up - move map up
- Slide two fingers down - move map down
- Slide two fingers right - move map right
- Slide two fingers left - move map left
One of the challenges I had was figuring out how to convert the polyline points from the JSON object representation to actual Latitude and Longitude. Once I had that information, it was difficult finding the correct conversion to Cartesian Coordinates. The Google Maps API uses WGS-84 Latitude and Longitude, which uses an ellipsoid and thus does not use Spherical Coordinates to move to Cartesian Coordinates. Listed in the Sources section you will find a website that I used to find a conversion better suited for the system that Google Maps uses. It isn't perfect though. There are still some problems that I am looking into - below you can see some of the interesting and wrong paths I came up with as I tested the app. Another challenge I ran into while developing the app was realizing that the Android OpenGL API, while really great, does not provide support for GLM and GLSL calls that were pertinent (as far as my knowledge goes) in creating graphics applications. So I had to figure out how to create a JNI layer and incorporate my C++ graphics code along with the Android code. Something else I will need to work through as I continue developing this app, is figuring out how to store files such as shaders and textures within the app for easy access during rendering.
Bad Path Drawn from Pleasanton, CA to Bellingham,WA
WGS-84 Lat/Lng Conversion
Thanks for reading!