ExtraMapUtils is an android library to make working with map markers, polygon and polyline drawing on googlemaps

Overview

simple library for handle markers, polygons and polylines on google maps.

Android Arsenal Build Status

ExtraMapUtils is an android library to make working with map markers, polygon and polyline drawing on googlemaps, more convenient.

Project Setup and Dependencies

  • JDK 8
  • Android SDK Build tools 25.0.2
  • Supports API Level +17
  • AppCompat & Cardview libraries 25.3.0
  • Google Play Services Maps 10.2.0

Highlights

  • Provides multiple themea to apply on MapView
  • Add multiple markers, polygons & polylines easily
  • Supports vector drawable for marker icon
  • Supports Lite Mode
  • Supports calculating area of polygon & length of polyline
  • Supports GeoJson & KML as layer from url or resource file

Preview

Demo

You can download the latest demo APK from here: https://github.com/bkhezry/ExtraMapUtils/blob/master/assets/DemoExtraMapUtils.apk

Screenshots

Setup

1. Provide the gradle dependency

Add it in your root build.gradle at the end of repositories:

allprojects {
	repositories {
		...
		maven { url "https://jitpack.io" }
	}
}

Add the dependency:

dependencies {
	compile 'com.github.bkhezry:ExtraMapUtils:v1.2.0'
}

2. Add your code

add MapView to UI layout

">
<com.google.android.gms.maps.MapView
	android:id="@+id/mapLite"
	android:name="com.google.android.gms.maps.MapFragment"
	android:layout_width="match_parent"
	android:layout_height="300dp"
	app:liteMode="true"
	app:mapType="normal" />
new ViewOptionBuilder()
	.withStyleName(ViewOption.StyleDef.RETRO)
	.withCenterCoordinates(new LatLng(35.6892, 51.3890))
	.withMarkers(AppUtils.getListExtraMarker())
	.withPolygons(
		AppUtils.getPolygon_1()
	)
	.withPolylines(
		AppUtils.getPolyline_2(),
		AppUtils.getPolyline_4()
	)
	.withForceCenterMap(false)
	.build();

after declaring the ViewOption, add this code for showing elements on the MapView

 MapUtils.showElements(viewOption, googleMap, getActivity());

ViewOption attributes

Name Type Default Description
title String @NullAble use in demo as CardView tile
centerLatLng LatLng @NullAble center of Map
forceCenterMap boolean false force map moving to centerLatLng point
mapsZoom float 14 zoom of map when map moving to centerLatLng
markers ExtraMarker @NullAble list of ExtraMarker that showing on Map
polygons ExtraPolygon @NullAble list of ExtraPolygon that showing on Map
polylines ExtraPolyline @NullAble list of ExtraPolyline that showing on Map
isListView boolean false when using utils in ListView this parameter should be true. because fixing zoom of bounded map
styleName StyleDef DEFAULT style of google map

declare ExtraMarker

new ExtraMarkerBuilder()
	.setName("Start")
	.setCenter(latLngs_3[0])
	.setIcon(icons_2[0])
	.build()

ExtraMarker attributes

Name Type Default Description
name String @NullAble label of Marker
center LatLng @NoneNull center of Marker
icon int @NoneNull icon of marker

delare ExtraPolygon

new ExtraPolygonBuilder()
	.setPoints(latLngs_1)
	.setzIndex(0)
	.setStrokeWidth(10)
	.setStrokeColor(Color.argb(100, 0, 0, 0))
	.setFillColor(Color.argb(100, 200, 200, 200))
	.build();

ExtraPolygon attributes

Name Type Default Description
points LatLang[] @NoneNull list of point
fillColor int none color color of polygon filling
uiOptions UiOption @NoneNull some parameter of polygon

declare ExtraPolyline

 new ExtraPolylineBuilder()
                .setPoints(latLngs_2)
                .setzIndex(0)
                .setStrokeWidth(10)
                .setStrokeColor(Color.argb(100, 255, 0, 0))
                .build();

ExtraPolyline attributes

Name Type Default Description
points LatLang[] @NoneNull list of point
uiOptions UiOption @NoneNull some parameter of polyline

UiOption attributes

Name Type Default Description
strokeColor int Color.BLACK line color
strokeWidth int 10 width of line
zIndex int 0 zIndex of polyline or polygon
strokePattern StrokePatternDef Default stroke pattern of line

getArea() method in ExtraPolygon return Area of polygon in square meters. getLength method in ExtraPolyline return Length of polyline in meters.

add GeoJson to ViewOption

new ViewOptionBuilder()
	    .withTitle("GeoJson")
	    .withGeoJson(context.getString(R.string.geo_json_url))
	    .withStyleName(ViewOption.StyleDef.DEFAULT)
	    .withGeoJsonEventListener(new onGeoJsonEventListener() {
		@Override
		public void onFeatureClick(Feature feature) {
		    //Do more things.
		}

		@Override
		public void onGeoJsonLoaded(GeoJsonLayer geoJsonLayer) {
		    AppUtils.addColorsToMarkers(geoJsonLayer);
		}
	    })
	    .withIsListView(true)
	    .build();

Todo

  • clustering support for markers
  • add GeoJson & KML layers to map
  • add more demo for mixed elements.
  • javadoc
  • ...

