.net mvc 调用地图进行显示相同性质的所有地点进行定位然后显示出一图层标记出位置,其实就是对地图的某一图特定的图层进行进行查询里面的地点近行定位,然后进行标记显示出来。
例如:显示一个地方的医疗服务的所有门店图层,首先要找到医疗服务的这个图层进行操作。因为在地图显示时就已经引入地图的图层,现在就是对地图图层进行操作:
“P15医疗服务_point_1@gd#1”:地图对应的医疗服务图层
操作图层 :
function PoliceSubstationPoint() {
var queryParam, queryBySQLParams, queryBySQLService;
queryParam = new SuperMap.REST.FilterParameter({ name: "P15医疗服务_point_1@gd#1", attributeFilter: "TYPE=7200" });
queryBySQLParams = new SuperMap.REST.QueryBySQLParameters({
queryParams: [queryParam]
});
queryBySQLService = new SuperMap.REST.QueryBySQLService(url, {
eventListeners: { "processCompleted": Showlandmark, "processFailed": processFailed }
});
queryBySQLService.processAsync(queryBySQLParams);
}
显示地图地标:
function Showlandmark(obj)//在地图上显示站点地标
{
CloseLayerPointPopup();
var result = obj.result;
var feature, x, y, LocalMrker, type = 0, index = 0,
size = new SuperMap.Size(25, 20),
offset = new SuperMap.Pixel(-(size.w / 2), -size.h),
icon = new SuperMap.Icon("/SuperMap/theme/images/marker.png", size, offset);
if (result && result.recordsets) {
for (i = 0, recordsets = result.recordsets, len = recordsets.length; i < len; i++) {
if (recordsets[i].features) {
for (j = 0; j < recordsets[i].features.length; j++) {
feature = recordsets[i].features[j];
//中心点
x = feature.geometry.x;
y = feature.geometry.y;
type = parseInt(feature.attributes.TYPE);
index = 1;
size = new SuperMap.Size(15, 15);
icon = new SuperMap.Icon("/content/iamge/Logo.png", size, offset);
LocalMrker = new SuperMap.Marker(new SuperMap.LonLat(x, y), icon);
LocalMrker.id = index;
LocalMrker.typeID = type;
LocalMrker.NAME = feature.attributes.NAME;//名称
LocalMrker.ADDRESS = feature.attributes.ADDRESS;//地址
LocalMrker.TYPE = feature.attributes.TYPE;//类型
LocalMrker.SmID = feature.attributes.SmID;//序列ID
LocalMrker.IMPORTANCE = feature.attributes.IMPORTANCE;//重要性
LocalMrker.events.on({
"click": OpenZhanDianMessagepopupss1,
"touchstart": OpenZhanDianMessagepopupss1, //假如要在移动端的浏览器也实现点击弹框,则在注册touch类事件
"scope": LocalMrker
});
HospitalMap.addMarker(LocalMrker);
}
}
}
}
}
通过调用就可以得到地图下面的效果