英文:
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="full" id="map">
</div>
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: '**your key from google maps[please note this is billable based on user requests]',
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}
});
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论