0

I already have a georeferenced base map loaded in ArcMap. I want to find the spatial reference of this map and assign the same coordinate system to a polygon that I created. I can not get a start with the code as I am a beginner.

3
  • 1
    You can get the spatialreference from IMap, then assign it with IGeometry.
    – mkennedy
    Commented Jun 25, 2014 at 18:09
  • Thank you @mkennedy actually I initialized the interface by writing Dim SpatialReference As ISpatialReference Now I dont know how to return the result from it. Can you please complete the code to know the spatial reference?
    – thiszjithu
    Commented Jun 25, 2014 at 18:15
  • To help Answerers can you please edit your Question to show your code so far, please? This should not be your attempt at your whole application, just a code snippet that works up to the point where you are stuck, with a description about what you are trying to do next. Are you creating an ArcMap Add-in?
    – PolyGeo
    Commented Jun 25, 2014 at 21:59

2 Answers 2

1

Assuming you're creating an ArcMap Add-in:

Dim pApp as IMXapplication = CType(My.ArcMap.Application, ESRI.ArcGIS.ArcMapUI.IMxApplication)
Dim pDoc As IMxDocument = pApp.Document
Dim pMap as IMap = pDoc.FocusMap ' document may contain many maps, this is the acive one'
Dim pSR as ISpatialReference = pMap.SpatialReference

This is the chain from My.ArcMap.Application to the current maps' spatial reference.

0

Try taking a look at these places:

http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#//00490000003t000000

http://forums.esri.com/Thread.asp?c=159&f=1707&t=232161

This is assuming you're meaning a spatial reference from a layer you put in as a basemap. If you are using an ArcGIS basemap from ESRI, the spatial reference is usually Web Mercator but double check it in a new project's data frame.

3
  • Your links are related to the dataset not the data frame (IMap).
    – artwork21
    Commented Jun 25, 2014 at 18:55
  • Yes... Judging from the wording of the question, I would guess they are talking about matching to the basemap and not the data frame. Like matching the polygon to the existing basemap's SR system.
    – Branco
    Commented Jun 25, 2014 at 18:58
  • Answers consisting solely of links to other sites are generally discouraged. You should try to at least summarize if not quote the information in the links, or give some general context about the information found there.
    – Chris W
    Commented Jun 25, 2014 at 22:01

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