Routes result from Google Map Route API differecen between A to B and B to A [closed] - google-maps

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 11 hours ago.
Improve this question
I am developing an app using Google Map Routes API, it is in the pre-GA state, I must use it because it support motobike (Two Wheeler).
I have problem when using the API, it return difference result when reverse original and destination. I tested with two locations:
A: latitude: 20.8557239, longitude: 106.6610099
B: latitude: 20.8351444, longitude: 106.7236489
Problem when call API:
When origin set to A, it return shortest route with distanceMeters: 10879 .
This is the post data:
{"origin":{"vehicleStopover":true,"sideOfRoad":true,"location":{"latLng":{"latitude":"20.8557239","longitude":"106.6610099"}}},"destination":{"vehicleStopover":true,"sideOfRoad":true,"location":{"latLng":{"latitude":"20.8351444","longitude":"106.7236489"}}},"travelMode":"two_wheeler","routingPreference":"traffic_unaware","polylineQuality":"high_quality","computeAlternativeRoutes":true,"routeModifiers":{"avoidTolls":true,"avoidHighways":true,"avoidFerries":true,"avoidIndoor":false}}
When origin set to B, it return shortest route with distanceMeters: 8909 .
This is the post data:
{"origin":{"vehicleStopover":true,"sideOfRoad":true,"location":{"latLng":{"latitude":"20.8351444","longitude":"106.7236489"}}},"destination":{"vehicleStopover":true,"sideOfRoad":true,"location":{"latLng":{"latitude":"20.8557239","longitude":"106.6610099"}}},"travelMode":"two_wheeler","routingPreference":"traffic_unaware","polylineQuality":"high_quality","computeAlternativeRoutes":true,"routeModifiers":{"avoidTolls":true,"avoidHighways":true,"avoidFerries":true,"avoidIndoor":false}}
I also try to call using online demo and it is the same.
I also try to change other parameters, it still return the same result.
But in Gmap app, it is the same when reverse origin and destination.

Related

Angular 13: 415 Error Unsupported Media Type, on Delete [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
my Services.ts
deteleComentario(id: number): Observable<any>{
return this.http.delete(this.myAppUrl + this.myApiUrl + id);
}
my list-Comment-Component.ts
eliminarComentario(id: any ){
this.comentarioService.deteleComentario(id).subscribe(data => {
this.getComentarios();
}, error => {
console.log(error);
}
);
}
And my Api, NetCore with Mysql it`s work fine in GET, POST, GET{ID}, PUT{ID}, DELETE{ID}
any suggestion what could be the problem
The 415 Unsupported Media Type is a client-side error that indicates the request entity has a media type that the server or resource does not support. The response code may still be returned if the contents of the request body were not supported by the server. For example, a server might support specific JSON bodies, but the payload contents didn't validate, perhaps because it was missing a required property.
For example, the client uploads an image that was not in one of the formats (e.g., JPEG, PNG), or a video that is not in an accepted format (e.g., MPEG). The best way to fix it is to remove the image or video and upload a file in one of those formats.
Please see documentation for more information.

Using events.patch in Google Apps script [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
I'm writing a Google apps script to update an event. I tried using the path API like below:
event_ins.setVisibility('private');
Logger.log('Making event %s %s private %s',calendarId, event_ins.summary, event_ins);
Calendar.Events.patch(event_ins,calendarId, eventID_ins);
I get the following error message:
11:28:30 AM Error HttpResponseException: Response Code: 404. Message: Not Found.
I tried using the update method instead
Calendar.Events.update(event_ins,calendarId,eventID_ins);
I'm still getting the same error.
The examples in Google's API documentation does not use Google script. I tried searching example code and I found similar usage. For instance this is from here :
event = Calendar.Events.patch(event, calendarId, eventId, {
sendNotifications: true
});
I would appreciate any help to get this working.

How do I get data from a web API? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I'm pretty basic at Perl, and I need to make a project for my university.
I want to download data from certain link, it is JSON data, so I know I have to use JSON::Parse module from CPAN.
But how to download content of link to my Perl variable? Should I use LWP get()?
Aren't you supposed to be learning Perl if it's a university project?
Anyway, your program will look something like this. It uses the LWP::Simple module to fetch the JSON data, and then JSON::Parse to process it into a Perl data structure
I've used printed the author value from each item of the array, as requested in your comment
use strict;
use warnings 'all';
use LWP::Simple 'get';
use JSON::Parse 'parse_json';
use constant URL => 'http://a.wykop.pl/observatory/entries/appkey,dJ4w7fXYpL';
my $json = get URL or die "Unable to get JSON data";
my $data = parse_json($json);
print "Authors:\n";
print " $_->{author}\n" for #$data;
output
Authors:
Snurq
AferaZaAfera
Devest
igorsped
Matt23
labla
poprawnie-niepoprawny
Parkero
Speed666
Xune
Gasior9
mikolajeq
Aztek2201
blogerbezbloga
Pan_wons
PanKaczucha
NieznanyAleAmbitny
dzika_kaczka_bez_dzioba
ilili
Bager
bmbcz01
hydrocyfolumpus
acarter
Doctor_Manhattan
strumienzgor

Import JSON document array / object to a Meteor Collection with correct _ids [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
What is the best way to import a 15,000 document json file of a format (but with a +30 foo fields)
[{"foo1":"foo1data1", "foo2":"foo2data1"}, {"foo1":"foo1data2", "foo2":"foo2data2"}...
{"foo1":"foo1dataN", "foo2":"foo2dataN"}])
to a Meteor collection?
I tried with mongoimport but that created ObjectID's instead of _id's and I could not make it work without autopublish, although other collections, created with Meteor, work just fine on client side.
Supposing the file is located on the server under pathToFile you can do something like this:
var fs = Npm.require("fs");
var Fiber = Npm.require("fibers");
fs.readFile(pathToFile, 'utf8', function (err, data) {
// handle error if there is some
data = JSON.parse(data);
Fiber(function () {
_.each(data, function (document) {
SomeMeteorCollection.insert(document);
});
}).run();
});
Please note that Fiber wrapper is required if you want call any meteor specific routines, for example collections API, within some nodejs asynchronous code.

A good google.maps geolocation api? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
Is there a google maps api that will allow you to pass in a location name and it will return coordinates that point to the location on googlemaps?
Here is the The Google Geocoding API
Here is a example request:
http://maps.googleapis.com/maps/api/geocode/xml?address=Berlin&sensor=false
You can filter the result: for geometry/location/lat and lng
<GeocodeResponse>
<status>OK</status>
<result>
<type>locality</type>
<type>political</type>
<formatted_address>Berlin, Deutschland</formatted_address>
[…]
<geometry>
<location>
<lat>52.5234051</lat>
<lng>13.4113999</lng>
</location>
<location_type>APPROXIMATE</location_type>
<viewport>[…]</viewport>
<bounds>[…]</bounds>
</geometry>
</result>
</GeocodeResponse>
Yup, need to use reverse geolocation. You can send an address or location string and it will give you an array of the possible lat/Long coordinates for it. These are GeocoderResults and normally the first one is what you want. Like, if you wanted the USA you could do
geocoder.geocode( {'address': 'USA' }, function(results, status) {
response($.map(results, function(item) {
var latlng = new google.maps.LatLng( item.geometry.location.lat(), item.geometry.location.lng());
//Do some action with the provided latlng
}));
});
Mappy also provide a same free service. Have a look to mappy.com and search for rest api.