简体   繁体   English

使用spring java在网络浏览器中显示谷歌地图上的点

[英]Display points on google maps in web browser using spring java

我在数组中设置了一组经度和纬度,我想使用谷歌 API、spring 和 java 在网络浏览器中的谷歌地图上显示它们

as far as my knowledge, spring is a backend RESTful web service, and I think what you want to do is to dynamically build the javascript that display multiple markers on the Google Maps.据我所知,spring 是一个后端 RESTful Web 服务,我认为您想要做的是动态构建在 Google 地图上显示多个标记的 javascript。

You can look at this example , or the javascript market documentation for more information.您可以查看此示例javascript 市场文档以获取更多信息。

I would suggest you to first convert the array into a JSON array, that would be easy for your Java/Spring code to parse and then finally display on the Google Maps using the Maps Library.我建议您首先将数组转换为 JSON 数组,这样您的 Java/Spring 代码将很容易解析,然后最终使用 Maps Library 显示在 Google 地图上。

To convert array into JSON:将数组转换为 JSON:

String mStringArray[] = { "String1", "String2" };

JSONArray mJSONArray = new JSONArray(Arrays.asList(mStringArray));

To display the latitude/longitude that are now in JSON on Google Maps follow this tutorial .要在 Google 地图上显示现在以 JSON 格式显示的纬度/经度,请遵循本教程

Hope this Helps!!希望这可以帮助!!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM