map.addLayer(subeventsGraphicsLayer);
var SubEventpt; var SubEventsymbol; var SubEventgraphic; var SubEventgraphics = new Array; var subeventsGraphicsLayer = new esri.layers.GraphicsLayer(); $.each(event.Subevents(), function (i, subevent) { SubEventpt = webMercatorUtils.geographicToWebMercator(new Point(subevent.Longitude, subevent.Latitude)); SubEventsymbol = new PictureMarkerSymbol('../Images/Incidents/' + subevent.IconPath, 36, 36); SubEventgraphic = self._map.addGraphic(new Graphic(SubEventpt, SubEventsymbol, ko.toJS(subevent))); SubEventgraphic = new Graphic(SubEventpt, SubEventsymbol, ko.toJS(subevent)); SubEventgraphics.push[SubEventgraphic]; }); subeventsGraphicsLayer.add(SubEventgraphics); self._map.add(subeventsGraphicsLayer);
Sorry I can't put it into a js fiddle, its way to complicated. But currently I am using a jquery for each to take the graphics and push each one into a variable that I defined as a array and then I am pushing the graphics into it. I am then taking the graphics array and adding the array to a new esri.layers.GraphicsLayer. And I am trying to push the graphics layer to the map. Currently I am getting an error that self._map.add(GraphicsLayer) is undefined. I have been debugging and I can see self._map is finding the div object map however it doesn't seem to be able find the add function.
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.