Implementation of Baidu map ABCD marker based on Arcgis for javascript, arcgismarker
First, we will show you the effect after implementation:
For the sake of intuition, first paste out the effect I have made
List display and Map Display and linkage
Display Information
Implementation ideas:
1. Interaction between lists and maps
When the cursor goes through the list, modify the list icon, and draw a blue marker based on the value returned by the list. move the cursor out, change the list icon to red, and clear the map marker layer.
Key code:
title.on("mouseover",function(){ var attr = $(this).data("attr"); $("#icon"+attr.id).css("background","url('images/blue.png')"); var pt=new Point(attr.x,attr.y,{"wkid":4326}); var pms = new esri.symbol.PictureMarkerSymbol("images/blue.png",24,26) var gImg = new Graphic(pt,pms); gLyrHover.add(gImg); }); title.on("mouseout",function(){ var attr = $(this).data("attr"); $("#icon"+attr.id).css("background","url('images/red.png')"); gLyrHover.clear(); });
2. Interaction between maps and lists
When you move the cursor over the red marker of the map, modify the corresponding list icon, and change the picture of the red marker to blue. move the cursor out, modify the corresponding list icon, and change the marker to red.
Key code:
gLyr.on("mouse-over",function(e){ map.setMapCursor("pointer"); var sms = e.graphic.symbol; sms.url = "images/blue.png"; gLyr.redraw(); $("#icon"+e.graphic.attributes.id).css("background","url('images/blue.png')"); }); gLyr.on("mouse-out",function(e){ map.setMapCursor("default"); var sms = e.graphic.symbol; sms.url = "images/red.png"; gLyr.redraw(); $("#icon"+e.graphic.attributes.id).css("background","url('images/red.png')"); });
3. The ABCD text on the map is a separate layer and does not participate in interaction.
4. data exists in JSON format.
Var data = [{"id": "A", "name": "Lhasa", "x": 91.162998, "y": 29.71042, "desc ": "Lhasa is the capital of the Tibet Autonomous Region of China. It is the political, economic, cultural, and religious center of Tibet and a holy land for Tibetan Buddhism. "},{" Id ":" B "," name ":" Xining "," x ": 101.797303," y ": 36.593642," desc ": "Xining is the provincial capital of Qinghai province. It is often referred to as xiping-gun or qingtang city. It is the largest city on the Qinghai-Tibet Plateau in China. "},{" Id ":" C "," name ":" Lanzhou "," x ": 103.584297," y ": 36.119086," desc ":" Lanzhou, the provincial capital of Gansu Province, an important industrial base and comprehensive transportation hub in the northwest region, one of the important central cities in the western region, and an important node city in the Silk Road Economic Belt. "},{" Id ":" D "," name ":" Chengdu "," x ": 104.035508," y ": 30.714179," desc ":" Chengdu, rong, the capital of Sichuan Province, was identified by the State Council as a technology, commerce, financial center and transportation and communication hub in Southwest China in 1993. "}];
Complete code:
<! DOCTYPE html>
The above content is the effect of Baidu map ABCD marker based on Arcgis for javascript shared by the Helper house.