pengrad / mapscaleview Goto Github PK
View Code? Open in Web Editor NEWScale bar for Android Maps (Google Maps, OSM, MapBox, Yandex)
License: Apache License 2.0
Scale bar for Android Maps (Google Maps, OSM, MapBox, Yandex)
License: Apache License 2.0
Client just call scaleView.initWith(map: GoogleMap)
when map is ready.
This method will set all camera move listeners and pass data to scaleView.
Maybe add lifecycle param to support unregistering listeners on destroy.
The google-maps or mapbox sdks should be added as runtime dependencies, to be not included in client app.
Make activity with Mapbox map in sample app
Find the way how to restrict Mapbox token
Miles scale goes down to 1 foot while meters scale goes down to 1 meter.
1 foot = 0.3 meters
Therefore the meters scale should go down to 30 centimeters.
I am using a license plugin for Android and noticed that this library does not offer any useful meta information regarding license, owner etc. Would it be possible if someone updates this via the current gradle config?
The current POM file only includes the name and version of this library.
Link to your current POM: https://bintray.com/pengrad/maven/download_file?file_path=com%2Fgithub%2Fpengrad%2Fmapscaleview%2F1.4.2%2Fmapscaleview-1.4.2.pom
When tilt != 0 then MapScaleView shows very strange information - from 20 km to 2000 km...
Also, what about:
Thank you! :)
add feature mirrored scale.
Top kilometers
-------,---ยด
Bottom miles
setOnCameraChangeListener
is deprecated
Hello, thanks anyway for your repo.
Can you help me? got this error ๐ข
Error:(67, 13) Failed to resolve: com.github.pengrad:mapscaleview:1.2.1
Show in File
Show in Project Structure dialog
Please add an option to set outline color
I am not sure the scale is correct. See the attached screenshot showing a rural area in the US. The squares are generally roads a mile apart, but the MapScaleView is indicating the distance apart is 2 miles. Seems the scale is incorrectly reporting the distance (as seen in the upper left of the map).
Hello,
Thank you for this very useful library! I quickly grabbed the code and updated it to make the view's width to be dynamic (ie it is updated when the update(...) method is called). This allows for instance to put a semi-transparent background to the MapScaleView, and to get that background's with to be updated.
Here's are the modifications I made:
Drawer.java:
int getWidth(Scales scales) {
return Math.round(Math.max(scales.top() == null ? 0 : scales.top().length(), scales.bottom() == null ? 0 : scales.bottom().length()) + strokePaint.getStrokeWidth());
}
MapScaleView.java:
private void updateScales() {
Scale top, bottom = null;
if (scaleType == ScaleType.MILES_ONLY) {
top = mapScaleModel.update(false);
} else {
top = mapScaleModel.update(true);
if (scaleType == ScaleType.BOTH) {
bottom = mapScaleModel.update(false);
}
}
scales = new Scales(top, bottom);
requestLayout();
invalidate();
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int width = measureDimension(desiredWidth(), widthMeasureSpec);
int height = measureDimension(desiredHeight(), heightMeasureSpec);
mapScaleModel.setMaxWidth(width);
drawer.setViewWidth(width);
updateScales();
int realWidth = drawer.getWidth(scales);
setMeasuredDimension(realWidth, height);
}
And here's a possible result (when I move the map, the scale bar's width is updated, including its background):
Feel free to incorporate them in your code.
Now the scale bar expand from left to right. Add option to change the direction to expand from right to left (like in google maps).
...and thanks for the great lib! ๐
Please add this feature auto scale color when map type change, like from satellite or road view.
Thank you
Hi, could you post a short example on how to implement this with OSM ?
Could add a mapbox example to this somewhere? I can't figure out how to get it to work.
Thanks
Unit tests for model.
Is it possible/necessary to add UI tests?
Hello.
I needed to change the font of the scale bar. (Yeah minor stuff)
I have a pull request ready if you want to add this feature to the repo.
This is from google maps
This is from Mapbox showing Google tiles and MapScaleView
This is from Mapbox showing Mapbox tiles and MapScaleView
According to MapScaleView that length should be almost 4000ft.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.