<script>
require([
"esri/WebMap",
"esri/views/MapView",
"esri/config",
"dojo/dom",
"dojo/domReady!",
"esri/Graphic",
"esri/geometry/Point",
"esri/symbols/SimpleMarkerSymbol"
], function(WebMap, MapView,esriConfig, dom,Graphic, Point, SimpleMarkerSymbol) {
esriConfig.portalUrl="https://trail.arcgisonline.cn/portal";
var webmap = new WebMap({
portalItem: {
id: "41618940f8764***8f98e38bf0b97ab9"
}
});
var view = new MapView({
container: "viewDiv",
map: webmap
});
// Create a point
var point = new Point({
longitude: 111.173018,
latitude: 26.888248
});
var markerSymbol = new SimpleMarkerSymbol({
color: [226, 119, 40],
outline: {
color: [255, 255, 255],
width: 1
}
});
// Create attributes
var attributes = {
Name: "I am a point",
Park: "Griffith Park",
City: "Los Angeles"
};
// Create popup template
var popupTemplate = {
title: "{Name}",
content: "I live in <b>{Park}</b> in the city of <b>{City}</b>."
};
// Create a graphic and add the geometry and symbol to it
var pointGraphic = new Graphic({
geometry: point,
symbol: markerSymbol,
attributes: attributes,
popupTemplate: popupTemplate
});
4 个回复
atlas1563
赞同来自: Alisa 、fengye
lhx - 上路lu
赞同来自: Alisa
Alisa
赞同来自:
require([
"esri/WebMap",
"esri/views/MapView",
"esri/config",
"dojo/dom",
"dojo/domReady!",
"esri/Graphic",
"esri/geometry/Point",
"esri/symbols/SimpleMarkerSymbol"
], function(WebMap, MapView,esriConfig, dom,Graphic, Point, SimpleMarkerSymbol) {
esriConfig.portalUrl="https://trail.arcgisonline.cn/portal";
var webmap = new WebMap({
portalItem: {
id: "41618940f8764***8f98e38bf0b97ab9"
}
});
var view = new MapView({
container: "viewDiv",
map: webmap
});
// Create a point
var point = new Point({
longitude: 111.173018,
latitude: 26.888248
});
var markerSymbol = new SimpleMarkerSymbol({
color: [226, 119, 40],
outline: {
color: [255, 255, 255],
width: 1
}
});
// Create attributes
var attributes = {
Name: "I am a point",
Park: "Griffith Park",
City: "Los Angeles"
};
// Create popup template
var popupTemplate = {
title: "{Name}",
content: "I live in <b>{Park}</b> in the city of <b>{City}</b>."
};
// Create a graphic and add the geometry and symbol to it
var pointGraphic = new Graphic({
geometry: point,
symbol: markerSymbol,
attributes: attributes,
popupTemplate: popupTemplate
});
view.graphics.add(pointGraphic);
});
</script>
宋鑫磊
赞同来自:
要回复问题请先登录或注册
发起人
相关问题
问题状态
—— 扫技术支持中心微信服务号!
—— 让GIS知乎问答随时随地!