Skip to content

About

No description, website, or topics provided.

Resources

Stars

8 stars

Watchers

1 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

Repository files navigation

Maps Project

This project is a comprehensive implementation of Google Maps features, including finding and marking device locations, keyword location searching, autocomplete suggestions, changing map styles, and integrating various Google Maps APIs.

Features

  • Find and Mark Device Locations: Automatically locate and mark the user's current location on the map.
  • Keyword Location Searching and Autocomplete Suggestions: Search for locations using keywords with real-time autocomplete suggestions.
  • Change Map Styles: Dynamically switch between different map styles, such as day and night modes.
  • Google Maps APIs: Integration with various Google Maps APIs for enhanced functionality.
  • Haversine Algorithm: Utilizes the Haversine algorithm to calculate the shortest distance between points and determine the nearest station to the user's location.

Google Maps APIs Used

  1. Maps SDK for Android

    • Usage: To display the map, handle user interactions, and add markers or shapes.
    • Example:
      map.addMarker(MarkerOptions().position(currentLatLng).title("You are here"))
  2. Places API

    • Usage: To search for places, get place details, and provide autocomplete suggestions.
    • Example:
      val placeFields = listOf(Place.Field.ID, Place.Field.NAME, Place.Field.LAT_LNG)
      val request = FetchPlaceRequest.newInstance(placeId, placeFields)
      placesClient.fetchPlace(request)
  3. Distance Matrix API

    • Usage: To calculate the travel distance and time between multiple origins and destinations.
    • Example:
      val origins = "40.6655101,-73.89188969999998"
      val destinations = "40.659569,-73.933783|40.729029,-73.851524|40.6860072,-73.6334271|40.598566,-73.7527626"
      directionsService.getDistanceMatrix(origins, destinations, apiKey)
  4. Directions API

    • Usage: To get route information between an origin and a destination, including step-by-step directions.
    • Example:
      directionsService.getDirections(origin, destination, apiKey)
  5. Routes API

    • Usage: To calculate and display multiple routes from an origin to a destination.
    • Example:
      routeDrawingService.getRoutes(origin, destination, apiKey)

Images

maps1 maps2 maps3 maps4 maps5 maps6 maps7 maps8

Installation

To run this project, follow these steps:

  1. Clone the Repository:

    git clone https://github.com/your-username/maps-project.git
    cd maps-project
  2. Open in Android Studio: Open the project in Android Studio.

  3. Add Google Maps API Key:

    • Obtain an API key from the Google Cloud Console.
    • Add the API key to your local.properties file:
      MAPS_API_KEY=YOUR_API_KEY_HERE
  4. Add JitPack Repository (if using libraries from JitPack):

    allprojects {
        repositories {
            google()
            mavenCentral()
            maven { url "https://jitpack.io" }
        }
    }

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

No description, website, or topics provided.

Resources

Stars

8 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages