获取 Google 地图标记的坐标

发布于 2024-08-24 22:55:49 字数 675 浏览 2 评论 0原文

我正在创建一个数据库,其中包含我所在地区所有公交车站的名称和坐标。我已将所有名称存储在数据库中,现在我需要添加坐标。我正在尝试获取一个网站,其中包含所有这些内容作为谷歌地图上的地标。在我看来,它们是从本地服务器生成的,然后添加到地图中。但是我无法准确找到在哪里查询服务器的坐标。

我希望通过使用屏幕刮刀来收集这些坐标。但是,除非我能够在源代码中找到创建坐标的位置,否则这似乎是不可能的。我当然可以手动搜索和收集所有这些地标,但这将非常耗时。所以我希望这里有人能帮助我。

这是我正在尝试抓取的网站。地标由蓝色巴士标志标记:

http:// /reiseplanlegger.skyss.no/scripts/travelmagic/TravelMagicWE.dll/?from=Brimnes+ferjekai+%28Eidfjord%29&to=

您还可以通过在搜索字段中输入停靠点名称来获取单个地标的坐标并按下“Vis i kart”按钮。

我希望有人能帮助我解决这个问题。

I am creating a databse containing the names and coordinates of all bus stops in my local area. I have all the names stored in my database, and now I need to add the coordinates. I am trying to get these of a website that contains them all as placemarks on a Google Map. It seems to me like they are being generated from a local server, and then added to the map. However I am unable to find exactly where the server is queried for the coordinates.

I am hoping to collect these coordinates through the use of a screen scraper. However unless I am able to find where in the source code the coordinates are created this seems to be impossible. I can of course search and collect all these placemarks manually, but that will be very time consuming. So I am hoping that someone in here can help me.

This is the website I am trying to scrape. The placemarks are marked by the blue bus sign:

http://reiseplanlegger.skyss.no/scripts/travelmagic/TravelMagicWE.dll/?from=Brimnes+ferjekai+%28Eidfjord%29&to=

You can also get the coordinates of a single placemark by writing the name of the stop in the search field and pushing the "Vis i kart" button.

I hope someone can help me with this.

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

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

发布评论

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

评论(2

终遇你 2024-08-31 22:55:49

在检查 Firebug 时,您提到的站点似乎正在通过简单的 AJAX 请求获取 XML 格式的数据,例如:

http://reiseplanlegger.skyss.no/scripts/travelmagic/TravelMagicWE.dll/mapxml?x1=4.85321044921875&x2=5.8282470703125&y1=60.150391714056326&y2=6 0.524184817591276&loc =1

(x1, y1), (x2, y2) 参数定义视口的(经度, 纬度) 参数。每次拖动地图时,都会发出一个新的 AJAX 请求,该请求会返回新的数据。

这是来自 AJAX 请求的示例响应:

<stages>
  <i n="Arna Stasjon Togstopp (Bergen)" sn="" v="12019888" t="2" i="0" x="5,465809" y="60,420116" sp="" st="Tog.GIF"/>
  <i n="Arna Terminal (Bergen)" sn="" v="12014200" t="2" i="0" x="5,464333" y="60,420319" sp="" st="Buss.GIF"/>
  <i n="Bjørkheim Ved Senter (Samnanger)" sn="" v="12426607" t="2" i="0" x="5,730484" y="60,402178" sp="" st="Buss.GIF"/>
  <i n="Bjørkheim Ved Senter (Samnanger)" sn="" v="12426608" t="2" i="0" x="5,731842" y="60,401312" sp="" st="Buss.GIF"/>
  <i n="Breistein Ferjekai (Bergen)" sn="" v="12017399" t="2" i="0" x="5,399175" y="60,490519" sp="" st="Ferge.GIF"/>
  <i n="Eikelandsosen Terminal (Fusa)" sn="" v="12410510" t="2" i="0" x="5,747773" y="60,241479" sp="" st="Buss.GIF"/>
</stages>

请注意,x 属性定义经度,而 y 属性定义纬度。


除了技术答案之外,我建议在抓取此类数据之前寻求许可。

On checking with Firebug, it appears that the site you mentioned is getting the data in XML format with simple AJAX requests such as:

http://reiseplanlegger.skyss.no/scripts/travelmagic/TravelMagicWE.dll/mapxml?x1=4.85321044921875&x2=5.8282470703125&y1=60.150391714056326&y2=60.524184817591276&loc=1

The (x1, y1), (x2, y2) parameters define the (longitude, latitude) parameters of the viewport. Everytime the map is dragged, a new AJAX request is issued, which returns fresh data.

This is a sample response from the AJAX request:

<stages>
  <i n="Arna Stasjon Togstopp (Bergen)" sn="" v="12019888" t="2" i="0" x="5,465809" y="60,420116" sp="" st="Tog.GIF"/>
  <i n="Arna Terminal (Bergen)" sn="" v="12014200" t="2" i="0" x="5,464333" y="60,420319" sp="" st="Buss.GIF"/>
  <i n="Bjørkheim Ved Senter (Samnanger)" sn="" v="12426607" t="2" i="0" x="5,730484" y="60,402178" sp="" st="Buss.GIF"/>
  <i n="Bjørkheim Ved Senter (Samnanger)" sn="" v="12426608" t="2" i="0" x="5,731842" y="60,401312" sp="" st="Buss.GIF"/>
  <i n="Breistein Ferjekai (Bergen)" sn="" v="12017399" t="2" i="0" x="5,399175" y="60,490519" sp="" st="Ferge.GIF"/>
  <i n="Eikelandsosen Terminal (Fusa)" sn="" v="12410510" t="2" i="0" x="5,747773" y="60,241479" sp="" st="Buss.GIF"/>
</stages>

Note that the x attribute is defining the longitude, while the y attribute is defining the latitude.


Apart from the technical answer, I would suggest seeking permission before scraping such data.

微暖i 2024-08-31 22:55:49

检查此页面的源代码。谷歌地图显示为空白。然后通过代码添加标记。最有可能的坐标是在页面或引用的 JS 中硬编码的。或者可能是通过 Ajax 进行页面请求。同样,您将在源代码中看到它。

examine the source codes of this page. Google map comes blank from google. Then markers are added by code. Most probably coordinates are hardcoded in page or referenced JS. Or may be page requests them via Ajax. Again, you will see it in source code.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文