简体   繁体   English

如何在新的 Angular GMaps 组件上可视化 GeoJson?

[英]How to visualize GeoJson on new Angular GMaps component?

I am building an Angular Web Application using the Angular GMaps component:我正在使用 Angular GMaps 组件构建 Angular Web 应用程序:

<div id="map-container">
    <google-map (mapClick)="mapClicked($event)">
      <map-marker [position]="markerPosition" [options]="markerOptions"></map-marker>
    </google-map>
</div>

Now I want to visualize multiple geoJson strings on that map.现在我想在 map 上可视化多个 geoJson 字符串。
I have seen different implementations where they have a <data-layer [geoJson]=...> component.我见过不同的实现,它们有一个 <data-layer [geoJson]=...> 组件。
Is there anything similiar in the GMaps component? GMaps 组件中是否有类似的东西?

@ViewChild(GoogleMap, { static: false }) map!: GoogleMap

did the trick!成功了!

this.map.data.loadGeoJson(geoJson);

now loads GeoJson on the map properly.现在在 map 上正确加载 GeoJson。

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

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