rungwiroon / BlazorGoogleMaps

Blazor interop for GoogleMap library
MIT License
319 stars 102 forks source link

MapRoutes #282

Closed chandrashekharDeore closed 10 months ago

chandrashekharDeore commented 10 months ago

Hi, @valentasm could you please help me implement a map route? I tried adding directions, but it's not working.

Regards, Chandrashekhar

valentasm1 commented 10 months ago

You could try to look at demos https://github.com/rungwiroon/BlazorGoogleMaps/tree/master/ServerSideDemo/Pages You better try stack overflow for help.

chandrashekharDeore commented 10 months ago

I had a chance to review a demo and tried adding direction to it. However, I faced an issue while debugging the method responsible for adding direction. I came across an error message that read "AsT1 = 'dr.Origin.AsT1' threw an exception of type 'System.InvalidOperationException'." Upon further investigation, I found that the error occurred during the initialization of DirectionWaypoint and pointed towards an issue with the DirectionsWaypoint class property Location.

valentasm1 commented 10 months ago

Could you provide stack trace or demo?

chandrashekharDeore commented 10 months ago

image The image shows that T0 and T2 should have null values during initialization. However, an error occurs in the property, which causes an issue and sets the _directionsResult object to null. Additionally, the Origin and Destination properties in the DirectionsRequest object also throw the same exception, as shown in the image. image

valentasm1 commented 10 months ago

Could you provide stack trace or demo? Screenshots dotn help.

chandrashekharDeore commented 10 months ago

https://github.com/rungwiroon/BlazorGoogleMaps/assets/149042163/5a7d4a64-32a5-47d9-9856-4de936e09517

This is the stack trace exception I received during debugging. AsT0 = '(new System.Collections.Generic.ICollectionDebugView(waypoints).Items[0]).Location.AsT0' threw an exception of type 'System.InvalidOperationException'

AsT2 = '(new System.Collections.Generic.ICollectionDebugView(waypoints).Items[0]).Location.AsT2' threw an exception of type 'System.InvalidOperationException'. In the DirectionsWaypoint class, the Location property of type OneOf<string, LatLngLiteral, Place> is not being initialized correctly. In the sample code, the properties 'Destination' and 'Origin' of the class 'DirectionsRequest' are throwing the same exception as mentioned above.

valentasm1 commented 10 months ago

T1, T2 and T3 is OneOf implementation so their values depends on results. It never will happen that all will have value assigned. IMO error is due google map api configuration. Maybe need enable in google console for your key or add extra libraries.

chandrashekharDeore commented 10 months ago

Ok Thanks, which libraries should I use?

valentasm1 commented 10 months ago

I mean include in google url &libraries=places,visualization,drawing,marker Maybe you need to include missing one.

chandrashekharDeore commented 10 months ago

I wasn't able to implement a particular feature in my project. I attempted to do it within your project (https://github.com/rungwiroon/BlazorGoogleMaps/tree/master/ServerSideDemo/Pages) but was unsuccessful. My initial idea was to use the working feature from this project and improve upon it to suit my needs.

valentasm1 commented 10 months ago

Sorry but you need already have experience with google maps. Better look for javascipt examples and then move to this library since it is 1:1 in most cases.

valentasm1 commented 10 months ago

I think you underestimate my knowledge about library :). Most parts of library isnt implemented by me and i have no idea if it works. No complain then it works. Finding solutions for me takes a lot of time too, so if you dont have enough details it is hard to solve it for me.

chandrashekharDeore commented 10 months ago

I'm sorry if my response came across differently than I intended. I genuinely value your perspective and understand the challenges you're facing. Thanks for the help :).

valentasm1 commented 10 months ago

Just look for js examples. If you make it work on js than it will be easy to migrate to this library.

chandrashekharDeore commented 10 months ago

Yes, I am currently examining it.