Create Custom Public Google Map with Markers - c#

I have a discord bot written in c# that reports events based on their latitude/longitude. I want to take the latitude/longitude data and place markers on an html based google map (locally hosted or online) using c#
Can someone point me in the right direction?

You'll want to use the Google Static Maps API.

Related

How to add pins to map?

So I am creating an app which will have map with pre added locations (pins) into it and when user comes near that location (s)he will get notification. My problem is, how to add Pins into Xamarin Maps? I am not using Google Maps, I am trying to do with "Xamarin Custom Map?".
I have opened map, but it is opening in Google Maps appliation. I looked for a way not to use Google Maps Api, but I didn't find a single solution how to do this without Google Maps, so is it even possible?
var locator = CrossGeolocator.Current;
locator.DesiredAccuracy = 20;
var position = await locator.GetPositionAsync(TimeSpan.FromSeconds(20), null, true);
Map.OpenAsync(position.Latitude, position.Longitude);
This code here opens map application on my smartphone (in this case GoogleMaps), so I am wondering is it possible to add pins to it, or somehow open map inside of my app wihtout using Google Maps API?
thx all for feedback, using Google Maps API is easiest and best solution for this! :-)

Call Google Directions API form Xamarin.Forms app

I'm trying to set up a basic app to call the Google Directions API from a Xamarin.Forms app in Android. I'm new to Xamarin & C# generally, so have struggled searching for the right terms, but am familiar with the directions service from a javascript angle.
I'm using this basic app as a test bed: https://learn.microsoft.com/en-us/xamarin/android/platform/maps-and-location/maps/maps-api
I can add the button and associate a process with it, but how do i call the API & catch the results?
I'll worry about plotting etc later, i just want to write out the results to console for now.
Thanks for your help in advance!
1.First of all, you can used following URL to get Json data.(Please notice:You need to enable the Directions API in Google console,otherwise, you will get error message This API project is not authorized to use this API.)
https://maps.googleapis.com/maps/api/directions/json?origin=lat1,lon1&destination=lat2,lon2&key=yourApiKey
In this URL, you need to provide the latitude and longitude of Origin position and destination postion.API key(You can get the API key from a Google console)
2.You can play and just change variables in this link and open it in browser, to see the returning object like this screenshot.
3.When you receive the return object, you will need to parse it.(Prase json data:http://bsubramanyamraju.blogspot.com/2017/04/xamarinforms-consuming-rest-webserivce_17.html)
4.The distance will be at googleApiRouteObject.routes[0].legs[0].distance; There you will find a int representation in meeters, and string representation like 2km.
5.The waypoints will be coded in Polylines, you will need to parse them. You can find how to do that with code examples here: https://developers.google.com/maps/documentation/utilities/polylineutility
If you want to get the sample code, you can refer to this link.
https://agileapp.co/xamarin-forms-maps-polyline-route-highlighted-google-api

Bing Maps API in Bot Framework

Using .Net framework to building application. I have created a Bing Maps API service in Azure and I want to integrate it in a chat bot created using Bot Framework. I have generated the key for using map.
I am able to show list of locations based on a keyword. I am using https://dev.virtualearth.net/REST/v1/Locations?form={FormCode}&q={keyword}&key={BingKey}. It works fine and I am able to see the locations as Maps.
Now I want to search things like doctors near me or something like this. However I am not able get any reference of it. Its very confusing. I am not sure how to do it. Could anyone please guide me on this?
With some reading, maybe we have search data by passing key and data source ID however I am not sure how to create Data Source for Bing Maps.
You are looking for Points of Interest (POI) so you have to use Bing Spatial Data Services.
There are several Data Sources available:
FourthCoffeeSample which is a sample datasource
NAVTEQNA for POI provided by NAVTEQ for North America
NAVTEQEU for POI provided by NAVTEQ for Europe
etc.
Each DataSource has a different base URL:
FourthCoffeeSample: http://spatial.virtualearth.net/REST/v1/data/20181f26d9e94c81acdf9496133d4f23/FourthCoffeeSample/FourthCoffeeShops
NAVTEQNA: https://spatial.virtualearth.net/REST/v1/data/f22876ec257b474b82fe2ffcb8393150/NavteqNA/NavteqPOIs
NAVTEQEU: http://spatial.virtualearth.net/REST/v1/data/c2ae584bbccc4916a0acf75d1e6947b4/NavteqEU/NavteqPOIs
How to make a query? The syntax's documentation is available here
You may also be interested by some references:
EntityTypes list for NAVTEQEU and NAVTEQNA: https://msdn.microsoft.com/en-us/library/hh478191.aspx
There is also an example of use of these API here (in JS).

Finding likely locations in Xamarin using google maps API

I am working on a Xamarin iOS project trying to display a list of the most likely locations based on the user's GPS coordinates using either the Place Picker or GMSPlacePickerViewController from the google maps API, as shown in this Swift tutorial.
However I can't seem to find any decent tutorials using C#. I don't want to display the map to users I simply want to retrieve the list of most likely locations based on the coordinates.
Any guidance would be greatly appreciated as I'm at a bit of a loss about how to use the google maps API to achieve this.
Okay answering this for anyone coming after me and trying to do something similar.After lots of searching I have realised it is possible to use the nearbySearch method from the Google Places API Web Service to retrieve a list of addresses near particular coordinates within a specific radius (in metres). You can optionally specify the type of addresses you are searching for, e.g. Restaurants.
Not sure how I missed this but there is a Place Search demo at the bottom of this page;
https://developers.google.com/places/web-service/

C# Google Maps Api - Using the API and Getting to Know If There Is a Way Between A and B

I am trying to code pathfinding algorithm by using Google Maps Api.
The project is an ASP.Net Web Application and I must get the shortest way between A and B but it is my job not Google Maps'.
I only need to ask Google Maps "Hey Google Is there a direct road between X and Y?" then need boolean type simple answer. (There is always a road between X and Y indirectly so Google Maps can say me the distance of road/path it is acceptable for me too).
My other question is "Is there any library for .Net to not need to use javascript or at least using javascript strings on .cs files not in aspx files?"
Thanks in advance and forgive me about my bad English.
For calculating route between two points you need Google Directions API. That will return you a result json/xml with distance and other details.
The Google Directions API is a service that calculates directions
between locations using an HTTP request. You can search for directions
for several modes of transportation, include transit, driving, walking
or cycling. Directions may specify origins, destinations and waypoints
either as text strings (e.g. "Chicago, IL" or "Darwin, NT, Australia")
or as latitude/longitude coordinates. The Directions API can return
multi-part directions using a series of waypoints
A request would be something like
http://maps.googleapis.com/maps/api/directions/json?origin=Boston,MA&destination=Concord,MA&waypoints=Charlestown,MA|Lexington,MA&sensor=false
You may wanna see this article on Code project: Google Maps API V3 for ASP.NET
For your 2nd part of the question, I am not sure what are you asking. You can use the above API in .Net irrespective of JavaScript

Categories