2

i'm updating a SOE from pre 10.1 arcgis server to arcgis server 10.2.2.

The orginial code included the following part, which is not working anymore:

IMapServer3 mapServer = serverObjectHelper.ServerObject as IMapServer3;
IMapServerObjects3 mapServerObjects = mapServer as IMapServerObjects3;
IMap map = mapServerObjects.get_Map(mapServer.DefaultMapName);

I found that pre 10.1, this code would only work for MXD and not for MSD documents. ESRI says this:

All map services now use the fast drawing engine that was associated with MSDs in versions 10.0 and previous.

So it seems logic this piece of code would not work anymore. Anyone has an idea on how I get my IMap variable in 10.2?

Thanks

  • What exactly are you trying to do once you grab the Imap variable? – papadoo Jul 28 '14 at 15:54
  • I'm using it as the source property of the IPointToEID interface. Maybe I can load the mxd from the server instead of extracting it from the mapservice? – GeoSolve Jul 28 '14 at 16:04
2

Okay, I was able to get my MXD by loading it directly from the server machine using this snippet:

string docname = "E:\mydoc.mxd"
IMapDocument mapDoc = new MapDocumentClass();

if (!(mapDoc.get_IsPresent(docname)))
  throw new Exception("Unable to find local mxd");

mapDoc.Open(docname, string.Emtpy);
map = mapDoc.get_Map(0);
mapDoc.Close();
0

Esri is discontinuing the use of some carto objects when it comes to SOEs (like and Imap, activeview, ILayer) the reason is that the new drawing engine for SOEs are much better and improved. Yes you will lose some rich features but at a price of a greater performance.

Some of the information contained in this post requires additional references. Please edit to add citations to reliable sources that support the assertions made here. Unsourced material may be disputed or deleted.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.