BlackBerry RichMapField is blank on device - blackberry

I use RichMapField like below to display Blackberry Maps in my application.
RichMapField map = MapFactory.getInstance().generateRichMapField();
add(map);
The map is displayed properly on the BlackBerry simulator, but on a device the map field is blank.
Edited:
This is some part of my code. The code given below adds 2 markers to the map, which works perfectly fine, but the only problem is i don't see the map.
MapLocation Location1 = new MapLocation(coordinates[0],coordinates[1],"Location 1",null);
int Location1ID = data.add((Mappable)Location1,"Location 1");
data.tag(Location1ID, "Location1");
MapLocation Location2 = new MapLocation(coordinates[0]-0.00009,coordinates[1]- 0.00009,"Location 2",null);
int Location2ID = data.add((Mappable)Location2,"Location 2");
data.tag(Location2ID, "Location2");
data.setVisible("Location");
map.getMapField().update(true)

Add the following:
map.getAction().setCentreLatLon(coordinates[0],coordinates[1]);
map.getAction().setZoom(0);
I think this way you will see the map now. For some reason I'm still investigating, the map.getAction().update(true);
isn't working well for me too.

depends on your screen painting method. If your override your screen in such a way that u repaint ur screen on top of ur map, you obviously cant see the map.
Can you try pasting more code and ur paint method. It will help.

Related

Map loosing position on orientation change on Xamarin iOS

I have a custom map in xamarin that i have custom renders in both iOS and Android.
The problem is in iOS when i navigate to a position and then rotate my device to landscape it moves my map center to what I think is lat 0, lon 0
Even if i set my map location when the map is first rendered it resets as soon as the orientation changes.
I use the following code to set the camera position
MKMapCamera cam = new MKMapCamera();
CLLocationCoordinate2D MyPosition;
MyPosition = Constants.centreLatLng
cam.Altitude = 1500;
cam.CenterCoordinate = MyPosition;
Constants.nativeMap.SetCamera(cam, false);
I want it so when i change the orientation my map center stays the same as what it was.
As you can see in the Xamarin official documentation for the MapKit,
https://learn.microsoft.com/en-us/dotnet/api/mapkit.mkmapcamera?view=xamarin-ios-sdk-12 you can try to over ride the DidChange or DidChangeValue function and figure out what the latest value of the camera position is. So then you know what value to set OnSizeAllocated.
Also you might want to try initializing the values of the map shown in the example, because you shouldn't be having this problem.

How to remove map Places and annotations from MKMapKit in Objective c

Hi i have an MapView in My Project i need to remove all the labels Annotations, places from MapView. Looks like Plain mapView
i tried the Following Code its working fine but still i getting some building details, Street names and all i want that also to be removed only User Location Can be Visible
here is the code:
[mapView setShowsPointsOfInterest:NO];
the above code working fine and removed default location icons from mapKit but not removing all Icons and Label, how to remove all default icons and label names from MapKit
starting with iOS 11, you can set
mapView.mapType = .mutedStandard
This removes distracting details from the map.
Apple uses this type of map, when they want to emphasise a transit route and everything else should be in the background without distracting.
Starting with iOS 13 you have even more fine grained control:
Using MKMapKit.pointOfInterestFilter you can include or exclude specific categories of points of interest.
So if you're making an App 'Best restaurants in my city', your app has its own restaurant annotations, you remove the restaurant category from Apple's point of interests, but all other POI categories are just fine for you.
https://developer.apple.com/documentation/mapkit/mkmapview/3143417-pointofinterestfilter?language=objc
Starting with iOS 16 most APIs described above are deprecated, but the ideas remain the same.
Now you set MKMapView.preferredConfiguration to a subclass of class MKMapConfiguration. These subclasses are
MKStandardMapConfiguration
MKHybridMapConfiguration
MKImageryMapConfiguration
Each of these classes have exactly those parameters that make sense for the type of map.
For example, MKImageryMapConfiguration shows no POIS and no roads, so it makes no sense that this class has parameters like pointOfInterestFilter or showsTraffic.
Classes MKStandardMapConfiguration and MKHybridMapConfiguration now have a parameter pointOfInterestFilter that has been in MKMapKit.pointOfInterestFilter in earlier iOS versions.
Old deprecated mapView.mapType = .mutedStandard is now init parameter emphasisStyle of class MKStandardMapConfiguration
P.S.
Please also have a look at the other answer of #Grimxn. Bringing your own overlay is much effort but a valid alternative.
It seems to be a bit of a kludge.
Firstly, you replace the map with an overlay of your own...
self.mapView.insertOverlay(underlay, at: 0, level: MKOverlayLevel.aboveLabels)
This can be anything. If you want to use Google Maps, or Open Street Map, you can, like this:
let url = "http://mt0.google.com/vt/x={x}&y={y}&z={z}"
//let url = "http://c.tile.openstreetmap.org/{z}/{x}/{y}.png"
let underlay = MKTileOverlay(urlTemplate: url)
underlay.canReplaceMapContent = true
alternatively, if you just want blank, give it a default layer:
let underlay = MKTileOverlay()
underlay.canReplaceMapContent = true
The parameter level: allows you to specify whether your background obscures just their background map, or the background & roads or the background & labels, but NOT above everything. The documentation says:
MKOverlayLevel.aboveLabels
case aboveLabels = 1
Place the overlay above map labels, shields, or point-of-interest
icons but below annotations and 3D projections of buildings.
I can't get that to work for the default MKTileOverlay() - it seems to do the same as the alternative .aboveRoads - i.e. it hides all of the map including roads, but not labels. When you specify one of the external overlays (e.g. google) - they DO replace the labels. Probably a bug, so the final step, to completely obliterate the labels is
self.mapView.mapType = .satellite
This removes the labels, and your overlay is hiding the satellite map. Not neat, but not difficult, either.
In case anyone is coming back to this, as of writing this, if you want literally just a map and road names, no points of interest, just use
mapView.pointOfInterestFilter = .excludingAll

