rungwiroon/BlazorGoogleMaps

MapRoutes

chandrashekharDeore opened this issue · 15 comments

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

Regards,
Chandrashekhar

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

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.

Could you provide stack trace or demo?

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

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

f21c6811-96e5-4db0-a9c7-72ea4f40c59b.mp4

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

AsT2 = '(new System.Collections.Generic.ICollectionDebugView<GoogleMapsComponents.Maps.DirectionsWaypoint>(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.

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.

Ok Thanks, which libraries should I use?

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

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.

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.

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.

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 :).

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

Yes, I am currently examining it.