Select to view content in your preferred language

New Map File Command with Java

982
4
02-22-2011 09:52 AM
ViridianaGO
Occasional Contributor
Hi! I have a question, how can I implement the New Map File Command whit Java in an application? Thanks.
0 Kudos
4 Replies
TomSchuller
Frequent Contributor
Could you describe deeper your idea?

Do you want a new menuitem in ArcMAP?
Or do you want to create a standalone ArcEngine application?
0 Kudos
ViridianaGO
Occasional Contributor
Thanks. I´m creating an application with ArcGis Engine using Java, I wanto to know how create a new map file like in ArcMap but in my application. Is this possible?
0 Kudos
TomSchuller
Frequent Contributor
This should work
        File newFile = new File("myNewFile.mxd");
        MapDocument mapDocument = new MapDocument();
        mapDocument.esri_new(newFile );
/* if you will save some content in it, just comment below out
        mapDocument.replaceContents(map);
        mapDocument.setActiveView(map);   or        mapDocument.setActiveView(pageLayout);
*/
        mapDocument.save(false, false);
        mapDocument.close();
0 Kudos
ViridianaGO
Occasional Contributor
Thank you so much, I´ll try it.
0 Kudos