SAP HANA, tell me where the center of Europe is
Last month Njal Stabell, SAP Mentor and Co-Founder at Neptune Software, told me he had learned from me that “Wrocław is the center of the Universe”. It was not exactly what I had said, but that triggered another interesting discussion about the center of …no, not the whole Universe, but… Europe.
Did you know that the first-ever center of Europe was calculated in 1775 by the royal cartographer Szymon Antoni Sobiekrajski? As the first person in history, he calculated the exact geographic center of Europe as the equal distances from the extreme points of Europe: in Portugal vs. Central Ural, in Norway vs. Southern Greece. Islands were not taken into consideration. According to his computation, it was 53°34′39″N 23°06′22″E. There is a monument commemorating that fact in Suchowola, a town in the north-eastern corner of Poland.
By Krzysztof Kundzicz – CC BY-SA 3.0, https://commons.wikimedia.org/w/index.php?curid=24706639
It was the first, but not the last “center of Europe”. Many others – in Lithuania, Belarus, Slovakia, Hungary, and Ukraine – appeared since then, claiming to be “the one and only”, building monuments, giving certificates to visitors, and even citing the Guinness Book of World Records as the proof!
And if some could not be the middle point of the European continent, they were trying at least to be the center of the European Union. The only problem here though is the constantly moving midpoint thanks to the EU growing, and more recently shrinking. The small town of Gädheim in Germany already has been announced to be the new center of EU after the Brexit.
But could we use SAP HANA’s geospatial capabilities to tell where the center of the European continent is, and finally close this dispute once and for all? That sounds like a good idea! [If you haven’t tried SAP HANA geospatial yet, it is very easy to get basics with tutorials: https://www.sap.com/developer/tutorials/hana-spatial-intro1-point.html]
After some research, I found the shapefile with Europe and other continents here: http://techcenter.jefferson.kctcs.edu/gis/data/default.html –> Continents. The downloaded zip file contained the shapefile that could be loaded into SAP HANA with Spatial Reference ID =
Updated on 2021-05-18: The aforementioned web site does not provide these files anymore. Please check my newer post SAP Tech Bytes meet #GeospatialTuesday: Import zipped shapefiles into SAP HANA Cloud using Database Explorer where to get it.
I used the schema
TESTGEO and the target table name was
continent when loading the shapefile. A quick check of the table content…
select "CONTINENT", "SHAPE".ST_asEWKT(), "SHAPE".ST_asSVG() from "TESTGEO"."continent"
… and the shape of Europe exported as SVG into the web browser (I modified SVG slightly to add yellow fill color):
Looks good, so let’s calculate the midpoint of this shape using the ST_Centroid() method in SAP HANA db.
select "CONTINENT", "SHAPE".ST_Centroid().ST_asWKT() from "TESTGEO"."continent"
Let’s now map the
POINT (28.249040348 55.854069296), which is 55°51’14.7″N 28°14’56.5″E somewhere in the northern part of Belarus:
Are we done? Can we update Wikipedia and publish the real “one and only” midpoint of the European continent?! Not, really :-/
The calculated point was the mathematical centroid of the multipoligon shape. Here I used the specific shape found on the Internet. And this shape is one of many possible ways to project spherical 3-dimensional Earth shape on 2D. Should I choose another projection, like the azimuthal equidistant projection from my previous blog, and the multipolygon representing the shape of Europe would be different, and so the centroid would be different as well.
But as well we were not that much off, as the point calculated here by SAP HANA is close to one of many European midpoints – the one calculated by Belorussian scientists in 2000, and then recalculated in 2008: 55°30′0″N 28°48′0″E, i.e.
POINT (28.8 55.5). And whereby the way you can get a certificate of visiting the Center of Europe as well. It is only 72.8km away from what we just calculated with SAP HANA!
select "CONTINENT", "SHAPE".ST_Centroid().ST_Distance(new ST_POINT ('POINT (28.8 55.5)',1000004326),'kilometer') as DistanceFrom from "TESTGEO"."continent" where "CONTINENT"='Europe'
Now, it is your turn to find some other projections of the European continent (or any other continent of your choice) and check what its mathematical center is. Have fun!
PS. And if you are interested to learn more about spatial processing with SAP HANA, then do not miss the openSAP course https://open.sap.com/courses/hsgs1!
PPS. Four months later I got back to the search of the true midpoint. You can find the second episode here: https://blogs.sap.com/2017/09/18/sap-hana-is-cet-time-zone-in-the-middle-of-europe/