[英]Dynamically update google maps with received longitudes and latitudes
I've written a java applet which sends longitudes and latitudes trough POST requests. 我编写了一个Java小程序,它通过POST请求发送经度和纬度。 I need to write a server page which will receive this data and dynamically shows a google map with the received points on it.
我需要编写一个服务器页面,它将接收此数据并动态显示带有接收点的google map。 (php/etc...)
(PHP /等...)
I don't know how to start with this, because I really don't know what to do first. 我不知道如何开始,因为我真的不知道首先要做什么。
https://developers.google.com/maps/documentation/imageapis/ has all the information you need. https://developers.google.com/maps/documentation/imageapis/包含您需要的所有信息。
So you simply need to get a server page to recieve your POST data, parse the longitude and latitude and then get the image result from the URL below (look inside the src attribute). 因此,您只需要获取一个服务器页面来接收POST数据,解析经度和纬度,然后从下面的URL获取图像结果(请查看src属性内部)。
Should be fairly obvious what all the parameters are, zoom level on google maps and the size of the map in pixels. 应该很明显地看出所有参数是什么,谷歌地图的缩放级别以及以像素为单位的地图大小。 Alternatively if you just want this map displaying on a webbrowser you just output the
img
tag shown below 另外,如果您只想将此地图显示在网络浏览器上,则只需输出如下所示的
img
标签
<img src="http://maps.googleapis.com/maps/api/staticmap?center=-15.800513,-47.91378&zoom=11&size=200x200&sensor=false">
EDIT: The URL will dynamically generate the map each time you send a POST request. 编辑:每次您发送POST请求时,URL都会动态生成地图。 If you need the data to continuously change then maybe using POST requests isnt the best way to do it.
如果您需要数据不断变化,那么使用POST请求并不是最好的方法。 POST is best used for data which you want to send off to a server then do something with (generate a single map etc).
POST最适合用于要发送到服务器然后进行处理(生成单个地图等)的数据。
As an example... The user wants a map of where a particular street is that they have clicked on > Send POST request > Get the map using the Google Maps URL and send this back/output to a webpage. 举例来说...用户想要一张他们单击的特定街道的地图>发送POST请求>使用Google Maps URL获取地图,然后将此信息发送回/输出到网页。
As an alternative you might want to look at the various Maps APIs on the site. 另外,您可能希望查看网站上的各种Maps API。 A better link for this would be https://developers.google.com/maps/
一个更好的链接是https://developers.google.com/maps/
It's not quite clear what you are aiming to do so providing an example usage would help with a better answer. 尚不清楚您打算做什么,因此提供示例用法将有助于获得更好的答案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.