Select to view content in your preferred language

SpatialReference - why so many instances?

708
1
04-11-2013 05:49 PM
stevemclaughlin
Occasional Contributor
I'm profiling my project and I have 400 instances of SpatialReference taking up 6% of my project's memory.
Is there any reason why each map point has to have it's own SpatialReference?
Can I create a global SpatialReference variable and define each mappoint to use it?

ex:
var myGraphicPic:Graphic = new Graphic(new MapPoint(-411000, 4924000, new SpatialReference(102100)));
                myGraphicPic.symbol = pictureMarker;
                myGraphicsLayer.add(myGraphicPic);
 var myGraphicPic2:Graphic = new Graphic(new MapPoint(-531000, 5024000, new SpatialReference(102100)));
                myGraphicPic2.symbol = pictureMarker;
                myGraphicsLayer.add(myGraphicPic2);


Is there anything happening inside SpatialReference ?  Is it basically a read-only object?
thanks,
Tags (2)
0 Kudos
1 Reply
JoeHewitt
Regular Contributor
Are you using bing maps as a basemap?
These basemaps automatically set your spatial reference to (102100) so the points you add on top automatically get projected into this. So there is no point setting a new spatial reference for the points you adding since you want them in 102100 as well. It would be safe to completely delete all of the new spatial reference processes for each of your points you are trying to add, there just extra processes for the same result.
0 Kudos