Show lat lon point from text message

southernpost
12-06-2006, 07:52 AM
I am totally new to Map Point. I am looking for high level, step-by-step guidence for setting up a service whereby a lat lon coordinate can be text messaged to a DB ( or directly to Map Point ) and then allow a user so access Map Point via a web browser and see the lat lon coordinate ( as a pushpin I assume ).

I am looking for a quick solution initially so that I can demo the capability. Then I will do more exhaustive research and build a robust solution using SQL Server 2005 as the lat lon repository. My background is a SQL Server DBA with some old C programming experience. I haven't gotten into .Net much yet. So, the less programming, the better, initially.

Thank you.

shaistasohail
12-08-2006, 04:48 PM
Here is some sample code. This will not work in itself but it can be used a reference. Look at MapPoint SDK examples. They are fairly comprehensive.


Public Sub ShowLocationFromGeoCode()

'Create a global object to initialize MapPoint .NET objects
'MapServerWS is the name space of out project. You will something different.

Dim global As MapServerWS.Global = Context.ApplicationInstance

'Create the Location object for the start point
Dim StartLocation As New Location
Dim StartGeoCode As New LatLong
StartGeoCode.Latitude = Request.QueryString("LAT")
StartGeoCode.Longitude = Request.QueryString("LON")
StartLocation.LatLong = StartGeoCode

'Set up the datasource to use
Dim myDataSourceName As String
Dim oUserInfo As New UserInfoRouteHeader

'You can get fancy when determiningthe data source. If your locations are in United States only then use MapPoint.NA
'If Request.QueryString("DS") Is Nothing Then
'myDataSourceName = GetDataSetFromCountry(Request.QueryString("COUNTRY"))
' Else
'myDataSourceName = GetDataSet(Request.QueryString("DS"))
'End If

myDataSourceName = "MapPoint.NA"

Try

'Now get the map
Dim myPushPins(0) As Pushpin

myPushPins(0) = New Pushpin
myPushPins(0).PinID = "DISPLOC"
If Request.QueryString("NAME") = "" Then
myPushPins(0).Label = "Dispatch Location"
Else
myPushPins(0).Label = Request.QueryString("NAME")
End If
myPushPins(0).IconName = "72"
myPushPins(0).IconDataSource = "MapPoint.Icons"
myPushPins(0).LatLong = StartGeoCode

'Set up the map options
Dim myMapOptions As New MapOptions
myMapOptions.ReturnType = MapReturnType.ReturnUrl
myMapOptions.Format = New ImageFormat
myMapOptions.Format.Height = Me.MapImage.Height.Value
myMapOptions.Format.Width = Me.MapImage.Height.Value

'Set up the specification object
Dim myMapViews(0) As ViewByScale
myMapViews(0) = New ViewByScale
myMapViews(0).CenterPoint = StartGeoCode
myMapViews(0).MapScale = 5000

Dim mapSpec As New MapSpecification
mapSpec.Views = myMapViews
mapSpec.Options = myMapOptions
mapSpec.DataSourceName = myDataSourceName
mapSpec.Pushpins = myPushPins

'Declare the map image array and get the map
'RenderServiceClass was initialized in Global.ASAX
'MapImage is app:Image control

Dim myMapImages() As MapImage
myMapImages = global.RenderServiceClass.GetMap(mapSpec)

If myMapImages(0) Is Nothing Then
Me.MapImage.Visible = False
Exit Sub
End If

'*** Cache the map image and then render the map
Cache(Session.SessionID & "_MapImage") = myMapImages(0)

'Set the MapImage url
Me.MapImage.ImageUrl = myMapImages(0).Url
Me.MapImage.Visible = True

'*** Set the driving directions in driving directions text box
Cache(Session.SessionID & "_PushPins") = myPushPins


Catch myException As SoapException
'Catch any errors in the CalculateSimpleRoute request
If myException.Message = cUnauthorized Then
Response.Write("<font face=""Verdana"" size=""2"" color=""#FF0000""><b>Invalid username or password specified for MS MapPoint Web Service. Please contact your web adminstrator.</b></font>")
ElseIf (myException.Detail("Type").InnerText = "MapPointUnroutableException") Then
Response.Write("<font face=""Verdana"" size=""2"" color=""#FF0000""><b>Dispatch location could not be displayed because roads data is not available.</b></font>")
Else
ErrorProc(Response, myException.Message, myException.StackTrace)
End If
Response.End()

Catch ex As Exception

If ex.Message = cUnauthorized Then
Response.Write("<font face=""Verdana"" size=""2"" color=""#FF0000""><b>Invalid username or password specified for MS MapPoint Web Service. Please contact your web adminstrator.</b></font>")
Else
ErrorProc(Response, ex.Message, ex.StackTrace)
End If
Response.End()

End Try


End Sub

 
Web mp2kmag.com
mapforums.com