Overlapping geographic regions

HI. Looking for advice on crafting an intersect query I am trying match users project required region (centerpoint and radius) to businesses region(s) (center point and radius) and return a list of businesses that overlap even slightly. An example is in the image below .
User 1 match would return results Business 1 and Business 3,
User 2 would only return Business 3.
Business 2 would not be returned for any.
Search results would appear in a repeating group and the user would then select a business to initiate a communication flow

User (Datatype) creates Project (Datatype)each project has a center point and radius.
Business (Data Type) may have multiple Regions (Datatype) center points with radius.

Data structure

1 Like

Hi there,

Any specific reason it needs to be overlapping rather than just a max distance value between the two points?

Hi Oliver I am not sure I understand your question exactly or how a max distance value would work. I am certainly open to suggestions! . In this case the user is defining a region in which a project might be undertaken. The project might be anywhere in that region, The businesses work in a defined region but can work anywhere in that region, so my thought is that as long as there is some overlap like a Venn diagram the two sides process are a match.

1 Like

With the google maps API you can send 2 locations and get a distance between them back (i think also a travel time calc too if you wanted it).

So the way I would do it is let the business say within what distance they will work and let the client say what distance they will work:

Business 2kms + client 3kms = 5kms max distance to work with, so as long as the result of place 1 and place 2 distance is less than 5kms then you would display that result. From my perspective thats the way I would look at it if we are assuming the business has a “service area” and the client is willing to travel a specific distance.

Normally people would just be looking at the businesses service area if its a question of delivery etc, so this is just adding one more parameter. Intrigued as to the use case here for both parties to have a distance they will travel?

Thanks for taking the time to look at this Oliver. Really appreciated. Not delivery or travel related. The use case is more of a real estate play. E.g. I want to buy a property, invest in a property, develop a property , hire an agent to manage my property within a region . They are being matched up with a real estate agent or other type of business who practices in that region. While I understand business might travel out of a defined region if the money is good enough, there are real estate associated businesses’ that specialize in a region because they know that market and have established relationships in that region.

That makes complete sense and is a good idea!

The distance between the two parties above definitely works IMO, does that make sense in terms of how to achieve it? You can use the API or I think some of the maps plugins might be able to do the distance calculations for you.

Since a lot of this info will be fairly static you might want to store these lists of “professionals” in the users area and only update it periodically, but that’s more of a scaling issue for later.

All make sense where to go with it from here?

It does Oliver, I guess that where the radius value comes in. I am struggling formatting the specific query that matches them up

Take a look at this docco - نظرة عامة على واجهة برمجة التطبيقات لمصفوفة المسافات  |  Distance Matrix API  |  Google for Developers

Also I would suggest potentially looking at driving distance instead of as the bird flies, for anywhere with large bodies or water / mountain ranges the travel time could massively blow out to specific areas which are the same distance technically etc.