how to set alarm to osmdroid when closer to boundary - android

I am developing an application in which I need to use maps offline. I'm using osmdroid and osmbonuspack
I have implemented code to display user's current location. And display boundary by importing KML content.
How can I set alarm to notify user, when user come closer(about 50m-100m) to that boundary?Click to see the image

You can buffer the area by (50m, 100m) and use LocationManager #addProximityAlert() to set a trigger.

Related

MapBox mapview repeat padding in screen

I use MapBox Android SDK 0.7.2 to get tiles from MapBox web service:
WebSourceTileLayer webSourceTileLayer = new WebSourceTileLayer("MapBox", "http://api.tiles.mapbox.com/v4/examples.map-zr0njcqy/-73.99,40.70,13/256x256.png?access_token=<my key>");
webSourceTileLayer.setName("MapBox")
.setAttribution("© MapBox © OpenStreetMap")
.setMinimumZoomLevel(1)
.setMaximumZoomLevel(18);
mapView.setTileSource(webSourceTileLayer);
mapView.setZoom(12);
mapView.setCenter(mapView.getTileProvider().getCenterCoordinate());
so I get back a 256x256 png format tile. But the tile repeats in the screen while I suppose it should be one tile in the screen. Any suggestion is appreciated.
Are you looking to just download the one tile from the Mapbox Web Service API? If so using a regular Android HTTP client (ex: URLConnnection class) to download it and then paint it on the Canvas would serve this better. TileLayers like WebSourceTileLayer are meant to download many different tiles and display them on the MapView as described.

How to display boundary of an area using Google maps API v2 for Android

I am writing an application where I need to mark the boundary of an area with certain colour, for example, if I search for "London", it should show a coloured boundary of London on the map. If I search for "UK", it should display coloured boundary of the UK.
This works well with Google maps on the web browser such that if I search for "Essex" on Google maps, it shows a red-dotted boundary of Essex.
Is there anyway I can get this feature on my Android app using Google maps API v2?
I found a couple of links below:
how to change the color of a particular area on Google map api v2 in android
Is it possible to get cities polygonal boundaries like in Google Maps?
It looks like I need boundary data in the form of polygon data points and use it as marker to display boundary. There are different websites which provide this polygon data but not sure how to use this data. It looks complicated, I think there has to be a simpler way to implement it.
EDIT:
Just to update on how i ended up doing it. I had to get Lat/Lng data from free boundary data providers and draw it manually using
PolylineOptions options = new PolylineOptions();
for(LatLng latLng: getLatLngList()) {
options.add(latLng);
}
options.color(Color.RED);
options.width(POLYLINE_WIDTH);
map.addPolyline(options);
I had to draw London boroughs and I got boundary data from:
https://www.google.com/fusiontables/DataSource?docid=1WlXk5RnE3oVRtrsqnm48V75pfN66Do0nbIw2xX8
Thanks
Here is a REST API for this , works well with google maps on andriod.
UK Postal-Unit(ex. ZE1 0AE) ,Sector,District, City, and wards boundaries in GeoJson
https://www.mashape.com/vanitysoft/uk-boundaries-io

Street view on Google Maps?

I try to offer 3 display modes to users of my app:
Traffic View (the standard view as on every printed map)
Satellite View (aerial) and
StreetView (3D, as done with the infamous Google Car)
I can set 'Standard' traffic view with
mapView.setSatellite(false);
mapView.setTraffic(true);
Satellite view with
mapView.setSatellite(true);
but
mapView.setStreetView(true);
doesn't do anything, even if I can get StreetView at the location checking with maps.google.com and a followup check for mapView.isStreetView() returns TRUE.
Can anyone help me out?
setStreetView(true) should load a tile set showing streets where StreetView data is available. It will not, however, actually display StreetView itself -- that is a separate application. You can launch StreetView, for devices that have it, for a given location by using a specific Intent structure. However, you cannot embed StreetView in your own app at this time.

Google Maps advanced features in a MapActivity (Google Maps API)

I wanted to load a custom KML file on the map. I chose the simple way:
Intent mapIntent = new Intent(Intent.ACTION_VIEW, url);
And it works well, but obviously I can't control various features like custom icons for overlay items, or the popup "Loading myKml.kml..." that shows everytime I start it, etc.
First question:
Aren't there any parameters to setup when I start a Google Maps Intent, to tweak my map? I can't find anything on the documentation.
So I was thinking about using the Google Maps API for my app. Well, I've managed to load my KML file parsing it with a SAX parser and creating a custom overlay for my map.
It works, but there is a great problem:
The placemarks aren't loaded dynamically in relation to my position. They are loaded from the start to the end, and are shown on the map 100 at time.
So it was going to be harder than I thought, because I'll have to get my position from the GPS and calculate only the nearest points and draw them on the map.
Second question:
Does exist a built-in function to show only near-to-me placemarks on the map?
Thank you, guys.
2nd question. No. Have a look at LocationManager.addProximityAlert(double latitude, double longitude, float radius, long expiration, PendingIntent intent).

gps marker on google maps android

I am developing an application which shows the current location of the user. I want to display a marker on the current location of the user.
I have used an image as marker to display current location. But i want to display an animated arrow showing the range just like in the google maps android app. Can anyone please tell me how to achieve this. Any sample code will be of great help...
try this tricky solution...
if u use javascript, try setInterval() to cahnge image if .gif doesn't work.
function runAnimation(callback){
setInterval(function(){
// set new marker here
// var newVal = callback(); <-- use callback to get new value
}
, 500); // interval in millisec
}

Categories

Resources