I am using osmdroid library for having osm maps functionality in my app.
compile 'org.osmdroid:osmdroid-android:6.0.2'
Everything is working fine functionality wise, but I have one issue related to map appearance. A website is also being developed for the same functionality as of the app and in the web they are also using osm maps.
Now the issue is the map looks much clear on the website while it looks blurred on the android devices.
See the attached screenshots
Mobile Screenshot
Web Screenshot
Below is my code for loading the maps in my android app.
binding.map.setTileSource(TileSourceFactory.MAPNIK);
binding.map.setTilesScaledToDpi(true);
binding.map.setBuiltInZoomControls(false);
binding.map.setMultiTouchControls(true);
if (gpsTracker.canGetLocation()) {
if (gpsTracker.getLocation() != null) {
currentLocation = gpsTracker.getLocation();
centreLocation = gpsTracker.getLocation();
addCurrentLocationMarker(currentLocation);
getMarkersInCurrentLocation(currentLocation);
} else {
gpsTracker.showSettingsAlert();
}
} else {
gpsTracker.showSettingsAlert();
//Toast.makeText(getApplicationContext(), "Unable to get current location", Toast.LENGTH_LONG).show();
}
Is this related to the tile source that I am using ?
This is due to binding.map.setTilesScaledToDpi(true) which scales the tiles depending to your device resolution.
Try without: the image will be clean, but labels should be too small, less readable.
AFAIK, no good solution yet: OpenStreetMap tiles are not available at the resolution of current mobile devices.
-- EDIT 12/12/2018 --
See https://github.com/osmdroid/osmdroid/issues/1217
Related
I am successfully showing a spherical image using the Google Panorama API
I am using the same code as most tutorials do:
#Override
public void onConnected(Bundle bundle){
Panorama.PanoramaApi.loadPanoramaInfo(GOOGLE_CLIENT,Uri.parse(url)).setResultCallback(
new ResultCallback<PanoramaApi.PanoramaResult>(){
#Override
public void onResult(PanoramaApi.PanoramaResult result){
if (result.getStatus().isSuccess()){
Intent intent = result.getViewerIntent();
if (intent != null){
startActivity(intent);
}
}
}
});
}
Actually, I do not only have one sphere but around 5. I would like to be able to switch between the images clicking on menu items overlayed over the images.
Since the actual activity showing the sphere is not defined by me but started through an intent received in the success callback I have no idea how I can achieve this and the API does not seem to offer much more possibilities.
I guess I can not even show a dialog on top of the sphere.
Does anybody have any ideas for me? I'd appreciate it a lot
Note: This question purposely is phrased very similarly to this SO post.
Solution: Switch to the more recent Google API – Google VR – with which it is possible to embed spherical 360° images in a view instead of starting an activity through an intent, which one has no control of.
Note: The API is still labeled experimental but being part of the VR API this looks like the library being actively developed.
Another advantage: This is open source while the older Google Panorama API is part of google play services, which is not.
PS: Before I looked into these libraries I tested PanoramaGL and OpenPanodroid. Both libraries are not maintained for years and it was no big suprise the results could not keep up with the Google libraries.
In the HERE SDK user guide there is a screenshot showing the next maneuver. See:
https://developer.here.com/mobile-sdks/documentation/android-hybrid-plus/topics/map-guidance.html
Is this something that is provided by the SDK or is the developer expected to render this manually?
Here is the navigation code I am using:
Route route = list.get(0).getRoute();
map.setMapScheme(Map.Scheme.CARNAV_DAY);
map.getPositionIndicator().setVisible(true);
map.setTilt(45);
map.addMapObject(new MapRoute(route));
manager.setRoute(route);
manager.setTrafficAvoidanceMode(NavigationManager.TrafficAvoidanceMode.DYNAMIC);
manager.setRealisticViewMode(NavigationManager.RealisticViewMode.DAY);
manager.setMap(map);
NavigationManager.Error simError = manager.startNavigation(route);
if(simError != NavigationManager.Error.NONE) {
Log.e(LOG_TAG, "Error" + simError);
}
Maybe a bit late, but for the others who are having the same question,
You can use the HERE Mobile SDK UI Kit (MSDKUI) which provides a highly customizable user interface components that can be used on top of the HERE SDKs.
Here is the repo on Github:
https://github.com/heremaps/msdkui-android
Some things are rendered automatically by the HERE SDK, mainly things that are directly tied to the map rendering (like navigation arrows on the street when doing guidance), but most UI things you have to do on your own since most users want to have their own look&feel and UI.
So, yes the maneuver icons are something you have to provide and render in your UI manually (or the other way around: you have the full freedom to decide how it should look like).
I'm building a meteor / cordova app that consists of a template with a Leaflet map, where the tiles and icons are provided by mapbox (I'm not sure if it's relevant).
The app is using the bevanhunt:leaflet package, and is running fine when deployed on a web browser.
var map; //outside of the template
Template.map.rendered = function() {
L.Icon.Default.imagePath = 'images';
if (!map) {
map = L.map('map', {
doubleClickZoom: false,
zoomControl: false
});
}
var attributionText = "<a href='http://zencity.io/' target='_blank'>ZenCity © </a>" +
"<a href='https://www.mapbox.com/about/maps/' target='_blank'> Mapbox ©" +
" OpenStreetMap</a>";
L.tileLayer('https://{s}.tiles.mapbox.com/v3/{id}/{z}/{x}/{y}.png', {
maxZoom: 18,
attribution: attributionText,
id: 'someID'
}).addTo(map);
//some code to put makers on the map
}
I should say that the markers / popups appear fine (But their images are not present; a minor problem, I will try to take care of that), but the map does not seem to initialize.
Do I need to create the map outside of the Template.map.rendered code?
Do I need to add configuration to enable leaflet / mapbox to work with Cordova/android?
Any help would be appreciated here.
Meteor 1.0.4 introduced the App.accessRule setting to mobile-config.js. You need to add the URL for the tile provider to it like this:
App.accessRule('https://*.tiles.mapbox.com/*');
Basically, for security reasons Cordova apps may not connect to any URL they like. This is what this white list is used for. It restricts from what URLs content may be loaded. As the tile URL is different from your app URL it gets rejected by default. Using the App.accessRule setting you allow additional URLs. The supported domain patterns vary slightly between Android and iOS, you can find them in the official docs. Asterisks (*) can (and must) be used as wild cards, here for supporting the dynamic subdomain.
I am using HERE Maps to show a map letting users choose a location of interest. It works fine on desktop, but on mobile devices I am experiencing some problems.
On Android devices, if I create a map using
var map = new nokia.maps.map.Display(document.getElementById("map"), {
// Initial center and zoom level of the map
center: startCoordinate,
zoomLevel: 5,
components: [
new nokia.maps.map.component.Behavior(),
new nokia.maps.map.component.ZoomBar(),
new nokia.maps.map.component.ScaleBar()
]
}
);
the browser freezes after a few seconds. You can test this at karmap.com; try to scroll down to the very bottom to find the map. If I remove the code shown above the browser won't freeze anymore (but I won't get the map, of course).
Another problem occurs, when loading the page on iOS devices; in the form at the bottom you can find an input box named "Place of Birth". After typing 3 letters or more I start an ajax request to find suitable city names. This doesn't work if I use the following code (right under the code snippet to create the map):
map.removeComponent(map.getComponentById("zoom.MouseWheel"));
map.set("baseMapType", map.SATELLITE); // Activates satellite imagery on the display
If I comment that code out, the ajax calls work fine.
For me, that is some strange side effect! Does anyone have a clue what is going on?
Thanks for any help or advice!
Im writing a small webapp based on the idea of openspot for training proposal.
When I open the map with my desktop pc everything is fine, but when I open it with my HTC Desire and add a marker the map hangs.
You can find a demo here (in german)
http://park-a-lot.de
Just go to "eintragen" and set a marker.
Then go hack and click on "parkplatze".
You'll see the issue.
Its ok that the toolbar at the top hides when you move the map, because of a jqtouch bug with Google maps.
Thank you in advance.
This solution may help. I know it works great in the ipod safari browser and Opera on an HTC Android phone.
http://nickjohnson.com/b/google-maps-v3-how-to-quickly-add-many-markers
Having lots of markers on the map does really slow it down on android. One thing you can try is to only show the relevant markers, i.e. those that are in the bounds of the map. In my case this made the map much less sluggish:
google.maps.event.addListener(map, 'bounds_changed', function() {
var bounds = map.getBounds();
for (id in stations) {
var marker = stations[id].marker;
var isVisible = marker.getVisible();
var shouldBeVisible = bounds.contains(stations[id].latLng);
if (isVisible != shouldBeVisible) {
marker.setVisible(shouldBeVisible);
}
}
});