duancai9010 2017-04-14 03:50
浏览 77
已采纳

使用图像作为谷歌地图并给它坐标

Is there is a way in JavaScript to add offline map to a PHP/HTML page, in such a way that I am just using a JPEG image (of a map) and giving its bounds coordinates (longitude and latitude), and then somehow using those coordinates that I have set for the image (the map) to pinpoint something on it?

For Example:

  • I have an image that is 400px wide and 300px long.
  • At 1px long the latitude is 44.2353, and at 300px its 49.2539.
  • Something similar with longitude.
  • And then, code does the following:

    SetMarkerPosition(latitude, longtitude);

A marker appears on the map at the specified coordinates.

  • 写回答

1条回答 默认 最新

  • doomm4711 2017-04-14 03:56
    关注

    Yes, Google caters to this with the Google Static Maps API. You just include an img tag on your HTML page, with the source set to a URL like the following:

    <img src="https://maps.googleapis.com/maps/api/staticmap?center=Brooklyn+Bridge,New+York,NY&zoom=13&size=600x300&maptype=roadmap&markers=color:blue%7Clabel:S%7C40.702147,-74.015794&markers=color:green%7Clabel:G%7C40.711614,-74.012318&markers=color:red%7Clabel:C%7C40.718217,-73.998284">

    But with a &key=YOUR_API_KEYat the end of the src URL of the image also.

    The API documentation describes how to build the URL, what parameters you can put in it, etc.

    </div>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)