标签: google-maps-api-2

如何在同一地图上使用带有多个标记的Google Maps API

所以,我有以下脚本使用谷歌地图API,它一切都很好,但我需要创建一个有多个标记的地图(气球形图标指向某事),我需要每个标记指向地图的不同区域(即不同的坐标),我该怎么办?

<script type="text/javascript">

         function load() {

        var map = new GMap2(document.getElementById("map"));
        var marker = new GMarker(new GLatLng(<%=coordinates%>));

        var html="<img src='simplemap_logo.jpg' width='20' height='20'/> " +
             "<%=maptitle%><br/>" +
             "<%=text%>";



        map.setCenter(new GLatLng(<%=coordinates%>), <%=zoom%>)
        map.setMapType(G_HYBRID_MAP);
        map.addOverlay(marker);
        map.addControl(new GLargeMapControl());
        map.addControl(new GScaleControl());
        map.addControl(new GMapTypeControl());


        marker.openInfoWindowHtml(html);
        }

        //]]>
        </script>
Run Code Online (Sandbox Code Playgroud)

还有一个问题,如果我将脚本文本作为变量传递,可以说:

<script type="text/javascript">
<%=ScriptText%>
</script>
Run Code Online (Sandbox Code Playgroud)

我的<%= ScriptText%>将是一个字符串,我将构建并将其值分配给名为ScriptText的Friend或Public变量,它是否仍然运行并正常工作?(我这样做是为了使我的脚本动态和不同,基于我如何将它构建为STRING,因为我在javascripting中的文盲; P)

javascript asp.net google-maps google-maps-api-2

10
推荐指数
2
解决办法
4万
查看次数

谷歌地图API:标记图像定位

我更改了用于markerGoogle地图上的图像.新的图像比旧的更广泛的,我已经注意到,标记与对齐latlng使标志在于它是在水平中点latlng.这不是我想要的,我希望有latlng与左侧的标记对齐-我想,以抵消marker大约80px到右侧从默认位置.

javascript api offset google-maps-markers google-maps-api-2

10
推荐指数
2
解决办法
1万
查看次数

Google Maps API v3 - 未定义GIcon

我知道他们是从v2到v3的一些问题我能在这里做些什么来修复它?
v3不支持GIcon?

// Google-Map icon object
var gMapIcon = new GIcon(G_DEFAULT_ICON); //change to new google.maps.MarkerImage();???
// does icon exist
if ( mapElements[lMapElementIndex]['icon'].toString().length > 0) {
    gMapIcon.image = html_entity_decode(mapElements[lMapElementIndex]['icon']);
    gMapIcon.shadow = "";
    iconHeight = mapElements[lMapElementIndex]['iconheight'];
    iconWidth = mapElements[lMapElementIndex]['iconwidth'];
    gMapIcon.iconSize = new GSize(iconWidth,iconHeight);
    gMapIcon.iconAnchor = new GPoint(0,0);
    gMapIcon.infoWindowAnchor = new GPoint(15,10);
}
    var markerOptions = { 
        icon: gMapIcon //change to image? 
     };
    var marker = new google.maps.Marker(point,markerOptions);
Run Code Online (Sandbox Code Playgroud)

从这里找到https://developers.google.com/maps/documentation/javascript/overlays?hl=de-DE#SimpleIcons

感谢您的帮助或提示!

google-maps google-api google-maps-api-3 google-maps-markers google-maps-api-2

10
推荐指数
1
解决办法
2万
查看次数

Google Map Android API v2无法在Play商店应用中显示地图

我正在使用Google Map Android API v2Android应用程序.

它可以与其他设备上的unsigned apk一起使用.但是当我签署apk并将我的应用程序上传到Play商店时,下载的应用程序显示的是白色屏幕而不是地图.

android google-maps google-maps-api-2

10
推荐指数
2
解决办法
1万
查看次数

我可以在Android地图中更改我的位置按钮吗?

