Why distance matrix api returning the status "ZERO_RESULTS" even coordinates are correctly mentioned? - location

{
"destination_addresses" : [ "14.868924,79.873609" ],
"origin_addresses" : [ "14.843799,79.862726" ],
"rows" : [
{
"elements" : [
{
"status" : "ZERO_RESULTS"
}
]
}
],
"status" : "OK"
}
url for this above response is given below only change the API key to verify it.
https://maps.googleapis.com/maps/api/distancematrix/json?units=metric&origins=14.843799,79.862726&destinations=14.868924,79.873609&mode=walking&key=XXXX
Although bing distance calculation api is successfully returning distance for this same coordinates.

I reported this issues to Google issue tracker and after that they fixed it within 1 month approximately.
https://issuetracker.google.com/u/1/issues/38478121
Thanks

Related

How to create a multi-value tag metric gauge?

Already read this but with no lucky.
All examples I've found just show how to create a single value tag like this:
{
"name" : "jvm.gc.memory.allocated",
"measurements" : [ {
"statistic" : "COUNT",
"value" : 1.98180864E8
} ],
"availableTags" : [ {
"tag" : "stack",
"values" : [ "prod" ]
}, {
"tag" : "region",
"values" : [ "us-east-1" ]
} ]
}
But I need to create a multi value tag like this:
availableTags: [
{
tag: "method",
values: [
"POST",
"GET"
]
},
My code so far:
List<Tag> tags = new ArrayList<Tag>();
tags.add( Tag.of("test", "John") );
tags.add( Tag.of("test", "Doo") );
tags.add( Tag.of("test", "Foo Bar") );
Metrics.gauge("my.metric", tags, new AtomicLong(3) );
As you can see I think I can just repeat the key but this is not the case and the second parameter of Tag.of is a String and not a String Array.
I don't think this was the real intent of authors of these metering libraries - to provide a multi-value tag for a metric.
The whole point of metrics tags is to provide a "discriminator" - something that can be used later to retrieve metrics whose tag has a specific, single, value.
Usually, this value is used in metrics storage systems, like Prometheus, DataDog, InfluxDB and so on. And above this Grafana can incorporate a single tag value in its queries.
The only possible use case of such a request that I see is that it will be possible to see the metrics value in an actuator in a kind of more convenient way, but again it's not the main point of the whole capability here, so, bottom line I doubt that its possible at all.

Google places API - Can I separate out the output?

Hiting the endpoint:
https://maps.googleapis.com/maps/api/place/findplacefromtext/json?input=Hoboken%20NJ&fields=formatted_address,name&inputtype=textquery&key=xxxxxxxxxxxxxxxxxxx
Getting the result:
{
"candidates" : [
{
"formatted_address" : "New Jersey, USA",
"name" : "Hoboken"
}
],
"debug_log" : {
"line" : []
},
"status" : "OK"
}
What bugs me is that I can't find a way to separate out the region and country - Yes, I know I can parse the result myself. But is there an option I get shoot out to Google Places API to have the response separate out city/state(or region)/country in the returned JSON?
Something like:
{
"candidates" : [
{
"state" : "New Jersey",
"country" : "USA",
"name" : "Hoboken"
}
],
"debug_log" : {
"line" : []
},
"status" : "OK"
}
As far as I know, it isn't possible, you'll have to parse it. Places API is designed to search businesses and POIs at first place.
Google does have, however a geocoding API which seems to give out Postal Code, Country, State, Address, separetely.
There are also some free alternatives

How to read all data from druid datasource

I am using below json to read all data from a druid datasource.
But in the request threshold field/value is mandatory.
It returns number of rows specified in threshold.
{
"queryType" : "select",
"dataSource" : "wikiticker",
"granularity" : "day",
"intervals" : [ "1000/3000" ],
"filter" :null,
"dimensions" : [ ],
"metrics" : [ ],
"descending" : "false",
"pagingSpec" : {
"threshold" : 10000,
"pagingIdentifiers" : null
},
"aggregations" : [ ]
}
Is there any way to retrieve all the data by setting the threshold to some value that returns all the data from datasource.
For eg:if intervals column is set to [ "1000/3000" ] gets data from all intervals.
The distributed nature of the system makes it hard to have an exact count of rows per interval of time, therefor the answer is no. Also keep in mind that select query will materialize all the rows in-memory so you might want to avoid pulling all the data at once and use pagination spec.

Mongo says coordinates out of bounds

I have a Spring app thats connected to a mongo database, and am using the following code to get documents from a certain collection that are within a radius of a point on Earth:
"query" : {
"location" : {
"$geoWithin" : {
"$centerSphere" : [
[
37.33240731,
-122.03046898
],
0.0018924144710663706
]
}
}
}
Usually this works (for locations in england), however, for some reason these coordinates (in america) give this error:
'{ "ok" : 0.0, "errmsg" : "longitude/latitude is out of bounds, lng: 37.3323
lat: -122.031", "code" : 2 }
What could be causing this?
Faced the same problem while using spring data mongodb, the very silly mistake was the exchange of lat and long values.
Query query = new BasicQuery(
"{ location: { $geoWithin: { $centerSphere: [ [
-122.031,
37.3323
"+ rangeInMiles / 3963.2 +
" ] } }, visible : true, status : 'ACTIVE' }"
);

Google Places API Web Service shows photo_reference, but Javascript library doesn't

I'm building a basic places search page and I'm using the Google Places Javascript library for it (text search). I do get one "photo" element back, but I noticed that the "photo_reference" field is empty. Here a sample request:
var service = new google.maps.places.PlacesService(this.map);
service.textSearch({query: 'harbour bridge'}, this.callback.bind(this));
Repsonse:
{
"formatted_address":"Sydney Harbour Bridge, Sydney NSW, Australia",
"geometry":{
"location":{
"lat":-33.8523063,
"lng":151.21078710000006
}
},
"icon":"https://maps.gstatic.com/mapfiles/place_api/icons/generic_business-71.png",
"id":"e22913360d0b946d099c7a32a77a95e49f9ead66",
"name":"Sydney Harbour Bridge",
"photos":[{
"height":4000,
"html_attributions":["Jasper Straver"],
"width":6000
}],
"place_id":"ChIJ49XqJV2uEmsRPsTAF7eOlGg",
"rating":4.7,
"reference":"[...]",
"types":["point_of_interest", "establishment"],
"html_attributions":[]
}
If I do the same request using the web service, I get the photo_reference. Example:
https://maps.googleapis.com/maps/api/place/textsearch/json?key=[...]&query=harbour%20bridge
Response:
{
"formatted_address" : "Sydney Harbour Bridge, Sydney NSW, Australia",
"geometry" : {
"location" : {
"lat" : -33.8523063,
"lng" : 151.2107871
}
},
"icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/generic_business-71.png",
"id" : "e22913360d0b946d099c7a32a77a95e49f9ead66",
"name" : "Sydney Harbour Bridge",
"photos" : [
{
"height" : 4000,
"html_attributions" : ["\u003ca href=\"https://maps.google.com/maps/contrib/113178678511744469415/photos\"\u003eJasper Straver\u003c/a\u003e"],
"photo_reference" : "CmRdAAAAY-WUame_CRFnMFmUN4UlvFHI7o3tQOqXJxTkjQINgzMQOOheBzLPIm43dlIAIkhFyugFAw8fnf-ItEiUp1j48B23sCDFRtCWM123euhDif_P1jYkvFAjDrPxq1rCnmi2EhCt6LpVl5W-AKPLRkW_tzs6GhRlG4dx2CVuTNZZMFFo3eYMSFWzGg",
"width" : 6000
}
],
"place_id" : "ChIJ49XqJV2uEmsRPsTAF7eOlGg",
"rating" : 4.7,
"reference" : "[...]",
"types" : [ "point_of_interest", "establishment" ]
}
How come there is a difference between the JS and Web Services API? How can I get the photo_reference from the JS library? (I don't want to make a getDetails(...) request for each search result)
Thanks!
photo_reference is for the Google Places API Web Service. With the Places Javascript library you can just call getUrl on the elements of the photos array, e.g. place.photos[0].getUrl({maxWidth: 1000}).
Like the Web Service, search results won't have more than 1 photo.

Resources