Hi,
I have a performance issue creating 1000 markers on ArcGIS map.
Below is a demo code snippet.
geo_map = new esri.Map(Ext.getCmp('geo_map').body.id, {
basemap: "topo",
center: [-96, 37],
zoom: 4
});
geo_map.on("load", function() {
GetMarkers(me, geo_map, config_settings, map_data, test_status);
});
function GetMarkers(obj, map, config_settings, map_data, test_status){
Ext.Object.each(map_data.data, function(marker_data){
var lng = marker_data.lng;
var lat = marker_data.lat;
var marker_icon = "http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=|C0C0C0|";
var marker= new esri.layers.GraphicsLayer();
var p = new esri.geometry.Point(lng, lat);
var s = new esri.symbol.PictureMarkerSymbol(marker_icon, 51, 51);
var g = new esri.Graphic(p, s);//console.log(marker);
marker.add(g);
map.addLayer(marker);
}
}
This is just a sample code. I get stop script error on all browser. The same code works fine for Google maps with 10000 markers. Is there any alternate way of creating markers in ArcGIS to improvise?
It seems that you are creating a new graphic layer for each graphic so you have 1000+ graphic layer on map.
var marker= new esri.layers.GraphicsLayer(); var marker_icon = "http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=|C0C0C0|"; var s = new esri.symbol.PictureMarkerSymbol(marker_icon, 51, 51); //TODO:Iterate through your data map.addLayer(marker);