我们在谷歌地图中有一个我的位置图标
我的位置图标 我想用我想要的图标更改此图标按钮有没有办法在Google地图中替换此图标.我怎么能在Android中做到这一点.

由于该问题尚不清楚所以我正在添加其他信息.在https://support.google.com/maps/answer/3093609?hl=zh-CN中,您可以在根据您在第2点的位置获取路线的部分中看到图标已显示在此输入图像描述

" 修复您的位置 - >了解位置符号"下面的部分也解释了这些图标.

你可以看到它不是标记,它是我写的位置按钮所以我的问题是如何将该图标(位置按钮)更改为我想要的图标.

看到这个图标按钮也显示在谷歌地图图标图片中 在此输入图像描述

android google-maps google-maps-api-2 google-maps-android-api-2

10
推荐指数
1
解决办法
9600
查看次数

即使在为发布密钥更新SHA 1指纹后,Google地图也无法在Play商店上发布后加载

这里有一个新手谷歌地图api和Android应用程序开发.我正面临着一些奇怪的问题,并且在两天内就一直在努力.我开发了一个应用程序,其中我使用了谷歌地图.我已经推出了应用程序来玩商店.当我将已签名的apk直接安装到移动设备时,谷歌地图加载完全正常,但是当我通过Play商店安装时没有.

我已经使用发布密钥SHA 1指纹更新了谷歌地图api控制台.我也无法在线找到任何解决方案,也没有得到谷歌支持团队的任何支持.有人请帮忙!

android google-maps google-maps-api-2 google-play google-maps-android-api-2

10
推荐指数
1
解决办法
5805
查看次数

在Google地图上显示风向

我计算了风向,现在我想显示指向144度的风向(在罗盘上).如何在Google地图上显示此箭头?

javascript google-maps weather google-maps-api-2 compass-geolocation

9
推荐指数
1
解决办法
1万
查看次数

从谷歌静态地图中的像素坐标获取lon/lat

我有一个使用谷歌静态地图的JAVA项目,经过几个小时的工作,我无法工作,我会解释一切,我希望有人能够帮助我.

我使用静态地图(480像素x 480像素),地图的中心是lat = 47,lon = 1.5,缩放级别是5.

现在我需要的是当我点击这个静态地图上的一个像素时能够得到lat和lon.经过一些搜索,我发现我应该使用墨卡托投影(对吗?),我还发现每个缩放级别在水平和垂直尺寸上的精度都加倍,但我找不到合适的公式来链接像素,缩放级别和lat/LON ...

我的问题只是关于从像素获取lat/lon,知道中心的坐标和像素以及缩放级别......

先感谢您 !

java google-maps google-maps-api-2

9
推荐指数
1
解决办法
7367
查看次数

Google地图v2中的地图搜索栏

我想在顶部添加一个"搜索栏",Google Maps v2如我在谷歌播放中剪下的这张小图片所示.

谷歌地图吧..

我该怎么做呢?谢谢

android google-maps-api-2

9
推荐指数
1
解决办法
1万
查看次数

Google Maps Android API v2:借助ValueAnimator可视化搜索半径

我想在Google地图视图中添加一个动画圆圈,类似于您在此图片上看到的圆圈.

在此输入图像描述

圆圈应从中心脉动到最大半径,表示当前用户的位置和搜索区域.

这是相关的代码块

Circle circle = mMap.addCircle(new CircleOptions()
     .center(new LatLng(lat, lon))
     .strokeColor(Color.CYAN).radius(1000));
    valueAnimator = new ValueAnimator();
    valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
        float animatedFraction = valueAnimator.getAnimatedFraction();
         circle.setRadius(animatedFraction * 1000);
         circle.setStrokeWidth(1 + animatedFraction * 7);
         }
        });
Run Code Online (Sandbox Code Playgroud)

使用此代码,我只能看到没有任何动画的静态圆形笔划.

任何帮助将不胜感激.提前致谢.

android google-maps google-maps-api-2 android-animation

9
推荐指数
1
解决办法
5317
查看次数