AnsweredAssumed Answered

How to show center point icon on a Map?

Question asked by S.h.a.n.e on Jan 31, 2018
Latest reply on Jan 31, 2018 by S.h.a.n.e

Hi, I'm showing a map from an MVC application using the js 4.6 api. The SceneView displays fine, at the correct zoom level and center point:

 

var view = new SceneView({
container: "map_canvas", map: map, scale: 50000, center: [@Model.LONGITUDE, @Model.LATITUDE]
});

 

I also need to display an icon at the center point of the map, with a label, which is clickable to show its attributes. I tried to do this using:

 

var features = [{

geometry:{type: "point",x: @Model.LONGITUDE,y: @Model.LATITUDE},

attributes:{ObjectID: 1,DepArpt: "KATL",MsgTime: Date.now(),FltId: "UAL1"}

}];

 

var pointsLayer = new FeatureLayer({
source: features
});

 

map.addLayer(pointsLayer);

 

I don't get any error but the point doesn't show up. Any help would be appreciated. Thanks!

 

Here's the rest of the code:

 

<link rel="stylesheet" href="https://js.arcgis.com/4.6/esri/css/main.css">
<script src="https://js.arcgis.com/4.6/"></script>

<style>
#map_canvas img {
max-width: none;
}
</style>

<div id="map_canvas" style="height: 550px;"></div>

<script>
require([
"esri/Map",
"esri/views/SceneView",
"esri/symbols/SimpleMarkerSymbol",
"esri/symbols/SimpleLineSymbol",
"esri/symbols/PictureFillSymbol",
"esri/Color",
"esri/Graphic",
"esri/layers/FeatureLayer",
"dojo/dom", "dojo/on", "dojo/domReady!"
], function (Map, SceneView, Draw, Point, SimpleMarkerSymbol, SimpleLineSymbol, PictureFillSymbol, CartographicLineSymbol, Graphic, Color, dom, on) {
var map = new Map({
basemap: "hybrid", //streets, satellite, hybrid, topo, gray, dark-gray, oceans, osm, national-geographic
ground: "world-elevation",
sliderStyle: "large"
});

Outcomes