Happy #MapInfoMonday! Another new week and time for another tip for MapInfo Pro.

Today, we will focus on one specific function that comes in handy when trying the estimate the coverage of for example your shops:

`ProportionOverlap`

.

We have

earlier looked at using isochrones to calculate an estimated customer area by showing the area that can reach your retail shop within a given amount of time.

Now I'll shop you have you can use

`ProportionOverlap`

to estimate the number of people living within this area.

#### The Concept of Proportion

First, let us have a look at the general idea behind this.

In most cases, population and other demographic information is stored at either a postal or an administration level using a polygon. In the map below, these postal areas are represented by the red rectangles. Of course, these boundaries are rarely that rectangular. We "know" or our census tells us that within the top-left of these rectangles, there live 1,500 people, within the top-center there are 950 people, and so on.

The green ellipse is our area of interest, the isochrone around our store. Again these are rarely found so smooth in real life.

Now to estimate the total number of people living within the green ellipse, we need to apply some proportion calculation. This is where the

`ProportionOverlap`

function comes into play.

This function can tell us how much of the top-left rectangle is "overlapped" by the green ellipse in percentage. Let's say that's around 9%.

Knowing that 9% of the boundary is within our isochrone, we can also estimate that 9% of the people live within that part and so we can estimate that our area of interest has 135 people within the top-left.

Now we can continue calculating these for the other populated areas.

This gets a lot easier when you can use a SQL statement to do this for you.

#### The ProportionOverlap function

The function returns a number that indicates what percentage of one object is covered by another object. You can call this function from the MapBasic window in MapInfo Pro and use it in SQL statements.

ProporationOverlap() only works on closed objects. If both objects are not closed (such as points and lines), then you may see an error message. Closed objects are objects that can produce an area, such as regions (polygons).

**Syntax**`ProportionOverlap( `*object1*, *object2* )

`object1 `

is the bottom object, and it is a closed object.
`object2`

is the top object, and it is a closed object.

**Return Value**The function returns a float value equal to

`AreaOverlap( `*object1*, *object2* ) / Area( *object1* )

.

#### Using it in MapInfo Pro

Below you can see a more realistic example. The red and white lines depict postal sectors from the UK stored in the table Population. The blue polygon is a 10-minute isochrone around a shop stored in the table Drivetime.

As a first step, I am creating a query that extracts the name of my shop, the name of the postal sector, and single population count, and the proportional overlap value. The query looks like this where my join condition is that the objects need to intersects:

`Select dt.Name, pop.Postsect, pop.UKURP001`

` , ProportionOverlap(pop.Obj, dt.Obj) "PropOverlap"`

`From Population As "pop", drivetime As "dt"`

`Where dt.Obj Intersects pop.Obj`

`Into Selection`

The order of the objects used in the

`ProportionOverlap`

function is important.

The query result looks like this:

As you can see, the proportional overlapping value is a decimal value less than or equal to one. The closer to 1, the bigger the overlap.

In order to calculate the population within the overlapped area, I only have to multiply the population value with the proportional overlapping value:

`Select dt.Name, pop.Postsect, pop.UKURP001`

` , ProportionOverlap(pop.Obj, dt.Obj) "PropOverlap"`

` , pop.UKURP001 * ProportionOverlap(pop.Obj, dt.Obj) "UKURP001_Overlap"`

`From Population As "pop", drivetime As "dt"`

`Where dt.Obj Intersects pop.Obj`

`Into Selection`

As you can see in the map above, the query returns the full postal sector by default but using the new Object keyword that was added to MapInfo Pro v2019, I can limit the result to return the actual overlapped part of the postal sector by creating a derived spatial object:

`Select dt.Name, pop.Postsect, pop.UKURP001`

` , ProportionOverlap(pop.Obj, dt.Obj) "PropOverlap"`

` , pop.UKURP001 * ProportionOverlap(pop.Obj, dt.Obj) "UKURP001_Overlap"`

` , Overlap(pop.Obj, dt.Obj) Object`

`From Population As "pop", drivetime As "dt"`

`Where dt.Obj Intersects pop.Obj`

`Into Selection`

In the map below, I have selected one of the overlapping polygons created by the query. You can see that it follow the blue polygon, the isochrone. And that it is also cut by the red/white lines, the postal sectors.

I the example above, I calculated the population values for each postal sector, but I can also aggregate the data and summarize the values for the isochrone:

`Select dt.Name, Sum(pop.UKURP001) "UKURP001"`

` , Sum(pop.UKURP001 * ProportionOverlap(pop.Obj, dt.Obj)) "UKURP001_Overlap"`

`From Population As "pop", drivetime As "dt"`

`Where dt.Obj Intersects pop.Obj`

`Group By dt.Name`

`Into Selection`

As I'm grouping by the name of the isochrones which would match my stores, it doesn't make sense to keep any data referring back to a single postal sector such as the name and the polygon.

The final result shows me the total population value for the postal sectors intersecting the isochrone, and the proportional population within the overlapping areas.

I have only used a single value but you can of course extract as many population values as you want to and calculate the proportional value of these.

I hope you have enjoyed this article. There's a new one coming next week. Enjoy the rest of your Monday.

------------------------------

Peter Horsbøll Møller

Principal Presales Consultant | Distinguished Engineer

Precisely | Trust in Data

------------------------------