Skip to main content
Home Forums Silverlight Programming Accessing Web Services with Silverlight Connecting silverlight virtual earth with wcf services
23 replies. Latest Post by varshavmane on June 22, 2009.
(0)
arcobaleno
Member
3 points
16 Posts
06-05-2009 12:06 AM |
i am implementing virtual earth in my project. how do i retrieve the longitude and latitude from sql management studio and add pushpin to my project, i read from several websites and it says that i require WCF services. Can any programmer teach me on how do i do it?
varshavmane
Contributor
6723 points
1,580 Posts
06-05-2009 1:24 AM |
Check this:
http://johanneskebeck.spaces.live.com/blog/cns!42E1F70205EC8A96!8528.entry
Hope it helps you.
06-05-2009 11:04 AM |
thanks alot :)by the way, do you have any C# language source?
06-05-2009 11:17 AM |
I guess its not that difficult
If you have any problem then post it.. we will help you for conversion.
06-18-2009 2:53 AM |
thanks alot for your help. By the way, while i am following the steps of linking to sql database, i encounter a problem while adding service reference which is
An error occured while attempting to find services at'http://localhost:59884/DataService.svc'.how do i solve this?
06-18-2009 3:07 AM |
Can you please browse the Service ? Is it working fine ?
If you are using any dbml file the make sure that in properties its direction is unidirectional.
One thing you have to check in your Web.Config file, it has your service details you have to make binding="basicHttpBinding" something like this:
<service behaviorConfiguration="DataServiceBehavior" name="DataService"> <endpoint address="" binding="basicHttpBinding" bindingConfiguration="LargeBuffer" contract="DataService"> <identity> <dns value="localhost" /> </identity> </endpoint> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> </service>
Or check this link: http://chakkaradeep.wordpress.com/2008/05/31/silverlight-and-wcf/
Please let us know if you are still getting the same issue.
06-19-2009 12:44 AM |
while i am using languages converter, i came across this error
[OperationContract()] public List<UK_low_bridges_all> GetPOIinView(double NWlat, double NWlon, double SElat, double SELon){ HannesPOIDataContext datacontext = new HannesPOIDataContext(); return (().ToList());}
how do i actually solve it?sorry to trouble you again.
06-19-2009 12:59 AM |
Can you please post the code which you are trying to convert ?
06-19-2009 1:02 AM |
Imports System.ServiceModelImports System.ServiceModel.Activation<ServiceContract(Namespace:="DataService")> _<AspNetCompatibilityRequirements(RequirementsMode:=AspNetCompatibilityRequirementsMode.Allowed)> _Public Class DataService <OperationContract()> _ Public Function GetPOIinView(ByVal NWlat As Double, _ ByVal NWlon As Double, _ ByVal SElat As Double, _ ByVal SELon As Double) _ As List(Of UK_low_bridges_all) Dim datacontext As New HannesPOIDataContext Return ((From UK_low_bridges_alls _ In datacontext.UK_low_bridges_alls _ Where UK_low_bridges_alls.Latitude <= NWlat And _ UK_low_bridges_alls.Latitude >= SElat And _ UK_low_bridges_alls.Longitude >= NWlon And _ UK_low_bridges_alls.Longitude <= SELon).ToList()) End FunctionEnd Class
06-19-2009 1:25 AM |
Try this :
{
&& UK_low_bridges_alls.Latitude >= SElat
&& UK_low_bridges_alls.Longitude >= NWlon
&& UK_low_bridges_alls.Longitude <= SELon;
}
Hope it helps you ...
06-19-2009 1:43 AM |
i am getting error from this line,
Error 2 A query body must end with a select clause or a group clause Error 3 The type of the expression in the select clause is incorrect. Type inference failed in the call to 'Select'.
06-19-2009 1:53 AM |
Sorry I forgot to mention Select Statement in the query:
&& UK_low_bridges_alls.Longitude <= SELon
select UK_low_bridges_alls.ColumnNameWhichYouWant;
where ColumnNameWhichYouWant will be the columns which you want to select just seperate them with comma if you wnat to select more than one column.
Hope it works now .
06-19-2009 2:17 AM |
thanks alot for your help but i am still facing the same Service problem after checking my dbml file properties direction, which is unidirectional and i follow your guide which is to change the binding to 'basicHttpBinding'. is there any steps that i miss out?
06-19-2009 2:55 AM |
Are you able to browse the service something like http://localhost/YoueServiceName.svc ?
06-19-2009 3:27 AM |
can't
06-19-2009 3:39 AM |
If you cant browse http://localhost/YourServiceName.svc then there is some problem with your WCF Service.
Please check whether the Project builds properly ?
06-21-2009 11:32 PM |
i am done with the WCF Service thanks to your help and i am left with last part for the tutorial. i get an error with the Result. The original coding,
Private Sub svc_GetPoiInMapViewCompleted(ByVal sender As Object, _ ByVal e As GetPOIinViewCompletedEventArgs) If e.Error Is Nothing Then For i = 0 To e.Result.Count - 1 Dim point As New Ellipse() point.Width = 10 point.Height = 10 point.Fill = New SolidColorBrush(Colors.Red) point.Opacity = 0.65 Dim location As New Location(e.Result(i).Latitude, e.Result(i).Longitude) MapLayer.SetMapPosition(point, location) ToolTipService.SetToolTip(point, e.Result(i).Name) MyPOI.Children.Add(point) Next Else MessageBox.Show("Error occurred while loading POI from database", _ "Error", MessageBoxButton.OK) End If End Sub my c# coding,private void svc_GetPoiInMapViewCompleted(object sender, GetPOIinViewCompletedEventArgs e) { int i = new int(); if (e.Error == null) { for (i = 0; i <= e.Result.Count - 1; i++) { Ellipse point = new Ellipse(); point.Width = 10; point.Height = 10; point.Fill = new SolidColorBrush(Colors.Red); point.Opacity = 0.65; Location location = new Location(e.Result(i).Latitude, e.Result(i).Longitude); MapLayer.SetMapPosition(point, location); ToolTipService.SetToolTip(point, e.Result(i).Name); MyPOI.Children.Add(point); } } else { MessageBox.Show("Error occurred while loading POI from database", "Error", MessageBoxButton.OK); } i get an error from the 'Result', it shows Error 'VE_SL_DBConn.DataServiceReference.GetPOIinViewCompletedEventArgs.Result' cannot be used like a method. how do i get it solved?
Private Sub svc_GetPoiInMapViewCompleted(ByVal sender As Object, _ ByVal e As GetPOIinViewCompletedEventArgs) If e.Error Is Nothing Then For i = 0 To e.Result.Count - 1 Dim point As New Ellipse() point.Width = 10 point.Height = 10 point.Fill = New SolidColorBrush(Colors.Red) point.Opacity = 0.65 Dim location As New Location(e.Result(i).Latitude, e.Result(i).Longitude) MapLayer.SetMapPosition(point, location) ToolTipService.SetToolTip(point, e.Result(i).Name) MyPOI.Children.Add(point) Next Else MessageBox.Show("Error occurred while loading POI from database", _ "Error", MessageBoxButton.OK) End If End Sub
my c# coding,
private void svc_GetPoiInMapViewCompleted(object sender, GetPOIinViewCompletedEventArgs e) { int i = new int(); if (e.Error == null) { for (i = 0; i <= e.Result.Count - 1; i++) { Ellipse point = new Ellipse(); point.Width = 10; point.Height = 10; point.Fill = new SolidColorBrush(Colors.Red); point.Opacity = 0.65; Location location = new Location(e.Result(i).Latitude, e.Result(i).Longitude); MapLayer.SetMapPosition(point, location); ToolTipService.SetToolTip(point, e.Result(i).Name); MyPOI.Children.Add(point); } } else { MessageBox.Show("Error occurred while loading POI from database", "Error", MessageBoxButton.OK); }
i get an error from the 'Result', it shows Error 'VE_SL_DBConn.DataServiceReference.GetPOIinViewCompletedEventArgs.Result' cannot be used like a method.
how do i get it solved?
06-22-2009 1:19 AM |
I guess the problem is with Result(i), you have to change this to Result.
Hope it helps you
06-22-2009 1:37 AM |
thanks and i am left with the last error, which lies on
Location location = new Location(e.Result.Latitude, e.Result.Longitude);
06-22-2009 2:53 AM |
Just check with the parameters of Location Method. Looks like you are sending some wrong parameters.
06-22-2009 3:10 AM |
sorry, i am a beginner in programming, i don't fully understand what you mean by the 'location method' in 'parameters of location method'.
06-22-2009 3:29 AM |
Can you just try this:
double latitude = e.Result.Latitude;
double longitude = e.Result.Longitude;
Location location = new Location(latitude, longitude);
The problem is with Location Method. You have to do like this Location(double, double) but in your code its Location(double? , double).
06-22-2009 3:44 AM |
sorry, i am still having problem with the 'double' stuffs
double latitude = e.Result.Latitude; double longitude = e.Result.Longitude; Location location = new Location(latitude, longitude);
Error 1 Cannot implicitly convert type 'double?' to 'double'. An explicit conversion exists (are you missing a cast?)
06-22-2009 3:49 AM |
Try this:
double? latitude = e.Result.Latitude;double longitude = e.Result.Longitude;Location location = new Location(latitude, longitude);
Or
check this link : http://www.cadmaps.com/gisblog/?p=61
HTH