[mapguide-users] Re: Any coord. system to WGS84 (Google Earth). What's wrong?

Mark Pendergraft markp at Meadgilman.com
Wed Mar 31 12:43:19 EDT 2010


I think the problem here is the $coordSys1 and $coordSys2.  I have a similar
snippet of code that converts WAHP-NF into LL84 and I think the
MGCoordinateSystemTransform() method is looking for the WKT coordinate
system and not the CS names.

Try using MGcoordinateFactory->ConvertCoordinateSystemCodeToWkt()
Also, the two codes you have won't work.  I believe WGS 84 in CS code is
"LL84" and i'm not sure about the other but i suspect it may be "ED50/ES.LL"

of course you could always supply the WKT yourself.

Alternatively, have you explored the MgCoordinateSystem->ConvertToLonLat() 
?
the code looks like this in VB, you can convert to PHP

            ' basic initialization needs to be done every time
            Dim s_basePath As String =
System.Web.HttpContext.Current.Request.ServerVariables("APPL_PHYSICAL_PATH")
            MapGuideApi.MgInitializeWebTier(s_basePath + "../webconfig.ini")
        
            ' Get the user information using the session id,
            ' and set up a connection to the site server.     
            Dim UserInfo As New MgUserInformation(sessionId)
            Dim siteconnection As New MgSiteConnection
            siteconnection.Open(UserInfo)

            ' Get an instance of the required service(s).
            Dim ResourceService As MgResourceService =
siteconnection.CreateService(MgServiceType.ResourceService)


            Dim Map As New MgMap(siteconnection)
            Map.Open(ResourceService, mapName)
            
            Dim coordFact As New MgCoordinateSystemFactory
            Dim mapCoordSys As MgCoordinateSystem =
coordFact.Create(Map.GetMapSRS)
            Dim geomFact As New MgGeometryFactory
            Dim mapCoord As MgCoordinate = geomFact.CreateCoordinateXY(x, y)
            Dim LLcoord As MgCoordinate =
mapCoordSys.ConvertToLonLat(mapCoord)
-- 
View this message in context: http://n2.nabble.com/Any-coord-system-to-WGS84-Google-Earth-tp1811461p4831992.html
Sent from the MapGuide Users mailing list archive at Nabble.com.


More information about the mapguide-users mailing list