Set a users location on iOS app

What I'm trying to do is set the location of my iPhone through my app. The only thing I've been able to do is in xcode go to debug->simulate location. My question is, is it possible to set the location without using xcode.
Thanks!
You may do some modification when you achieve your locations.
You can use a viewController with a map view to choose a location.
when you want to simulate a location, just achieve from your simulated locations.
I have wrote a similar function before, you can make a reference.
The source codes
And the operations start->TabBarController->The Third Tab->The right Bar Item->The Second Row in the First Section->Long press to pick a location
If you have a locationManager, it will be very convenient. like
coordinate = [STDLocationPickerController cachedFakeLocationCoordinate]
if (coordinate.long * lat > 0) {
continue your logic
} else {
locate or pick a location
}

How to remove an arrow from Google Maps geolocation marker (iOS)?

How do you remove an arrow from Google Maps geolocation marker (iOS)?
This is an arrow I'm talking about
If you really want to remove that arrow everywhere in your app from Google Maps SDK, it might be easiest to modify asset in GoogleMaps.framework.
Just navigate (cd) to GoogleMaps.framework/Versions/A/Resources/GoogleMaps.bundle/GMSCoreResources.bundle/ and notice the following files:
GMSSprites-0-1x.png
GMSSprites-0-2x.png
GMSSprites-0-3x.png
If you open these files, you can notice the arrow is there. So just edit directly in the asset by replacing arrow by nothing (transparent pixels).
Note: I haven't test it myself and this is not tested solution, but I believe it should work.
Disclaimer: I'm not sure, but I think this modification might violate Terms & Conditions for using the SDK. I don't get any responsibility for such modification, it's your call...
There is no way to do this with current version of the SDK (1.9.1), and actually there is an open issue with this request: Look here.
As a work around, you can hide the default button with:
_map.myLocationEnabled = NO;
Then create a custom GMSMarker
GMSMarker *pointMarker = [GMSMarker markerWithPosition:currentPosition];
pointMarker.icon = [UIImage imageNamed:#"YourImage"];
pointMarker.map = _map;
And change the position of it using a CLLocationManager, so it always show the current position. It's a bit tricky but is the only way, I could think, that you can achieve this. If you need a more complete example let me know.

MapBox iOS SDK - First steps

I'm having problems taking the first few steps with MapBox iOS SDK (1.4.1).
I've started with the suggested code over here: https://www.mapbox.com/mapbox-ios-sdk/examples/
- (void)viewDidLoad {
[super viewDidLoad];
self.mapBoxView.tileSource = [[RMMapboxSource alloc] initWithMapID:#"my_map_id" enablingDataOnMapView:_mapBoxView];
self.mapBoxView.userTrackingMode = RMUserTrackingModeNone;
CLLocationCoordinate2D centerLocation;
centerLocation.latitude = NRMapStartLatitude;
centerLocation.longitude = NRMapStartLongitude;
[self.mapBoxView setCenterCoordinate:centerLocation];
[self.mapBoxView setZoom:7 animated:YES];
}
No matter what I do the map starts at a location in Washington D.C. but I've set the center coordinate to be somewhere in Europe.
The same with the zoom. No matter what value I try it has no effect on the map.
There's something with the NSLog output that confuses me. At startup it says:
Using watermarked example map ID examples.map-z2effxa8. Please go to
https://mapbox.com and create your own map style.
I was assuming that this is something that I already did by registering for a free account there and starting with my first project.
Added the tilesource 'My First Map' to the container
Origin is calculated at: 120.786199, -85.000000 Map initialised. tileSource:RMMapboxSource:
Mapbox iOS Example, zooms 0-19, no interactivity, minZoom:2.000000, maxZoom:18.000000,
zoom:18.000000 at {-77.032458,38.913175}
Apparently the sample project in the iOS SDK is loaded and ignoring everything else I try to configure.
So, how do I configure the map so I can interact with the API. What am I missing?
Any kind of help is highly appreciated. Thank you!
OK, whoever is struggling with that. The trick is to set the zoom BEFORE you set the center coordinate..
..for whatever reason.

Resources