简体   繁体   English

在没有付费版本的地图中显示我在路线中的自定义点

[英]Show my custom points in route in maps without paid version

Suppose I have a route from Place A to B and 1,2,3 are respectively my cycle stoppage.假设我有一条从地点 A 到 B 的路线,而 1,2,3 分别是我的循环停止点。 I want people to the only search for route and he will able to see the available stoppage between the searched route.我希望人们只搜索路线,他将能够看到搜索路线之间的可用停靠点。

Search Query will: Source: A, Destination: B搜索查询将:来源:A,目的地:B

Output: [in map View] Show the route of A to B and the stoppage points 1,2,3 where 1,2,3 has its own latitude and longitude Output: [在map视图中]显示A到B的路线和停靠点1,2,3 ,其中1,2,3有自己的经纬度

I had used google map for such functionality and the snippet is as below我曾使用谷歌 map 来实现此类功能,代码片段如下

PolylineOptions mPolylineOptions = new PolylineOptions();
.......
ArrayList<LatLong> latLngs = ....// list of route polypoints to draw path

mPolylineOptions.addAll(latLngs).width(10).color(polylineColor);

mMap.addPolyline(mPolylineOptions);

mMap.addMarker(new MarkerOptions().position(stopPoint1).flat(true).icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_car)));
mMap.addMarker(new MarkerOptions().position(stopPoint2).flat(true).icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_car)));
mMap.addMarker(new MarkerOptions().position(stopPoint3).flat(true).icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_car)));

This is also easy to do with the Bing Maps SDK :使用Bing 地图 SDK也很容易做到这一点:

 // Create layer to add your collection of map elements MapElementLayer mapLayer = new MapElementLayer(); // Create geo path with the route points ArrayList<Geoposition> positions = new ArrayList<Geoposition>(); positions.add(new Geoposition(routePoint1.getLatitude(), routePoint1.getLongitude())); positions.add(new Geoposition(routePoint2.getLatitude(), routePoint2.getLongitude())); ... positions.add(new Geoposition(routePointN.getLatitude(), routePointN.getLongitude())); // Create and add route polyline to the map layer. MapPolyline route = new MapPolyline(); route.setPath(new Geopath(positions)); mapLayer.getElements().add(route); // Create and add stop icons to the map layer. MapIcon stop1 = new MapIcon(); stop1.setLocation(new Geopoint(stopPoint1.getLatitude(), routePoint1.getLongitude())); mapLayer.getElements().add(stop1); ... // Add layer to display map elements in the map control mapView.getLayers().add(mapLayer);

If you need a web control instead, note that there are also samples in the Interactive SDK for polyline , pushpin and adding multiple items to a layer .如果您需要web 控件,请注意交互式 SDK 中也有用于polyline图钉和将多个项目添加到的示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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