How to find if a location is part of another? - api

I am building an app where users can find events within a given location.
For example, if the given location is Europe, it should return all events with locations within Europe.
I have no idea how to go at it, if there is an API that I can use or anything.
Any suggestions?

Related

In magento 2, zip code text box to search the store available or not

I am new to Magento.
I want a text box where i can type the zip code and if the store available in that location then i need to show the products of that particular store otherwise we need to show that "the store is not available in particular location".
The following is the example site. i want it as it is.
this site prompts for users zip location .after it will display stores of that particular.
Click on this link to see the working example
how do i do this . Do i need to install a module ?
Follow Some Steps:
You need an entity 'store' that is bound to a geo location.
You need to create a multi select attribute which values are located (using a
source model) with these stores. This way, you can attach a single product to
multiple stores (one to many relation)
Then you need some sort of external API to convert a postcode entered by the
customer to a geo location. I assume the Google Maps API can do this. It would
be best to handle this server side.
Then you need the math to calculate the distance between 2 geo locations in
your database query (probably enough to find on that subject on Google) and
filter your product collection on that.
Once you have the collection you have the power.
The external API will probably have a request threshold so you might have to
pay for that (depending on the traffic).
You need to determine the radius of maximum distance between 2 geo locations.
In a small country like the Netherlands stores could be a couple of km's apart
from each other, whilst in the United States it's not uncommon to have stores
tens or hundreds of km's from each other.
**Best Of Luck For Your Project**

Microsoft Graph API List Locations

Hi I am having trouble finding any way to list locations so I can create an event and add a location to it.
There is a list of known locations that should be available shouldn't there be?
https://graph.microsoft.io/en-us/docs/api-reference/v1.0/resources/location
I'm not sure that listing known locations is available, so we'll need to be creative on this one.
You could get a list of existing calendar events and only select the locations property (what you linked to). If you then filter these client side to remove duplicates, you can get a decent list of known locations. The down side is that if a room is now available but has never been used, it won't appear in this list. Also, this is only for one user so another idea is querying a different (or multiple) calendars. For me, the following snippet returns around 247 unique locations.
https://graph.microsoft.com/v1.0/me/events?$select=location&$top=500
With the Graph JavaScript SDK this looks like:
client
.api('/me/events')
.select('location')
.top(500)
.get((err, res) => {
var locations = res.value
.map((x) => x.location.displayName) //only get the displayName
.filter((v, i, a) => a.indexOf(v) === i) // remove duplicates
});
There's also some existing threads about listing conference rooms.
So We decided not to use the graph API at all. It is not ready I actually cannot believe this is an oversight on Microsoft's part. Any organization's core problem when it gets to SME size is booking a room. We opted to use the Office 365 SDK,ADAL and Outlook and use a convoluted way to solve the problem that involves either checking the calendar or checking your inbox for the room being booked or not. Then we opted to figure out whether the room was busy or not using the preview availability Api.

One signal - create segment to push to recent location

I would like to, via OneSignal REST API :
filter the push to users in a certain location (as in the doc) but it lacks sample code/relevant routes. The steps would be :
store tags for users (documented here, this is fine)
creating a segment (I don't see this in the docs)
push by filtering by segment (this is covered here)
Similarly I would like to be able to filter the push to users that visited a location in a certain date range (ex. last week, last month...). I am not completely sure this is possible using only OneSignal.
The minimum I would need is how to create a segment with OneSignal.
Edit : looks like there is a way in the dashboard, but I need to do it programmatically.
(I help work on OneSignal) OneSignal does not support programmatically targeting by a location at this time but we're planning on adding support for this in the near future.
One way to do some of this until then would be to provide the name or position of a location as tags. For instance you could use the tags lat=41.123, lon=55.331, then target users programmatically where the tags are greater than and less than the ranges you specify.
OneSignal does not provide built-in functionality to target by historical locations and we do not plan to add support for this, but you may be able to use tags to achieve your desired result.
Note that OneSignal does allow you to target by Player ID, so you could always store your users' Player IDs in your own system and do the calculation of who should receive a notification on your own.

How to get the user's own location on a Foursquare checkin from the API?

I'd like to know if the Foursquare API allows you to get at the user's own location during a checkin, rather than the location of the venue itself. For most venues the difference is negligible, but if someone's checked into, say, Yosemite National Park, their actual location may vary wildly. I'd like to know where they were when they checked in.
The API's Checkin endpoint has two relevant attributes: venue and location. The location information within venue is (obviously) relevant only to that venue (where the venue is located). In most cases, this appears to be the only location information included. The location attribute is only included for venueless checkins, but otherwise includes the user's own location. It seems to me the latter should always be available, even if a venue is specified.
Am I missing something? Is there a (different) way to get at the user's own location via the API for a regular checkin?
You cannot retrieve a user's physical lat/lng for a check-in. It's not exposed anywhere in the API.

limit address search by distance

I recently joined a team working on an application that maintains listings with addresses. The user searches, and includes their zipcode, and the application displays the distance to each listing. Currently we use the Google Maps API for this. Reading through questions here on StackOverflow seem to suggest that this is the best way of doing things:
php/mysql zip code proximity search
Search engine by distance
However, while reading through the API documentation, this seems to be expressly forbidden unless we also show a map for each result (and possibly also for each result we filter out, depending on how you read the following statement):
Use of the Distance Matrix API must relate to the display of information on a Google Map; for example, to determine origin-destination pairs that fall within a specific driving time from one another, before requesting and displaying those destinations on a map. Use of the service in an application that doesn't display a Google map is prohibited.
( https://developers.google.com/maps/documentation/distancematrix/ )
What's the best way to accomplish this without running afoul of any API terms?
do you consider the Geo::PostalCode module (perl)? It uses maxmind database to calculate distances between locations (and there is bind in different languages).