지도에서 런던에 십자가를 그리려고합니다. 지리적 또는 웹 메카 토르에서 점의 좌표를 지정하면 코드가 작동합니다. 그러나 ED50/UTM 영역 31N에서 좌표를 지정하면 작동하지 않습니다. 문서에 따르면 Point 생성자는 공간 참조를 마지막 인수로 사용합니다. 나는이 점이지도의 좌표 시스템 (웹 메르 케이터)으로 변형 될 것이라고 생각할 것입니까? 그러나 요점은 지금 프랑스의 한가운데 어딘가에 나타난다. 여기서 무슨 일이 일어나고 있는지 확실하지 않은가요?웹 메르 케토 터 이외의 투영 된 좌표계에서 그래픽에 맵을 추가하려면 어떻게합니까?
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no" />
<title>London Map</title>
<link rel="stylesheet" href="https://js.arcgis.com/3.17/esri/css/esri.css">
<style>
html, body, #map {
height: 100%;
margin: 0;
padding: 0;
}
</style>
<script src="https://js.arcgis.com/3.17/"></script>
<script>
var map;
require(["esri/map", "esri/geometry/Point", "esri/SpatialReference", "esri/graphic", "dojo/domReady!"], function (Map, Point, SpatialReference, Graphic) {
map = new Map("map", {
basemap: "topo", //For full list of pre-defined basemaps, navigate to http://arcg.is/1JVo6Wd
center: [0.1, 51.5], // longitude, latitude
zoom: 8
});
map.on("load", function() {
//var P = new Point({ "x": 0.1, "y": 51.5, "spatialReference": { "wkid": 4326 } }); // geographic: works!
//var P = new Point({ "x": -10978, "y": 6708911, "spatialReference": { "wkid": 102100 } }); // web mercator: works!
//var P = new Point({ "x": 284879, "y": 5711864, "spatialReference": { "wkid": 23031 } }); // somewhere in the middle of France !!??
var P = new Point([284879, 5711864], new SpatialReference({ wkid: 23031 })); // somewhere in the middle of France !!??
var pointSymbol = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_X, 10, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([0, 0, 0]), 2), new dojo.Color([0, 255, 0, 0.25]));
var mapPointGraphic = new Graphic(P, pointSymbol);
map.graphics.add(mapPointGraphic);
});
});
</script>
</head>
<body>
<div id="map"></div>
</body>
</html>
감사합니다. T Kambi! 지금은 Point 생성자에 대한 공간 참조 인수가 이해가 안되므로 제거해야합니다. 나는 런던에 웹 좌표계를 사용하여 Point를 만들었지 만 다른 공간 참조로 런던을 그린 적이있다. 따라서 공간 참조 인수는 무시 된 것 같습니다. – Andy