I typically type in my coord system codes, like CA83-VIF to most dialogs, as I know the common ones for tasks I do.
I am making a program that needs to recognize those codes, and decide what system to set up with.
I am using the dotspatial library and c#, so I need to be sure I am setting up on the same system as map is for a given code.
Is there some lookup list out there with the short and full names of the systems?
I was surprised to find after a lot of looking, that everyone else seems to use the names from:
but there are no short names in their database tables.
Is there a term for those short names? Maybe I am serching the wrong terms.
How do autodesk products convert between the short and full system names?
thx
internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties
Solved! Go to Solution.
Solved by O_Eckmann. Go to Solution.
you nailed it. The CSCode property is the short name I was looking for. thanks!
internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties
wow, this started me down a new rabbit hole.
I have been using dotspatial for rather basic things like converting coordinates.
I see now that adesk is using the mapguide tools for their GIS engine, though I'm sure I was told that numerous times before.
So I downloaded the latest, and looked at the install files.
Low and behold, they have the same stuff in:
<downloaded folder>\CS-Map\Dictionaries\
as:
C:\ProgramData\Autodesk\Geospatial Coordinate Systems 14.01
so that is where that came from.
So now I am trying to figure out how to transform a point from one system to another.
I am not finding too many examples of using mapguide with .net, but am just wading into it.
I did see the transform methods, but not how to specify the from and to systems...
internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties
right on, exactly what I needed because I was getting stuck on if you use the mgpoint or coordinate object.
How does anyone figure this stuff out?
The help seems to get close, but acts like you are already good with the api.
Is there some place to go to read about basics like this?
internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties
Is it possible not use the Mapguide API for this?
because if you use the command ADESETCRDSYS and click the "select coordinates system" and leave the code field blank, then you can see all epsg code listed.
Is autocad also referencing to mapguide?
YES! Which is great news for people like me that want to do GIS things without acad map.
You see, the GIS engine of Map is open source and has a .net API.
Just obtain the osgeo dlls and add as references to your project like this (ignore the other references shown):
You have no idea how happy I was to discover this way back.
When you download the osgeo stuff, it has a folder of coordinate system files you would need if you don't have acad map installed.
So its not just 3 dll's, but a bit more I can explain if anyone wants to make a .net prog using them.
If you meant without using the mapguide api at all, I have not found a way, and I spent a fair amount of time trying.
Why bother though, its free.
internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties
THanks.
I am trying to do a stand alone apps using those 3 dlls and copied the directories folders of the CS map.
But i am getting a dependecy error on Mapguide.Foundation.
Any ideas?
when do you get the error, on compile or when running?
Do you have the data stuff in place?
C:\ProgramData\Autodesk\Geospatial Coordinate Systems\
That will be there if you have acad installed. If not, you must obtain it and make sure your standalone app can find it.
It was in the download I used:
MapGuideOpenSource-2.6.0.8316-InstantSetup-x64.exe
Be more specific and we can get it working. I'll do a test app if we need to.
internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties
Error is at
MgCoordinateSystemFactory coordSysFactory = new MgCoordinateSystemFactory();
PInvoke error on mggeometry
Yep, ive have the folder for the CS from autodesk, i also have mapguide opensource installed and have a running apps using those dlls
thanks
IIRC the dependency is on PresentationCore. You can add the reference from Assemblies->Framework. You should see the required reference in the error msg.
ah, worth a kudo! Thx for jumping in on that.
internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties
Thanks for the help guys, but still having the same error.
Anything i ref from mapguide is causing an exception error.
I have a running mapguide project and it works ok, and i used the same dll its using. But its weird that this is bombing out.
Hi JMeading.
Was able to make the app work, now I wanted to get categories, but accessing it is quite slow. Have you tried it?
mgcs.GetCategories()
then mgcs.GetCategories().getItem(1)
are those the only ways to get all categories? because I am planning to make a drop down list of all categories and make a search selection for it.
Thanks
Regards
Hey there,
No speed issues for me so far, though I may be accessing things differently than you:
//the point of this is to find short names for the systems [CommandMethod("ListCoordSystems")] public void ListCoordSystems() { //list items for mapguide MgCoordinateSystemFactory coordSysFactory = new MgCoordinateSystemFactory(); MgCoordinateSystemCatalog csCatalog = coordSysFactory.GetCatalog(); MgCoordinateSystemDictionary csDict = csCatalog.GetCoordinateSystemDictionary(); MgCoordinateSystemEnum csDictEnum = csDict.GetEnum(); int csCount = csDict.GetSize(); MgStringCollection csNames = csDictEnum.NextName(csCount); string csName = null; MgCoordinateSystem cs = null; List<string> txtout = new List<string>(); AcEd.Editor ed = AcAp.DocumentManager.MdiActiveDocument.Editor; for (int i = 0; i < csCount; i++) { csName = csNames.GetItem(i); cs = csDict.GetCoordinateSystem(csName); if (cs.CsCode == "") { ed.WriteMessage("\nNo CS Code for EPSG " + cs.EpsgCode.ToString()); } txtout.Add(cs.EpsgCode + "," + cs.CsCode + "," + cs.Description.Replace(",", "|")); } //write to file HAStr.TextToFile("c:\\temp\\GIS Codes.csv", txtout); ed.WriteMessage("\nWritten to c:\\temp\\GIS Codes.csv"); }
I think that is looping through the whole system, so worst case in terms of speed.
See if that code does better.
thx
internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties
Yes, im doing the same code and its fast.
But the concern is accessing the Categories of each CS?
because my goal is to build something similar to the Coordinate System Library form in civil 3d. If you look at it, there is a combo box with all the categories etc. lat long, Africa, Algeria, US and etc..... and everytime to make a selection it filters your list.
I am doing something like that, but to get all those categories, the only methods I see to access it is MGCoordinatesSsystem.GetCategories() then I have to Itemrate on that by using For statement on GetItem(x). But calling both functions takes time.. the CS list is around 6800+, Ive been running the code for 20 misn and the numbers ive processed is around 685.
Hi,
I am trying to deploy this on IIS, ive created a web api. Ive used the 64bit version of mapguide. On my development its running fine, but when I put it on IIS I am getting an error.
Unable to load DLL 'GeometryUnmanagedApi': The specified module could not be found.
but I do have that on my bin folder and even tried copying it on inetserv folder.
Any ideas?