Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MapPoint Latitude/Longitude
Message
 
To
15/12/2004 08:09:54
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00969401
Message ID:
00969831
Views:
16
Something like this:
oApp = CREATEOBJECT("MapPoint.Application")
oApp.visible=.t.
oMap = oApp.NewMap()
oLoc=oMap.Find("11072 Greiner Road, Philadelphia, PA 19116")
store 0 to dblLat,dblLon

=iGetLatLon(oMap, oLoc.location)

?dblLat,dblLon

oLoc = null
oMap = null
oApp = null
Return
*----------------------
PROCEDURE iGetLatLon
* following  Gilles Kohl (gilles@compuserve.com) at
* http://www.mp2kmag.com/a13--kohl.extract.lat.lon.mappoint.html
PARAMETERS poMap, poLocation
LOCAL locNorthPole, locSantaCruz,dblHalfEarth, GCD, Lat_Rad

locNorthPole = poMap.GetLocation(90, 0)
locSantaCruz = poMap.GetLocation(0, -90)

*Compute distance between north and south poles == half earth circumference
dblHalfEarth = poMap.Distance(locNorthPole, poMap.GetLocation(-90, 0))
*Quarter of that is the max distance a point may be away from locSantaCruz 
*		and still be in western hemisphere
      dblQuarterEarth = dblHalfEarth / 2
*Compute latitude from distance to north pole
   dblLat = 90 - 180 * poMap.Distance(locNorthPole, poLocation) / dblHalfEarth
   
*Compute great circle distance to poLocation from point on Greenwich 
*          meridian and computed Latitude
   GCD = poMap.Distance(poMap.GetLocation(dblLat, 0), poLocation)

* convert latitude to radian
   Lat_Rad = (dblLat / 180) * PI()

* Compute Longitude from great circle distance
 dblLon = 180 * Acos(( Cos(GCD * PI()/dblHalfEarth) - (Sin(Lat_Rad))^2 ) / (Cos(Lat_Rad))^2 ) / PI()

* Correct longitude sign if located in western hemisphere
   If poMap.Distance(locSantaCruz, poLocation) < dblQuarterEarth 
	   	dblLon = -dblLon
   ENDIF

return
>Hello,
>
>since last year we're using MS MapPoint in our program. So far so good. Now I have the following question : how can I get the latitude/longitude from a location-object? You can search a location by latitude/longitude using the GetLocation-method but how can I retrieve the position after I made a search ???
>
>Please help...
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform