怎么显示百度地图清除marker上所有的marker

百度地图中点击一个已经存在的marker,怎么获取这个marker的坐标_百度地图api吧_百度贴吧
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&签到排名:今日本吧第个签到,本吧因你更精彩,明天继续来努力!
本吧签到人数:0成为超级会员,使用一键签到本月漏签0次!成为超级会员,赠送8张补签卡连续签到:天&&累计签到:天超级会员单次开通12个月以上,赠送连续签到卡3张
关注:5,800贴子:
百度地图中点击一个已经存在的marker,怎么获取这个marker的坐标收藏
百度地图中点击一个已经存在的marker,怎么获取这个marker的坐标,下面代码实现不了 marker.addEventListener("click", function () {
var marketpoint = marker.getPosition();
//获取一个点
var name = marketpoint.
var name1 = marketpoint.
}); 求各位大侠帮助啊帮助啊!
江苏盘锦天燃气模温机,一台省得让你怀疑人生的燃气锅炉
求各位大侠啊,我在线等啊,拜托了
各位帮帮忙吧着急的要呀各位亲们,
e.point.lnge.point.lat
var marketpoint =marker.getPosition();这句改成 var marketpoint =this.getPosition();试试
6楼正解。。谢谢了
getPosition()是一个对象,打印这个还是要用经纬度拼出坐标。getPosition().lng,getPosition().
marker.addEventListener(&click&, function(e) {var p = e.target.getPosition();console.log(p.lng + ',' + p.lat);});
登录百度帐号推荐应用温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!&&|&&
LOFTER精选
网易考拉推荐
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
阅读(2669)|
用微信&&“扫一扫”
将文章分享到朋友圈。
用易信&&“扫一扫”
将文章分享到朋友圈。
历史上的今天
loftPermalink:'',
id:'fks_',
blogTitle:'百度地图API的标注(Marker)的使用方法和一些实现细节',
blogAbstract:'本文将向大家介绍百度地图API的标注(Marker)的使用方法和一些实现细节。标注概述',
blogTag:'',
blogUrl:'blog/static/',
isPublished:1,
istop:false,
modifyTime:0,
publishTime:5,
permalink:'blog/static/',
commentCount:0,
mainCommentCount:0,
recommendCount:0,
bsrk:-100,
publisherId:0,
recomBlogHome:false,
currentRecomBlog:false,
attachmentsFileIds:[],
groupInfo:{},
friendstatus:'none',
followstatus:'unFollow',
pubSucc:'',
visitorProvince:'',
visitorCity:'',
visitorNewUser:false,
postAddInfo:{},
mset:'000',
remindgoodnightblog:false,
isBlackVisitor:false,
isShowYodaoAd:false,
hostIntro:'',
hmcon:'1',
selfRecomBlogCount:'0',
lofter_single:''
{list a as x}
{if x.moveFrom=='wap'}
{elseif x.moveFrom=='iphone'}
{elseif x.moveFrom=='android'}
{elseif x.moveFrom=='mobile'}
${a.selfIntro|escape}{if great260}${suplement}{/if}
{list a as x}
推荐过这篇日志的人:
{list a as x}
{if !!b&&b.length>0}
他们还推荐了:
{list b as y}
转载记录:
{list d as x}
{list a as x}
{list a as x}
{list a as x}
{list a as x}
{if x_index>4}{break}{/if}
${fn2(x.publishTime,'yyyy-MM-dd HH:mm:ss')}
{list a as x}
{if !!(blogDetail.preBlogPermalink)}
{if !!(blogDetail.nextBlogPermalink)}
{list a as x}
{if defined('newslist')&&newslist.length>0}
{list newslist as x}
{if x_index>7}{break}{/if}
{list a as x}
{var first_option =}
{list x.voteDetailList as voteToOption}
{if voteToOption==1}
{if first_option==false},{/if}&&“${b[voteToOption_index]}”&&
{if (x.role!="-1") },“我是${c[x.role]}”&&{/if}
&&&&&&&&${fn1(x.voteTime)}
{if x.userName==''}{/if}
网易公司版权所有&&
{list x.l as y}
{if defined('wl')}
{list wl as x}{/list}百度地图的覆盖物点击显示提示框信息在百度地图中,搜索功能需要注意的块。搜索到的详情需要在这里处理,如果这里传递参数,然后,在覆盖物监听事件里边取得参数需要这样放&
OnGetPoiSearchResultListener poiListener = new OnGetPoiSearchResultListener(){
public void onGetPoiResult(PoiResult result){
//获取POI检索结果
if(result==null||result.error!= SearchResult.ERRORNO.NO_ERROR){
for(final PoiInfo poi: result.getAllPoi()){
System.out.println(poi.name + &--& + poi.location + &--& + poi.address);
// 位置取出来坐标
latLng = poi.
//得到图片
BitmapDescriptor bitmap = BitmapDescriptorFactory
.fromResource(R.drawable.icon_mark4);
// 图标覆盖物的坐标图片和所在层数关联
overlayOptions = new MarkerOptions().position(latLng)
.icon(bitmap).zIndex(5);
//这个不清楚,=
号后边半句是添加覆盖物,给marker赋值就不清楚了
marker = (Marker) (mBaiduMap.addOverlay(overlayOptions));
//这里开始传递参数,需要用到bundle
Bundle bundle=new Bundle();
//这是一个实体类的实例化
bean b=new bean();
//这是把name设置到实体类里边,下边用到name,所以把它传过去
b.setName(poi.name);
//用bundle的putserializable方法把整个实体类传过去
bundle.putSerializable(&info&,b);
//用marker传递的
marker.setExtraInfo(bundle);
// 将地图移到到最后一个经纬度位置
MapStatusUpdate u = MapStatusUpdateFactory.newLatLng(latLng);
mBaiduMap.setMapStatus(u);
public void onGetPoiDetailResult(PoiDetailResult result){
//获取Place详情页检索结果
public void onGetPoiIndoorResult(PoiIndoorResult poiIndoorResult) {
//设置搜索功能的监听
mPoiSearch.setOnGetPoiSearchResultListener(poiListener);
这是一个按钮的事件,就是搜索用的事件
search.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
//搜索在城市中的
/* mPoiSearch.searchInCity((new PoiCitySearchOption())
.city(&北京&)
.keyword(&美食&)
.pageNum(10));*/
//搜索左边附近的
//添加一个左边
&1&图片坐标
LatLng pt1 = new LatLng(39.97428);
addOverLay(pt1, R.drawable.icon_mark1);
mPoiSearch.searchNearby((new PoiNearbySearchOption())
.location(pt1)
.keyword(&美食&)
.radius(1000)
.pageNum(10));
* 添加标记在地图中
* @param point
public void addOverLay(LatLng point,int pic) {
//定义Maker坐标点
LatLng point = new LatLng(39.6.400244);
//构建Marker图标
BitmapDescriptor bitmap = BitmapDescriptorFactory
.fromResource(pic);
//构建MarkerOption,用于在地图上添加Marker
OverlayOptions option = new MarkerOptions()
.position(point)
.icon(bitmap).zIndex(4);
//在地图上添加Marker,并显示
marker=(Marker) mBaiduMap.addOverlay(option);
/*这里这样写,为了让&1&图片也可以点击,如果这里不把&1&图片的信息存到里边,点击&1&图片会报错,空指针错误*/
//Bundle用于通信
Bundle bundle = new Bundle();
bean b=new bean();
b.setName(&dddd&);
b.setLatLng(new LatLng(39.97428));
bundle.putSerializable(&info&, b);
marker.setExtraInfo(bundle);//将bundle值传入marker中,给baiduMap设置监听时可以得到它
//给覆盖物添加点击事件,显示所表示的信息
mBaiduMap.setOnMarkerClickListener(new BaiduMap.OnMarkerClickListener() {
public boolean onMarkerClick(Marker marker) {
InfoWindow mInfoW
//得到上边传过来的实体类的信息
bean b= (bean) marker.getExtraInfo().get(&info&);
//生成一个TextView用户在地图中显示InfoWindow
TextView location = new TextView(getApplicationContext());
location.setBackgroundResource(R.drawable.icon_mark3);
location.setPadding(30, 20, 30, 50);
//去除设置实体类里边name的信息
location.setText(b.getName());
//将marker所在的经纬度的信息转化成屏幕上的坐标
final LatLng ll = marker.getPosition();
Point p = mBaiduMap.getProjection().toScreenLocation(ll);
p.y -= 47;
LatLng llInfo = mBaiduMap.getProjection().fromScreenLocation(p);
//为弹出的InfoWindow添加点击事件,0的位置本事看到别人写的是事件的但是我不知道为什么我不能写,只能写数字,数字随便写的没什么作用
mInfoWindow = new InfoWindow(location, llInfo, 0);
//显示InfoWindow
mBaiduMap.showInfoWindow(mInfoWindow);
package com.example.ui_1.
import java.io.S
public class bean implements Serializable{
public String getName() {
public void setName(String name) {
this.name =
}putSerializable和 getSerializable的使用()&分享到:最近浏览暂无贡献等级暂无贡献等级暂无贡献等级暂无贡献等级暂无贡献等级暂无贡献等级暂无贡献等级暂无贡献等级暂无贡献等级暂无贡献等级暂无贡献等级暂无贡献等级暂无贡献等级暂无贡献等级暂无贡献等级暂无贡献等级暂无贡献等级暂无贡献等级扫描二维码关注最代码为好友"/>扫描二维码关注最代码为好友

我要回帖

更多关于 清除所有marker 的文章

 

随机推荐