Developed By

License

Copyright 2017 Behrouz Khezry

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
You might also like...
Android Maps Extensions is a library extending capabilities of Google Maps Android API v2.

Android Maps Extensions Library extending capabilities of Google Maps Android API v2. While Google Maps Android API v2 is a huge leap forward comapare

Android library project that lets you manage the location updates to be as painless as possible

Smart Location Library Android library project that intends to simplify the usage of location providers and activity recognition with a nice fluid API

Maps SDK for Android Utility Library
Maps SDK for Android Utility Library

Maps SDK for Android Utility Library Description This open-source library contains utilities that are useful for a wide range of applications using th

Android library that allows you to determine your location in a few of lines
Android library that allows you to determine your location in a few of lines

locsimple Android library that allows you to determine your location in some lines! Benefits: automatic processing of permissions processing of enabli

A library for reverse geocoding coordinates in Android

📍 AndroidReverseGeocoder A library for reverse geocoding coordinates in Android. The library is built on top of android's Geocoder library. AndroidRe

Positional is a location information app for Android with Compass, Clock, Level, Sun and Moon and many other features.
Positional is a location information app for Android with Compass, Clock, Level, Sun and Moon and many other features.

Positional is a location based app that utilizes the device's GPS and fetches various details of the current latitude and longitude data like Altitude, Speed, Address and similar other information and show it in easily understandable format to the user. Alongside this main functionality of being a location app, Positional also provides a separate panel for Compass and Clock, and they serve their own purpose as their name suggests.

🍃 Organic Maps is an Android & iOS offline maps app for travelers, tourists, hikers, and cyclists based on top of crowd-sourced OpenStreetMap data and curated with love by MapsWithMe founders.
🍃 Organic Maps is an Android & iOS offline maps app for travelers, tourists, hikers, and cyclists based on top of crowd-sourced OpenStreetMap data and curated with love by MapsWithMe founders.

🍃 Organic Maps is an Android & iOS offline maps app for travelers, tourists, hikers, and cyclists based on top of crowd-sourced OpenStreetMap data and curated with love by MapsWithMe founders. No ads, no tracking, no data collection, no crapware.

An android app that uses Google Maps API and SDK to track a user's location and calculate the total distance travelled
An android app that uses Google Maps API and SDK to track a user's location and calculate the total distance travelled

Bike Rush is an android app that uses Google Maps API and SDK to track a user's location and calculate the total distance travelled by him or her along with time and average speed.

Interactive, thoroughly customizable maps in native Android powered by vector tiles and OpenGL.
Interactive, thoroughly customizable maps in native Android powered by vector tiles and OpenGL.

Interactive, thoroughly customizable maps in native Android powered by vector tiles and OpenGL.

Owner
Tell Me How
I am owner of http://tellmehow.co and it is a technology blog with latest Android library news.
Tell Me How
This is a repo for implementing Map pan or drag (up, down, right ,left) to load more places on the Google Map for Android

Challenge Display restaurants around the user’s current location on a map ○ Use the FourSquare Search API to query for restaurants: https://developer.

Mahmoud Ramadan 7 Jul 30, 2022
A view abstraction to provide a map user interface with various underlying map providers

AirMapView AirMapView is a view abstraction that enables interactive maps for devices with and without Google Play Services. It is built to support mu

Airbnb 1.8k Dec 4, 2022
BlueMap addtion plugin. Add a marker command to the game to easily setup your markers ingame without touching configs

BlueMap Marker Manager -> Download BlueMap here BlueMap supports a variety of marker setups by default, but it requires some work from editing configs

Miraculixx 6 Dec 3, 2022
Curve-Fit is an Android library for drawing curves on Google Maps

Curve-Fit Android library for drawing curves on Google Maps. This library uses Bezier cubic equation in order to compute all intermediate points of a

Sarweshkumar C R 63 Mar 7, 2021
malik dawar 87 Sep 18, 2022
This project allows you to calculate the route between two locations and displays it on a map.

Google-Directions-Android This project allows you to calculate the direction between two locations and display the route on a Google Map using the Goo

Joel Dean 970 Dec 15, 2022
LocationPicker 2.1 0.4 Java - A simple and easy to way to pick a location from map

Introduction LocationPicker is a simple and easy to use library that can be integrated into your project. The project is build with androidx. All libr

Shivpujan yadav 61 Sep 17, 2022
typedmap is an implementation of heterogeneous type-safe map pattern in Kotlin

Typedmap typedmap is an implementation of heterogeneous type-safe map pattern in Kotlin. It is a data structure similar to a regular map, but with two

Ryszard Wiśniewski 34 Nov 7, 2022
Slime loader is a map loader & saver for the file format Slime as specified here implemented in Minestom.

??️ SlimeLoader Slime loader is a map loader & saver for the file format Slime as specified here implemented in Minestom. Features: World loading Bloc

null 25 Oct 2, 2022
Self-hosted map of visited places (with a very fancy stack underneath)

Tripmap Self-hosted map of visited places (with a very fancy stack underneath) Features Sharing custom map-view with pins in locations marked by user.

Igor Kurek 2 Feb 6, 2022