在低缩放级别之前,Google 地图点不会显示

发布于 2024-10-05 18:19:16 字数 315 浏览 0 评论 0原文

我正在开发一个(Perl)程序,该程序使用 Google Maps API 和 KML 文件从数据库中提取数据,从而在地图上创建点。我已经完成了这么多,但只有在我几乎一直放大到仅显示一个点的缩放级别后,这些点才会出现。

默认缩放仅显示我的小城市(3-5 英里),因此我认为所有点都能够显示。有谁知道如何让所有点显示在全市范围内,而不是仅在放大时才显示?

非常感谢任何帮助。谢谢!

编辑:添加了一个 JavaScript 标签,因为我已经看到很多使用 JS 的 Google 地图工作,并且考虑到这个问题确实不是特定于语言的,我认为其中一些开发人员可能能够提供一些见解。

I'm working on a (Perl) program that uses the Google Maps API and a KML file to pull data from a database that creates points on the map. I have that much done, but the points only appear after I zoom pretty much all the way in, to a zoom level where only one point is showing.

The default zoom only shows my small city (3-5 miles) so I thought all the points would be able to show. Does anybody know how to get all of the points to show up at city-wide level as opposed to only showing up when zoomed all the way in?

Any help is greatly appreciated. Thanks!

Edit: Added a JavaScript tag because I've seen a lot of work done with Google Maps using JS, and considering the problem really isn't language-specific, I figured some of those developers might be able to offer some insight.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夜巴黎 2024-10-12 18:19:16

尝试合并 标记,它是 的子级。您可以为从数据库获取的每个地标定义一次。或每个查询仅一次(由 minLat、maxLat、minLong、maxLong 定义)。在第一种情况下,LodPixels 是一个常量,而在后一种情况下,您必须将其计算为区域大小的函数。它确实可以在 Google 地球中使用,并且在地图中也可以使用。请此处查看它在 Earth API (JS) 中的工作情况

....
<Region>
    <LatLonAltBox>
        <north>###</north>
        <south>###</south>
        <east>###</east>
        <west>###</west>
        <minAltitude>###</minAltitude>
        <maxAltitude>###</maxAltitude>
    </LatLonAltBox>
    <Lod>
        <minLodPixels>###</minLodPixels>
        <maxLodPixels>###</maxLodPixels>
        <minFadeExtent>###</minFadeExtent>
        <maxFadeExtent>###</maxFadeExtent>
    </Lod>
</Region>
....

Try to incorporate the <Lod> tag in your KML, which is child of a <Region>. You can define this once per placemark you get from your DB. or only once per query (defined by minLat, maxLat, minLong, maxLong). In the first case the LodPixels is a constant whereas in the latter case you must calculate it as a function of the region size. It sure works in Google Earth and may work as well in Maps. Look here to see it work in Earth API (JS)

....
<Region>
    <LatLonAltBox>
        <north>###</north>
        <south>###</south>
        <east>###</east>
        <west>###</west>
        <minAltitude>###</minAltitude>
        <maxAltitude>###</maxAltitude>
    </LatLonAltBox>
    <Lod>
        <minLodPixels>###</minLodPixels>
        <maxLodPixels>###</maxLodPixels>
        <minFadeExtent>###</minFadeExtent>
        <maxFadeExtent>###</maxFadeExtent>
    </Lod>
</Region>
....
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文