Filter out null and/or 0,0 results
jamesastound opened this issue · 8 comments
When address results are null, coordinates default to Null Island (Lat 0, Lon 0).
This seemed like a quick fix so I hopped in and got this one taken care of. It's out for review as #108. Thanks for catching this and hopefully this is worthy of getting patched.
I have a null issue--not sure if it's related. A CVS is being shown on a rural road near Ames, IA.
I'm guessing it's meaning to be this location (Google maps) which is not shown on the map.
I have a null issue--not sure if it's related. A CVS is being shown on a rural road near Ames, IA.
...
Taking a look at this. Since it's actually showing in IA and now in the middle of the ocean I would assume it's getting some sort of position data. Even if it's incorrect. As for the null arguments. I'll check up on that and get back to you
but tl;dr, pretty sure this not related.
Alright @patrickdemers6 I've narrowed this down a bit for you.
It appears that the null info you're seeing is actually the lack of address and postal code. Not related to the position. I've only done work on the front end so as far as position being off that would have to do with the source of our position data. Not the way we render it.
This CVS as our database is relaying it to us is at 42.0486, -93.6945
, so that's where it ends up on the map. Honestly I took a look on google maps and there is a building at that spot. I don't live in Iowa so I can't verify anything firsthand but I would argue based on the size and construction of the building it may actually be a CVS distribution site, even if it's not a pharmacy.
Either way I see this as an edge case in terms of source data, but definitely not related to the code or the platform.
Hi all, sorry I haven't been keeping up with these issues! But thanks for looking into all of this! I've tried to address the underlying issue with 93ff74d so that all CVS locations get geocoded as they come in, which should hopefully eliminate the null locations showing up in the ocean. It's also worth noting that the locations of CVS aren't really accurate, since CVS just gives us city names, not actual store locations. So that's also why the locations can be in random locations. So while this maybe isn't ideal, I'm hoping that at least having them geocoded to an approximate area should eliminate the issue of these locations being 7,000 miles away so they always show up at the bottom of the list if you are searching by location.
I still need to deal with some odd cases that aren't geocoding, but I'm hoping that as new CVS locations get added this won't keep being a problem.
The here.com API allows place name searching in a general lat/lon location.
https://places.ls.hereapi.com/places/v1/autosuggest?at=44.94473206440632,-93.14358109907948&q=cvs/pharmacy&apiKey=
{
"results": [
{
"title": "CVS/pharmacy",
"highlightedTitle": "<b>CVS/pharmacy</b>",
"vicinity": "1040 Grand Ave<br/>St Paul, MN 55105",
"highlightedVicinity": "1040 Grand Ave<br/>St Paul, MN 55105",
"position": [
44.9398,
-93.14427
],
"category": "pharmacy",
"categoryTitle": "Chemist's",
"href": "https://places.ls.hereapi.com/places/v1/places/8409zvz8-d9c5d662ce49449a97cf84fff014b120;context=Zmxvdy1pZD02NjA2OTZlZi1kYTdlLTUzMTktYWMyMy1mZDRmNDJlYzRjMDJfMTYxNzQ1MDQzMTY4OF8zMjA5XzY5OTcmcmFuaz0w?app_id=4aGEu4EVFTTUXj2vQNCY&app_code=EmqSc9p6YMb_Tv26gP-eTQ",
"type": "urn:nlp-types:place",
"resultType": "place",
"id": "8409zvz8-d9c5d662ce49449a97cf84fff014b120",
"distance": 551,
"chainIds": [
"1444"
]
},
{
"title": "CVS/pharmacy",
"highlightedTitle": "<b>CVS/pharmacy</b>",
"vicinity": "1300 University Ave W<br/>St Paul, MN 55104",
"highlightedVicinity": "1300 University Ave W<br/>St Paul, MN 55104",
"position": [
44.95322,
-93.15532
],
"category": "pharmacy",
"categoryTitle": "Chemist's",
"href": "https://places.ls.hereapi.com/places/v1/places/840jx7ps-c1d7ad7a338a0b57fae0808b79270f9d;context=Zmxvdy1pZD02NjA2OTZlZi1kYTdlLTUzMTktYWMyMy1mZDRmNDJlYzRjMDJfMTYxNzQ1MDQzMTY4OF8zMjA5XzY5OTcmcmFuaz0x?app_id=4aGEu4EVFTTUXj2vQNCY&app_code=EmqSc9p6YMb_Tv26gP-eTQ",
"type": "urn:nlp-types:place",
"resultType": "place",
"id": "840jx7ps-c1d7ad7a338a0b57fae0808b79270f9d",
"distance": 1322,
"chainIds": [
"1444"
]
},
{
"title": "CVS/pharmacy",
"highlightedTitle": "<b>CVS/pharmacy</b>",
"vicinity": "499 Snelling Ave N<br/>St Paul, MN 55104",
"highlightedVicinity": "499 Snelling Ave N<br/>St Paul, MN 55104",
"position": [
44.956,
-93.1675
],
"category": "pharmacy",
"categoryTitle": "Chemist's",
"href": "https://places.ls.hereapi.com/places/v1/places/8409zvxz-6ce6e61e46a24dc7affd04e03a50d6d8;context=Zmxvdy1pZD02NjA2OTZlZi1kYTdlLTUzMTktYWMyMy1mZDRmNDJlYzRjMDJfMTYxNzQ1MDQzMTY4OF8zMjA5XzY5OTcmcmFuaz0y?app_id=4aGEu4EVFTTUXj2vQNCY&app_code=EmqSc9p6YMb_Tv26gP-eTQ",
"type": "urn:nlp-types:place",
"resultType": "place",
"id": "8409zvxz-6ce6e61e46a24dc7affd04e03a50d6d8",
"distance": 2265,
"chainIds": [
"1444"
]
},
However, if we're just getting the City Name, that wouldn't work for cities with multiple CVS locations, like the above example. City (vs ocean) is probably sufficient and preferable over mapping an actual CVS location, that could be incorrect.Probably not enough people zooming into street-level to justify doing such lookups in cities with one location result. But wanted to share in case it becomes useful in the future.
Hello,
^ All CVS locations that I have encountered have null addresses and zip codes http://prntscr.com/11vzib4. Although CVS does not directly provide addresses for its locations, I found online that it may be possible to retrieve them using the Directions API. This could be done perhaps by requesting directions with the CVS as both the origin and the destination? If this is not possible, then maybe another location in the same city could be used as the destination address. The addresses of both the origin and destination are in the json response. Each CVS could then be geocoded so they appear at their exact locations on the map instead of the current estimates.
I am not positive that using the Directions API for this is a viable solution, and it still could not differentiate between two CVS's in the same city. Regardless, it might be worth looking into. If there really is no way to get these addresses the "null" lines could just be deleted for aesthetics - the addresses can be easily found online.
Directions API:
https://developers.google.com/maps/documentation/directions/overview
Depreciated