Collect Maps In Notion: Automatically Find Latitude And Longitude

notion-formula-maps-1.png

🗺 Map Coordinates

There are myriad ways of using Notion to collect and record data. Collecting maps is one way I find very interesting. After playing around with the Save to Notion extension to save google maps, I sought to extract the latitude and longitude coordinates embedded in a google maps url into separate properties in a Notion database. I achieve this extraction using formulas. Here’s how it works.

The Database In Action: Saving Maps

 

ConfigurE The Database In Notion

There are four properties in my maps database. Before connecting to the Save to Notion form, this database needs to be made:

Screen Shot 2021-04-12 at 8.35.28 PM.png
  • Latitude: formula

  • Longitude: formula

  • Parent Location: formula

  • link: url

 

Find The Latitude And Longitude From A Google Maps URL

These formulas rely on just one other property. That is a link property with the google maps url. It is called “link.”

Latitude: Formula property

if(not empty(prop("Place")), if(toNumber(replace(replace(replace(replace(prop("link"), ".*/@", ""), "/data=.*", ""), "(,[^,]*)$", ""), ",.*", "")) < 0, replace(replace(replace(replace(replace(prop("link"), ".*/@", ""), "/data=.*", ""), "(,[^,]*)$", ""), ",.*", ""), "-", "") + "º S", replace(replace(replace(replace(prop("link"), ".*/@", ""), "/data=.*", ""), "(,[^,]*)$", ""), ",.*", "") + "º N"), "")

Longitude: Formula property

if(not empty(prop("Place")), if(toNumber(replace(replace(replace(replace(prop("link"), ".*/@", ""), "/data=.*", ""), "(,[^,]*)$", ""), ".*,", "")) < 0, replace(replace(replace(replace(replace(prop("link"), ".*/@", ""), "/data=.*", ""), "(,[^,]*)$", ""), ".*,", ""), "-", "") + "º W", replace(replace(replace(replace(prop("link"), ".*/@", ""), "/data=.*", ""), "(,[^,]*)$", ""), ".*,", "") + "º E"), "")

Find Parent Location From A Google Maps URL

This formula will tell me what country or region a particular city resides.

Parent Location: Formula property

replaceAll(replace(replaceAll(replaceAll(replace(replace(replace(prop("link"), "/@.*", ""), ".*place/", ""), ".*?,+", ""), "[0-9]", ""), ",", ""), ".*?[+]", ""), "[+]", " ")

 

Configure Save To Notion Form

I'm using Save to Notion extension to collect maps from Google Maps. How my form is configured in the extension is shown below:

  • Step 1: Locate Add to: Find your database to collect maps

  • Step 2: Check off Clip Page Content. This will save a map embed to the body of the page

Screen Shot 2021-04-12 at 7.40.30 PM.png
Untitled_Artwork+40.png

Extra Tip: The latitude and longitude, of course, are approximate. Moving the map in the browser before saving with your cursor will alter these coordinates.

 

Further Reading