我的经纬度位置正常,但我需要在那边做一个指针,有可能吗?我正在为Google使用NativeScript、Angular2和NativeScript插件(nativescript-google)
file.ts
import { registerElement } from 'nativescript-angular/element-registry';
registerElement("MapView", () => require("nativescript-google-maps-sdk").MapView);file.xml
<MapView [latitude]="configService.unitPreview.latitude" [longitude]="configService.unitPreview.longitude"
zoom="17" bearing="0"
tilt="0" (mapReady)="OnMapReady"
(markerSelect)="onMarkerSelect"
(cameraChanged)="onCameraChanged">
</MapView>指针
指针
发布于 2016-07-29 08:51:54
您可以使用addMarker方法在地图中添加标记。你可以回顾我的例子,这里已经展示了,如何做到这一点。
app,component.html
<GridLayout>
<MapView (mapReady)="onMapReady($event)" ></MapView>
</GridLayout>app.com-ponent.ts
import {Component, ElementRef, ViewChild} from '@angular/core';
var mapsModule = require("nativescript-google-maps-sdk");
@Component({
selector: "my-app",
templateUrl: "app.component.html",
})
export class AppComponent {
@ViewChild("MapView") mapView: ElementRef;
constructor(){
}
//Map events
onMapReady = (event) => {
console.log("Map Ready");
var map =event.object;
var marker = new mapsModule.Marker();
marker.position = mapsModule.Position.positionFromLatLng(48.87, 2.35);
marker.title = "Sydney";
marker.snippet = "Australia";
marker.userData = { index : 1};
map.addMarker(marker);
};
}发布于 2016-08-11 20:23:20
是否有可能像图片那样显示真实的交通状况?
time.png
https://stackoverflow.com/questions/38644811
复制相似问题