{"id":3601,"url":"https://github.com/pengrad/MapScaleView","last_synced_at":"2025-08-03T20:32:49.026Z","repository":{"id":148100752,"uuid":"70134551","full_name":"pengrad/MapScaleView","owner":"pengrad","description":"Scale bar for Android Maps (Google Maps, OSM, MapBox, Yandex)","archived":false,"fork":false,"pushed_at":"2020-08-05T04:33:23.000Z","size":723,"stargazers_count":117,"open_issues_count":6,"forks_count":27,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-08-16T14:34:48.045Z","etag":null,"topics":["android-maps"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pengrad.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2016-10-06T08:02:39.000Z","updated_at":"2024-08-07T05:13:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"dc739304-aff0-4e87-bcd2-e22aa44b2787","html_url":"https://github.com/pengrad/MapScaleView","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pengrad%2FMapScaleView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pengrad%2FMapScaleView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pengrad%2FMapScaleView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pengrad%2FMapScaleView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pengrad","download_url":"https://codeload.github.com/pengrad/MapScaleView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228567009,"owners_count":17937983,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android-maps"],"created_at":"2024-01-05T20:16:46.098Z","updated_at":"2024-12-07T05:30:41.776Z","avatar_url":"https://github.com/pengrad.png","language":"Java","readme":"# Map Scale View\n[ ![Download](https://api.bintray.com/packages/pengrad/maven/mapscaleview/images/download.svg) ](https://bintray.com/pengrad/maven/mapscaleview/_latestVersion)\n[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-MapScaleView-green.svg?style=true)](https://android-arsenal.com/details/1/4541)\n\nScale view for any Android Maps SDK (not only Google Maps)\n\n![Image](images/image_rtl.png)\n\n## Contributing\nI encourage you to participate in this project. Feel free to open issues with bugs or ideas, fork and send pull requests.  \nCheck [list of \"help wanted\" issues](https://github.com/pengrad/MapScaleView/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) to start with.\n\n## Usage\n```groovy\ndependencies {\n    implementation 'com.github.pengrad:mapscaleview:1.6.0'\n}\n```\n\nInclude in layout file over map\n```xml\n\u003cFrameLayout\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    android:id=\"@+id/activity_main\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\u003e\n\n    \u003cfragment\n        android:id=\"@+id/mapFragment\"\n        class=\"com.google.android.gms.maps.SupportMapFragment\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"/\u003e\n\n    \u003ccom.github.pengrad.mapscaleview.MapScaleView\n        android:id=\"@+id/scaleView\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:layout_gravity=\"bottom|end\"\n        android:layout_margin=\"4dp\"/\u003e\n\u003c/FrameLayout\u003e\n```\n\nWith miles or custom style\n```xml\n\u003ccom.github.pengrad.mapscaleview.MapScaleView\n        android:id=\"@+id/scaleView\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:layout_gravity=\"bottom|end\"\n        android:layout_margin=\"4dp\"\n        app:scale_maxWidth=\"100dp\"\n        app:scale_color=\"#009\"\n        app:scale_miles=\"true\"\n        app:scale_outline=\"true\"\n        app:scale_strokeWidth=\"3dp\"\n        app:scale_textSize=\"20sp\"\n        app:scale_expandRtl=\"true\"/\u003e\n```\n\nUpdate on map changed\n```kotlin\nval scaleView: MapScaleView = findViewById(R.id.scaleView)\nval cameraPosition = map.cameraPosition\n// need to pass zoom and latitude\nscaleView.update(cameraPosition.zoom, cameraPosition.target.latitude)\n```\n\nFull example with subscribing to map events and updating scale view\n```kotlin\noverride fun onMapReady(googleMap: GoogleMap) {\n    map = googleMap\n    googleMap.setOnCameraMoveListener(this)\n    googleMap.setOnCameraIdleListener(this)\n}\n\noverride fun onCameraMove() {\n    val cameraPosition = map.cameraPosition\n    scaleView.update(cameraPosition.zoom, cameraPosition.target.latitude)\n}\n\noverride fun onCameraIdle() {\n    val cameraPosition = map.cameraPosition\n    scaleView.update(cameraPosition.zoom, cameraPosition.target.latitude)\n}\n```\n\nRefer to the sample project on how to use scale view with other Android Maps SDK (Mapbox).\n\n## Customization\n```java\nmapScaleView.setColor(@ColorInt int color)\nmapScaleView.setTextSize(float textSize)\nmapScaleView.setStrokeWidth(float strokeWidth)\nmapScaleView.setTextFont(Typeface font)\n\n// enable/disable white outline, enabled by default\nmapScaleView.setOutlineEnabled(false)\n\nmapScaleView.metersAndMiles() // default\nmapScaleView.metersOnly()\nmapScaleView.milesOnly()\n\n// expand scale bar from right to left, disabled by default\nmapScaleView.setExpandRtlEnabled(true)\n```\n","funding_links":[],"categories":["Libraries"],"sub_categories":["Maps"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpengrad%2FMapScaleView","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpengrad%2FMapScaleView","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpengrad%2FMapScaleView/lists"}