简体   繁体   中英

How to create transparent layer with route-me

Im struggling with something which I can't get my head arround

I have a tile source with transparent tiles that I want to add on top of a base map (open streetmap) but it's not working as it should

// setup a base map
baseMapView = [[RMMapView alloc]initWithFrame: CGRectMake(0, 0, self.view.frame.size.width - self.view.frame.origin.x, self.view.frame.size.height - self.view.frame.origin.y) ];
[baseMapView setBackgroundColor:[UIColor blackColor]];
[baseMapView setDelegate:self];
[baseMapView setDeceleration:YES];
[[baseMapView contents] setTileSource:[[[RMOpenStreetMapSource alloc] init] autorelease]];
[self.view addSubview: baseMapView];

// markings in transparent png
markerMapView = [[RMMapView alloc]initWithFrame: CGRectMake(0, 0, self.view.frame.size.width - self.view.frame.origin.x, self.view.frame.size.height - self.view.frame.origin.y) ];
[markerMapView setBackgroundColor:[UIColor redColor]];
[markerMapView setAlpha: 0.5];
[markerMapView setOpaque:NO];
[markerMapView setDelegate:self];
[markerMapView setDeceleration:YES];
LLOpenSeaMapSource *tileSource = [[LLOpenSeaMapSource alloc] init];
tileSource.baseURL = @"http://tiles.luky.nl/mark";
[[markerMapView contents] setTileSource: tileSource]; 
[self.view addSubview: markerMapView];

The images are transparent png tiles. The result is however not as I expected:

las作为叠加不是很有用 Note that the snippet I posted is after some hair pulling, I started by setting the background to clearColor and not red, but as you can see it is gray anyway :-(

Looks like you're using the straight route-me/route-me branch. AFAIK, the current project isn't set up for multiple map sources. You might want to check out the route-me/alpstein fork or the mapbox fork , they both support multiple tile sources. Because of the work that mapbox is doing, they are getting updates and features added much more frequently. IT IS NOT A PLUG AND PLAY SUBSTITUTION FROM route-me/route-me to either of these branches.

BTW, do you really need a new tile source, or could you do what you're doing with RMMarkers?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM