GMapModule 在 Primeng 文档中缺失

huangapple go评论72阅读模式
英文:

GMapModule missing from Primeng documentation

问题

I noticed that the GMapModule doesn't appear in the Primeng documentation, even though I'm able to use it successfully in my Angular app. I'm wondering if this module has been deprecated or if there's a reason it's not included in the documentation.

If GMapModule is still supported, can someone point me in the direction of any resources or documentation that can help me understand how to work with it?

Here's the import statement I'm using to use the GMapModule in my app:

import { GMapModule } from 'primeng/gmap';

I'm using Angular version 15.2.4 and Primeng version 15.2.0,

Additionally, I found an example of using the GMap component in Primeng on geeksforgeeks, but I'm still unsure why this component isn't documented in the official Primeng documentation.

As a result, I'm not confident in my understanding of how to work with the GMapModule and would appreciate any help or guidance others can provide.

Thank you in advance for any help you can provide!

Best,
Reisy

英文:

I noticed that the GMapModule doesn't appear in the Primeng documentation, even though I'm able to use it successfully in my Angular app. I'm wondering if this module has been deprecated or if there's a reason it's not included in the documentation.

If GMapModule is still supported, can someone point me in the direction of any resources or documentation that can help me understand how to work with it?

Here's the import statement I'm using to use the GMapModule in my app:

import { GMapModule } from 'primeng/gmap';

I'm using Angular version 15.2.4 and Primeng version 15.2.0,

Additionally, I found an example of using the GMap component in Primeng on geeksforgeeks, but I'm still unsure why this component isn't documented in the official Primeng documentation.

As a result, I'm not confident in my understanding of how to work with the GMapModule and would appreciate any help or guidance others can provide.

Thank you in advance for any help you can provide!

Best,
Reisy

答案1

得分: 1

我不认为这在下一个 beta 16.* 版本中包含在内。理想情况下,它是原始谷歌地图的包装器,不够灵活。建议使用原生谷歌地图库,以满足您的特定工作需求。我尝试了 primeng gmap p-gmap,然后转向其他库。您可以在官方谷歌地图文档 gmaps documentation 中找到更多参考资料。我觉得 googlemaps/js-api-loader 更加用户友好,可以添加标记、绘制折线,反映多航线路径。

如果您按照 googlemaps/js-api-loader 的步骤操作,请确保您的引用在 cshtml 文件中:

<div class="full" id="map"></div>

在 component.ts 文件中:

import { Loader } from '@googlemaps/js-api-loader';

export class SomeComponent implements OnInit {
  map: google.maps.Map;

  // 用从谷歌地图开发者 API 注册的 API 密钥加载谷歌地图

  const loader = new Loader({
    apiKey: '**从谷歌地图获取的密钥[请注意,这是基于用户请求计费的]**',
    version: "weekly",
    libraries: ["places"]
  });

  loader
    .load()
    .then((google) => {
      //this.initMap();
    });
}

const map = new google.maps.Map(document.getElementById("map"), {
  zoom: 17,
  center: { lat: 17.3850, lng: 78.4867 }
});
英文:

I dont see this included in the next beta 16.* version as well. Ideally it is a wrapper of original google maps and is not that flexible. Prefer to use native google maps libraries that would help to achieve your work specific needs. I tried primeng gmap p-gmap then focused to other libraries.
You could find more refernces at official google maps - gmaps documentation.
I find googlemaps/js-api-loader more user friendly to add markers, draw polylines, reflect multi flight paths

If you follow the steps from googlemaps/js-api-loader make sure your refer

In cshtml:

div class=&quot;full&quot; id=&quot;map&quot;&gt;

&lt;/div&gt;

In component.ts
import { Loader } from '@googlemaps/js-api-loader';

export class SomeComponent implements OnInit {
 map: google.maps.Map;

//Load the google maps with api key registered from google maps developer api registration

 var loader = new Loader({
      apiKey: &#39;**your key from google maps[please note this is billable based on user requests]&#39;,
      version: &quot;weekly&quot;,
      libraries: [&quot;places&quot;]
    });

    loader
      .load()
      .then((google) =&gt; {
        //this.initMap();
      });
  }

const map = new google.maps.Map(document.getElementById(&quot;map&quot;), {
        zoom: 17,
        center: { lat: 17.3850, lng: 78.4867}
      });

huangapple
  • 本文由 发表于 2023年5月10日 17:05:08
  • 转载请务必保留本文链接:https://go.coder-hub.com/76216654.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定