我想在我的地图中更新一些弹出窗口,但我无法做到这一点.
首先,我创建了一些标记,然后使用下一个代码创建一个与它们关联的弹出窗口.每个标记一个弹出窗口:
popFeature = new OpenLayers.Feature(markers, location);
popFeature.closeBox = true;
popFeature.popupClass = OpenLayers.Class(OpenLayers.Popup.FramedCloud, {
'autoSize': true
});
popFeature.data.popupContentHTML = "hello";
popFeature.data.overflow = (false) ? "auto" : "hidden";
var markerClick = function (evt) {
if (this.popup == null) {
this.popup = this.createPopup(this.closeBox);
map.addPopup(this.popup);
this.popup.show();
} else {
this.popup.toggle();
}
currentPopup = this.popup;
OpenLayers.Event.stop(evt);
};
mark.events.register("mousedown", popFeature, markerClick);
Run Code Online (Sandbox Code Playgroud)
之后,我将新标记添加到我的标记图层.
一切都很好,直到这里,但是,我想稍后更新popupcontentHTML,我不知道如何访问该值.
我读了OL API,但我不明白如何得到它.我迷失了功能,事件,扩展......
我想知道我是否可以访问该属性并写下其他单词.
我正在寻找创建一个在单击标记的信息框/片段时运行的方法.到目前为止,我找不到任何关于此的信息,只有标记.任何帮助或链接,我可以找到更多信息?
在一个自定义事件中,我需要我Marker更新它的drawable 6次(基本上,我希望Marker在每次增长和每次收缩之间延迟0.5秒增长和缩小3次),因此它会通知用户所述事件.
有没有办法实现这一点,而不必实际删除Marker并再次添加不同的Drawable?
我正在使用MapsForge最新分支(master),我想实现Marker的onTap事件.我认为它可能在0.3.0,但我不能使用0.3.0,因为我在地图上为每个标记使用不同的Drawable.
ArrayList<Monument> monuments = getMonuments();
mListOverlay = new ListOverlay();
ArrayList<OverlayItem> markers = new ArrayList<OverlayItem>();
for(Monument m : monuments){
GeoPoint gp = new GeoPoint(m.getLat(), m.getLon());
Marker m = createCustomMarker(R.drawable.marker, gp, p.getNumber()));
markers.add(m);
}
mListOverlay.getOverlayItems().addAll(markers);
mMapView.getOverlays().add(mListOverlay);
Run Code Online (Sandbox Code Playgroud)
"createCustomMarker"返回一个标记,该标记使用带有数字的Drawable.
任何人都知道如何轻敲"m"的行为?
记住:分公司高手!不是0.3.0 !!
谢谢
当我在我的应用中初始化谷歌地图时,我会这样做:
var myOptions = {
center: new google.maps.LatLng(39.729001, -94.902342),
zoom: 3,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map"), myOptions);
setUpMarker(map);
Run Code Online (Sandbox Code Playgroud)
然而,哪个有效,我需要设置地图的中心并缩放由该功能创建的特定标记setUpMarker.
我已经尝试在setUpMarker函数内执行此操作:
fromMarker = new google.maps.Marker({
center: fromLatlng,
zoom: 5,
map: map,
title: "Here"
});
Run Code Online (Sandbox Code Playgroud)
但它没有帮助.那么,如何实现这种效果呢?
谢谢你们的帮助.
嗨男人和女孩,如果有的话:))
这段代码创建了一个空指针异常
我想在MO中添加几个标记
LAT = Double.parseDouble(PartA); LNG = Double.parseDouble(PartB);
LatLng Standort = new LatLng(LAT, LNG);
MO[y] = mMap.addMarker(new MarkerOptions()
.position(Standort)
.icon(BitmapDescriptorFactory.fromResource(R.drawable.kreis)));
builder.include(MO[y].getPosition());
Run Code Online (Sandbox Code Playgroud)
预期的数组类型 - 找到com.google.android.gms.maps.model.maker
定义private static Marker MOrt = null;
谷歌地图,点击外部链接目标标记.在下面找到小提琴演示.
google.maps.event.addListener(marker, 'click', (function(marker, i) {
return function() {
infowindow.setContent(locations[i][0]);
infowindow.open(map, marker);
map.setZoom(9);
map.setCenter(marker.getPosition());
}
})(marker, i));
function triggerClick(i) {
google.maps.event.trigger(markers[i],'click');
}
<ul class="nav">
<li><a href="javascript:triggerClick(0)">location1</a></li>
<li><a href="javascript:triggerClick(1)">location2</a></li>
<li><a href="javascript:triggerClick(2)">location3</a></li>
<li><a href="javascript:triggerClick(3)">location4</a></li>
</ul>
Run Code Online (Sandbox Code Playgroud) 我试图在静态图像上显示一些标记即
给定一个以英尺为单位的静态图像和脚部中的一组点,如何使用openlayers3在静态图像上标记一些图像或标记
据我所知,我们在openlayer3中有一个规定,即使用静态图像作为地图的基础层
我没有得到如何在静态图像(基础层)上显示标记给定图像上的某些图
任何帮助都会更加谢谢你请建议一场战争
我将静态图像显示为地图,如下所示
<!DOCTYPE html>
<html>
<head>
<title>Static image example</title>
<script src="https://code.jquery.com/jquery-1.11.2.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ol3/3.6.0/ol.css" type="text/css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/ol3/3.6.0/ol.js"></script>
</head>
<body>
<div class="container-fluid">
<div class="row-fluid">
<div class="span12">
<div id="map" class="map"></div>
</div>
</div>
</div>
<script>
// Map views always need a projection. Here we just want to map image
// coordinates directly to map coordinates, so we create a projection that uses
// the image extent in pixels.
var extent = [0, 0, 1024, …Run Code Online (Sandbox Code Playgroud) 基本上我正在使用mapview在我的应用程序中显示地图。意味着不像大多数地图应用程序那样使用片段。但是我面临在地图上添加标记的问题。请帮我。
这是我的编码
private static final int GPS_ERROR_DIALOG_REQUEST = 9001;
MapView mMapView;
GoogleMap map;
Context CTX = this;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (servicesOK()) {
setContentView(R.layout.parents);
mMapView = (MapView) findViewById(R.id.map);
mMapView.onCreate(savedInstanceState);
Toast.makeText(this, "Ready to map!", Toast.LENGTH_SHORT).show();
map.addMarker(new MarkerOptions()
.position(new LatLng( 4.588946, 101.125293))
.title("You are here"));
}
else
{
Toast.makeText(this, "Not ready to map!", Toast.LENGTH_SHORT).show();
}
Button AddUser = (Button) findViewById(R.id.user_reg);
Button KidsDelete = (Button) findViewById(R.id.user_del);
AddUser.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(Parents.this, AddUser.class));
} …Run Code Online (Sandbox Code Playgroud) 我可以用图片替换谷歌地图标记:
我使用以下方法在地图上动态加载用户头像:
var icon = {
// i get images url dynamically with html5 data attributes
url: $marker.attr('data-icon'), // url
scaledSize: new google.maps.Size(50, 50), // scaled size
origin: new google.maps.Point(0, 0), // origin
anchor: new google.maps.Point(0, 0) // anchor
};
Run Code Online (Sandbox Code Playgroud)
结果如下:
现在,它正在工作,但图形结果不是我想要的.我想有类似的东西(我没有设计这个例子,但你可以看到这个想法):
我在考虑3种可能的解决方案:
1-在图像后面创建一个多边形,以创建边框和一种箭头.
2)加载2张图像:头像图像和自定义图钉的图像后面(不确定是否可以为标记加载2张图像)
3)添加为标记定制CSS的可能性,就像在这个问题的答案中一样:
JS Maps v3:带有用户个人资料图片 演示的自定义标记:http://jsfiddle.net/mfirdaus/DVKEj/
实现这一目标的最佳方法是什么?
javascript google-maps google-maps-api-3 marker google-maps-markers
marker ×10
android ×5
google-maps ×5
javascript ×2
jquery ×2
click ×1
drawable ×1
events ×1
geolocation ×1
html ×1
image ×1
maps ×1
mapsforge ×1
openlayers ×1
openlayers-3 ×1
popup ×1