Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am working with ArcObjects and ESRI for the first time, and I am trying to do what is probably a simple task.

I have a map control in VBA that is associated with a mxd.

I have a table with XY data, and XY data is non-spatial, but the XY is in the same coordinate system as the mxd.

I can get the XY data into a ITable, but I cannot seem to get the ISpatialReference from the map control.

I would like to create a symbolized layer from the non-spatial coordinates, and add it to the map control.

Any samples in VBA of how to do this would be very appreciated.

Thanks again for you time and patience.

share|improve this question
Not being a programmer made this a esoteric task to me. I have now learned how to implement the multiple interfaces for the AOs, and this makes life easier ;) I can now do what I want with the control I think. At this point it probably would have been easier to have become a Comp Sci major instead of a Geo major. I am finding no one in my class of geographers really can describe how to program. – user2078 Mar 5 '11 at 4:36

To get the spatial Reference form the map, you can use the following code:

dim pmXDoc as IMxDocument
set pmXDoc =ThisDocument

dim pMap as IMap
set pMap=pmXDoc.FocusMap

dim pSR as ISpatialReference
set pSR=pMap.SpatialReference

Here is a sample, which shows how you can make an XY event layer, once you have table in a ITable:

share|improve this answer
Thanks DevDatta! – user2078 Mar 6 '11 at 5:23
If this answer has solved your query, I'll request you to mark it as the accepted answer. This will help others in the future, who stumble upon this question. – Devdatta Tengshe Mar 7 '11 at 4:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.