Update a map windows phone mango - windows-phone-7.1

I have a problem with the routing in a bing maps with windows phone mango. I need to update the map eliminating the old path when the user click on search everytime. I used the following guide: http://msdn.microsoft.com/en-us/library/ee681887.aspx and it works, but when i search again on the map remains the old paths. Thanks for the help!

I resolved the problem. i inserted in xaml map an attribute MapPolyline "percorso" and this is the code c#
// If the route calculate was a success and contains a route, then draw the route on the map.
if ((e.Result.ResponseSummary.StatusCode == BingMapRouteService.ResponseStatusCode.Success) & (e.Result.Result.Legs.Count != 0))
{
this.percorso.Locations = new LocationCollection();
// Retrieve the route points that define the shape of the route.
foreach (Location p in e.Result.Result.RoutePath.Points)
{
Location location = new Location();
location.Latitude = p.Latitude;
location.Longitude = p.Longitude;
this.percorso.Locations.Add(location);
}

Related

how to display generated message in the console in flutter ?

hello I tried to extract longitude and latidude message printed in the console, I use map view plugin https://pub.dartlang.org/packages/map_view. when I tap on the map a printed longitude and latitude is generated in the console, the function use is:
Receive map touches
mapView.onMapTapped
.listen((location) => print("Touched location $location"));
But I want to read the longitude and latitude generated in the console to upload my variable and show the map with the new coordinate.
You can do something like this:
var longitude;
var latitude;
mapView.onMapTapped.listen((location) {
print("Touched location $location");
// in a stateful widget
setState(() {
longitude = location.longitude;
latitude = location.latitude;
};
});
Then use it with the var longitude.
Where someFunction is the function that updates the map. (For updating the map you can use a state)
Next time read the starting guide before asking.

Mapbox Geocoder focalLocation not returning expected results of nearby places

I posted this issue on GitHub, though it has been over a week and no response from the developers, so hoping to get an answer here.
Using the example code, plus adding a bit to show placemarks returned from ForwardGeocodeOptions, I came up with this testing code:
(Swift 3, Xcode 8)
func mapView(_ mapView: MGLMapView, regionDidChangeAnimated animated: Bool) {
geocodingDataTask?.cancel()
self.outputText.text = ""
// Variables.userLat and Variables.userLng are set through locationManager
let options = ReverseGeocodeOptions(coordinate: CLLocationCoordinate2D(latitude: Variables.userLat, longitude: Variables.userLng))
geocodingDataTask = geocoder.geocode(options) { [unowned self] (placemarks, attribution, error) in
if let error = error {
NSLog("%#", error)
} else if let placemarks = placemarks, !placemarks.isEmpty {
self.resultsLabel.text = placemarks[0].qualifiedName
let foptions = ForwardGeocodeOptions(query: self.inputText.text!)
// To refine the search, you can set various properties on the options object.
foptions.allowedISOCountryCodes = ["US"]
foptions.focalLocation = CLLocation(latitude: Variables.userLat, longitude: Variables.userLng)
let neLat = Variables.userLat + 1.0
let neLng = Variables.userLng + 1.0
foptions.allowedRegion?.northEast = CLLocationCoordinate2D(latitude: neLat, longitude: neLng)
let swLat = Variables.userLat - 1.0
let swLng = Variables.userLng - 1.0
foptions.allowedRegion?.southWest = CLLocationCoordinate2D(latitude: swLat, longitude: swLng)
foptions.allowedScopes = [.address, .pointOfInterest]
let _ = geocoder.geocode(foptions) { (placemarks, attribution, error) in
guard let placemark = placemarks?.first else {
return
}
let coordinate = placemark.location.coordinate
print("\(coordinate.latitude), \(coordinate.longitude)")
self.inputLat.text = coordinate.latitude.description
self.inputLng.text = coordinate.longitude.description
var string = ""
for mark in placemarks! {
if string != "" {
string += "\n"
}
string += mark.qualifiedName
}
self.outputText.text = string
}
} else {
self.resultsLabel.text = "No results"
}
}
}
That gives me a mini-app to test out the data that is returned when I change locations in the Xcode Simulator.
screenshot 2017-07-12 13 54 09
As you can see from this shot, I have centered the map in Jenks, OK (a small town just outside of Tulsa, OK - sort of a 'central US' location.)
When searching for a common place in that area ("Walmart" - which is based in nearby Arkansas, so there are plenty of them around), you can see that only 2 'local' Walmart's come back in the search.
Now, let's move to Bentonville, AR - the home of Walmart......
And, we get two top new results, but the others are the same (and much farther away than Tulsa, OK.....)
We found that if we add the town to the first of the search, the results are much better:
(similar results are true for every search we did - various cities around the US and with other 'common places' like Quiznos (similar results as Walmart when in their home town of Denver, CO...)
As you can see from my code, I tried using the allowedRegion?.northEast and southWest (as I understand it, those should set the search area to about 100 miles around the location, though I'm not sure I set that up right), though no difference was found from this setup (i.e., with/without I get the same results).
The only 'better' results were by putting in the town name along with the 'common' one (though, oddly, different results were returned if the town name was before or after the common one - I didn't check exactly, though I think they are 'best' (i.e., locations are all pretty near) from putting the town name after the common one)
What can I do to get better results without having to tell the user to enter the town name (not a very desirable plan! :)
Thank you in advance for tips - the lookup is a key part of the app (not the test stuff shown in the pictures! ) and users expect to pull up several 'nearby' common places (in this case, we would expect to see all 5 results within something like 20 miles - certainly no more than 100 miles away), so it is an important thing for us that this work much more reliably than we are seeing now.

Google Places Picker IOS customization

I'm using the Google Place Picker APi and wanted to know if there is a way to remove the back button and the search button and also prevent the map from moving around, that is created with the _placePicker = [[GMSPlacePicker alloc] initWithConfig:config]; ?
if not, is there an alternative i can use that provides same functionality? Basically, I want the the closest points of interest near a users location..
Thanks.
I'm also trying to figure that out. So far, what I've come up with is to combine GMSMapView and GMSPlacesClient into your own custom viewcontroller.
To gather the nearby points of interest, you'll use the GMSPlacesClient:
placesClient = GMSPlacesClient.sharedClient()
likelyPlace = [GMSPlaces]()
placesClient.currentPlaceWithCallback({ (placeLikelihoods, error) in
if let error = error {
print("Error with Current place: \(error.localizedDescription)")
} else {
if let likelihoodList = placeLikelihoods{
for likelihood in likelihoodList.likelihoods {
let place = likelihood.place
self.likelyPlaces.append(place)
}
}
}
})
this will put the nearby places in your likelyPlaces array. Then it's up to you how you'd want to display the contents. Maybe put them in a tableView or as annotations on the map.
Hope this helps.

How to download offline maps with SKMaps?

I tried downloading offline maps with SKMaps.
At first I'd like to create a region from a self made SKTPackage like this:
SKTPackage* packageToDownload;
packageToDownload.type = 3;
packageToDownload.packageCode = #"DEBY";
SKTDownloadObjectHelper* region = [SKTDownloadObjectHelper downloadObjectHelperWithSKTPackage:packageToDownload];
Unfortunately the region is empty and every attempt to add packageToDownload.languages led to a crash. What can I do to initiate an offline map download with only the packageCode and packageType?
Thanks for your help!
In the provided code snippet, the packageToDownload object is never initialized. Replace the first line with:
SKTPackage *packageToDownload = [[SKTPackage alloc] init];

SKmaps failed to perform multi level search

I want to make a multi level offline search in my app.
I followed the directions at official Skobbler page and only difference is that l did not download map of France, but map of Wyoming instead.
Offline package code for it is USWY if I am right.
-(void)prepareForSearch{
[SKSearchService sharedInstance].searchServiceDelegate = self;
[SKSearchService sharedInstance].searchResultsNumber = 500;
_listLevel = SKCountryList;
_searchSettings = [SKMultiStepSearchSettings multiStepSearchSettings];
_searchSettings.listLevel = _listLevel;
_searchSettings.offlinePackageCode = #"USWY";
_searchSettings.parentIndex=-1;
}
- (IBAction)searchAction:(UIButton *)sender {
_searchSettings.searchTerm = [NSString stringWithFormat:#"%#",_searchBar.text];
[[SKSearchService sharedInstance]startMultiStepSearchWithSettings:_searchSettings];
}
-(void)searchService:(SKSearchService *)searchService didRetrieveMultiStepSearchResults:(NSArray *)searchResults
{
if ([searchResults count] !=0 && _listLevel<SKInvalidListLevel){
if (_listLevel == SKCountryList) {
_listLevel = SKCityList;
}
else{
_listLevel++;
}
SKSearchResult *searchResult = searchResults[0];
SKMultiStepSearchSettings* multiStepSearchObject = [SKMultiStepSearchSettings multiStepSearchSettings];
multiStepSearchObject.listLevel = _listLevel++;
multiStepSearchObject.offlinePackageCode = _searchSettings.offlinePackageCode;
multiStepSearchObject.searchTerm = _searchBar.text;
multiStepSearchObject.parentIndex = searchResult.identifier;
[[SKSearchService sharedInstance]startMultiStepSearchWithSettings:multiStepSearchObject];
}
}
-(void)searchServiceDidFailToRetrieveMultiStepSearchResults:(SKSearchService *)searchService
{
NSLog(#"Multi Level Search failed");
}
Whatever I put as a searchTerm, I end up with "MultiLevel Search Failed".
from this screenshot, you can see that my map package for Wyoming is included in my SKMaps.bundle:
(Also, if anyone can answer me this: Versioning was different in my app and in the simulator folder in the test app, from where I downloaded an offline package. So, for testing purposes, I made two folders and put Wyoming package in both of them(20140807 and 20140910). Are there any rules regarding this?)
What could be the problem?
Ok, after few days I managed to find the source of the problem.
First, I found out which version I'm using and it's the 20140910.
Second, For some reason, the entire folder containing maps was not recognised. So I took the entire SKMaps.bundle, together with some pre-bundled maps from the demo app, provided by the Skobbler team, and put it in my project and now everything works fine.

Resources