Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
Airmapview | 1,824 | 12 | a year ago | 18 | October 10, 2019 | 27 | apache-2.0 | Java | ||
A view abstraction to provide a map user interface with various underlying map providers | ||||||||||
Sketch Map Generator | 831 | 2 years ago | 2 | mit | JavaScript | |||||
Sketch plugin to fill a shape with a map generated from a given location using Google Maps and Mapbox | ||||||||||
Mappa | 244 | 4 | 5 years ago | 7 | March 20, 2018 | 20 | JavaScript | |||
A canvas wrapper for Maps 🗺 🌍 | ||||||||||
Mapsheet | 198 | 9 years ago | 11 | JavaScript | ||||||
Easily create interactive maps from data in Google Spreadsheets. Supports Google Maps, Leaflet, Mapbox, MapQuest, etc. | ||||||||||
Google Map Clustering Example | 191 | 7 years ago | 4 | JavaScript | ||||||
clustering example for google-map-react | ||||||||||
Geojsonify | 144 | 2 years ago | 1 | apache-2.0 | Java | |||||
Easily add GeoJson layers to your Maps | ||||||||||
Eon Map | 131 | 5 | 1 | 4 months ago | 6 | July 08, 2017 | 17 | mit | JavaScript | |
Realtime maps with PubNub and MapBox. | ||||||||||
Mapscaleview | 101 | 3 years ago | 4 | apache-2.0 | Java | |||||
Scale bar for Android Maps (Google Maps, OSM, MapBox, Yandex) | ||||||||||
Laravel Postcodeapi | 84 | 2 months ago | 20 | February 10, 2022 | mit | PHP | ||||
Universal PostcodeApi for Laravel 8.x/9.x | ||||||||||
Nlmaps | 39 | 2 | 2 years ago | 80 | October 15, 2018 | 25 | mit | JavaScript | ||
NLMaps |
// the core library
implementation 'com.utsman.smartmarker:core:[email protected]'
// extension for google maps
implementation 'com.utsman.smartmarker:ext-googlemaps:[email protected]'
// extension for Mapbox
implementation 'com.utsman.smartmarker:ext-mapbox:[email protected]'
For extensions, you don't need to add mapbox extensions if you not use the sdk mapbox. As well as the google map sdk.
Use the default method as usual for google maps. Reference for add marker in google maps is here
And code look like this
val markerOption = MarkerOptions()
.position(latLng)
val marker = map.addMarker(markerOption) // this your marker
For Mapbox, adding marker is little hard, so I create helper for it, and you must coding after setup style
// define marker options
val markerOption = MarkerOptions.Builder() // from 'com.utsman.smartmarker.mapbox.MarkerOptions'
.setId("marker-id", true) // if marker id need unique id with timestamp, default is false
.setIcon(R.drawable.ic_marker, true) // if marker is not vector, use 'false'
.setPosition(latLng)
.setRotation(rotation)
.build(context)
// add your marker
val marker = map.addMarker(markerOption)
SmartMarker.moveMarkerSmoothly(marker, latLng)
// or for disable rotation
SmartMarker.moveMarkerSmoothly(marker, latLng, false)
// with extensions for kotlin
marker.moveMarkerSmoothly(latLng)
// or for disable rotation
marker.moveMarkerSmoothly(latLng, false)
I create location extensions for get your location every second with old location and new location, you can setup realtime level.
implementation 'com.utsman.smartmarker:ext-location:[email protected]'
// for extensions watcher location, you need some library with latest versions
implementation 'com.google.android.gms:play-services-location:17.0.0'
implementation 'pl.charmas.android:android-reactive-location2:[email protected]'
implementation 'io.reactivex.rxjava2:rxjava:2.2.12'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation 'com.karumi:dexter:6.0.0'
You can setup realtime level for get every second update, locationWatcher.getLocationUpdate(priority, listener)
level | ms |
---|---|
LocationWatcher.Priority.JEDI |
3 ms |
LocationWatcher.Priority.VERY_HIGH |
30 ms |
LocationWatcher.Priority.HIGH |
50 ms |
LocationWatcher.Priority.MEDIUM |
300 ms |
LocationWatcher.Priority.LOW |
3000 ms |
LocationWatcher.Priority.VERY_LOW |
8000 ms |
// define location watcher
val locationWatcher: LocationWatcher = LocationWatcher(context)
// get location once time
locationWatcher.getLocation { location ->
// your location result
}
// get location update every second
locationWatcher.getLocationUpdate(LocationWatcher.Priority.HIGH, object : LocationUpdateListener {
override fun oldLocation(oldLocation: Location?) {
// your location realtime result
}
override fun newLocation(newLocation: Location?) {
// your location past with delay 30 millisecond (0.03 second)
}
override fun failed(throwable: Throwable?) {
// if location failed
}
})
// stop your watcher in onStop activity
override fun onDestroy() {
locationWatcher.stopLocationWatcher()
super.onDestroy()
}
If you have not applied location permission for your app, you can be set permission with adding context before listener.
// get location once time with permission helper
locationWatcher.getLocation(context) { location ->
// your location result
}
// get location update every second with permission helper
locationWatcher.getLocationUpdate(context, LocationWatcher.Priority.HIGH, object : LocationUpdateListener {
override fun oldLocation(oldLocation: Location?) {
// your location realtime result
}
override fun newLocation(newLocation: Location?) {
// your location past with delay 30 millisecond (0.03 second)
}
override fun failed(throwable: Throwable?) {
// if location failed
}
})
Don't forget to add location permission android.permission.ACCESS_FINE_LOCATION
for your apps
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
// Convert Location to LatLng for Google Maps ('com.google.android.gms.maps.model.LatLng')
location.toLatLngGoogle()
// Convert Location to LatLng for Mapbox ('com.mapbox.mapboxsdk.geometry.LatLng')
location.toLatLngMapbox()
// use marker as vector for Google Maps
bitmapFromVector(context, R.drawable.marker_vector)
class MainActivity : AppCompatActivity() {
private lateinit var locationWatcher: LocationWatcher
private var marker: Marker? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
locationWatcher = LocationWatcher(this)
val googleMapsView = (google_map_view as SupportMapFragment)
locationWatcher.getLocation(this) { loc ->
googleMapsView.getMapAsync { map ->
val markerOption = MarkerOptions()
.position(loc.toLatLngGoogle())
.icon(bitmapFromVector([email protected], R.drawable.ic_marker))
marker = map.addMarker(markerOption)
map.animateCamera(CameraUpdateFactory.newLatLngZoom(loc.toLatLngGoogle(), 17f))
}
}
// device tracker
locationWatcher.getLocationUpdate(this, LocationWatcher.Priority.HIGH, object : LocationUpdateListener {
override fun oldLocation(oldLocation: Location) {
}
override fun newLocation(newLocation: Location) {
// move your marker smoothly with new location
marker?.moveMarkerSmoothly(newLocation.toLatLngGoogle())
// or use class SmartMarker for java
// SmartMarker.moveMarkerSmoothly(marker, newLocation.toLatLngMapbox())
}
override fun failed(throwable: Throwable?) {
}
})
}
}
class MainActivity : AppCompatActivity() {
private lateinit var locationWatcher: LocationWatcher
private var marker: Marker? = null // from 'com.utsman.smartmarker.mapbox.Marker'
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// setup instance with api key mapbox before 'setContentView'
Mapbox.getInstance(this, "sk.eyJ1Ijoia3VjaW5nYXBlcyIsImEiOiJjazI1eXFqYzQxcGZjM25ueTZiMHU3aDl3In0.EfIuu2NSv2CacIKEhkXhCg")
setContentView(R.layout.activity_main)
locationWatcher = LocationWatcher(this)
locationWatcher.getLocation(this) { loc ->
mapbox_view.getMapAsync { map ->
// set style before setup your marker
map.setStyle(Style.OUTDOORS) { style ->
val markerOption = MarkerOptions.Builder() // from 'com.utsman.smartmarker.mapbox.MarkerOptions'
.setId("marker-id")
.addIcon(R.drawable.ic_marker, true)
.addPosition(loc.toLatLngMapbox())
.build(this)
val markerLayer = map.addMarker(markerOption)
marker = markerLayer.get("marker-id")
map.animateCamera(CameraUpdateFactory.newLatLngZoom(loc.toLatLngGoogle(), 17f))
}
}
}
// device tracker
locationWatcher.getLocationUpdate(this, LocationWatcher.Priority.HIGH, object : LocationUpdateListener {
override fun oldLocation(oldLocation: Location) {
}
override fun newLocation(newLocation: Location) {
// move your marker smoothly with new location
marker?.moveMarkerSmoothly(newLocation.toLatLngGoogle())
// or use class SmartMarker for java
// SmartMarker.moveMarkerSmoothly(marker, newLocation.toLatLngMapbox())
}
override fun failed(throwable: Throwable?) {
}
})
}
}
Recycling
A Library for make an easy and faster RecyclerView without adapter
rmqa
Rabbit Message Queue for Android
Anko Navigation Drawer
Library for implementation Navigation Drawer with styles in Anko
Easy Google Login
Library for Simplify Firebase Authenticate Google Auth
Copyright 2019 Muhammad Utsman
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.
makasih