IVIURRAY / strava2notion

Import Strava information to Notion
43 stars 11 forks source link

Add Map image #5

Open almeida-andre opened 3 years ago

almeida-andre commented 3 years ago

Hi! Great job! Worked fine here. I tried to add map image but without success.

Added new variable in schema: "9Jv$": {"name": "Map", "type": "image"}, Do you know Notion's type for image column?

And a new row in notion_api row.set_property("map", data.map)

Missing something here.

IVIURRAY commented 3 years ago

Hey, I'm glad it worked for you! - I'll have to do some searching but I'm sure image won't be too difficult to add...I'll see if I can work it out

IVIURRAY commented 3 years ago

So I've done some research and it is not as simple as just importing the map image .png .jpeg file for example.

Strava store the map data as a Polyline for each activity. Example, of that map data is below:

  "map" : {
    "id" : "a1410355832",
    "polyline" : "ki{eFvqfiVqAWQIGEEKAYJgBVqDJ{BHa@jAkNJw@Pw@V{APs@^aABQAOEQGKoJ_FuJkFqAo@{A}@sH{DiAs@Q]?WVy@`@oBt@_CB]KYMMkB{AQEI@WT{BlE{@zAQPI@ICsCqA_BcAeCmAaFmCqIoEcLeG}KcG}A}@cDaBiDsByAkAuBqBi@y@_@o@o@kB}BgIoA_EUkAMcACa@BeBBq@LaAJe@b@uA`@_AdBcD`@iAPq@RgALqAB{@EqAyAoOCy@AmCBmANqBLqAZkB\\iCPiBJwCCsASiCq@iD]eA]y@[i@w@mAa@i@k@g@kAw@i@Ya@Q]EWFMLa@~BYpAFNpA`Aj@n@X`@V`AHh@JfB@xAMvAGZGHIDIAWOEQNcC@sACYK[MSOMe@QKKKYOs@UYQISCQ?Q@WNo@r@OHGAGCKOQ_BU}@MQGG]Io@@c@FYNg@d@s@d@ODQAMOMaASs@_@a@SESAQDqBn@a@RO?KK?UBU\\kA@Y?WMo@Iy@GWQ_@WSSGg@AkABQB_Ap@_A^o@b@Q@o@IS@OHi@n@OFS?OI}@iAQMQGQC}@DOIIUK{@IUOMyBo@kASOKIQCa@L[|AgATWN[He@?QKw@FOPCh@Fx@l@TDLELKl@aAHIJEX@r@ZTDV@LENQVg@RkA@c@MeA?WFOPMf@Ej@Fj@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~DfGc@bIOsGmCcEiD~@oBuEkFhBcBmDiEfAVuDiAuD}NnDaNiIlCyDD_CtJKv@wGhD]YyEzBo@g@uKxGmHpCGtEtI~AuLrHkAcAaIvEgH_EaDR_FpBuBg@sNxHqEtHgLoTpIiCzKNr[sB|Es\\`JyObYeMbGsMnPsAfDxAnD}DBu@bCx@{BbEEyAoD`AmChNoQzMoGhOwX|[yIzBeFKg[zAkIdU_LiHxK}HzEh@vM_BtBg@xGzDbCcF~GhArHaIfByAhLsDiJuC?_HbHd@nL_Cz@ZnEkDDy@hHwJLiCbIrNrIvN_EfAjDWlEnEiAfBxDlFkBfBtEfDaAzBvDKdFx@|@XgJmDsHhAgD`GfElEzOwBnYdBxXgGlSc@bGdHpW|HdJztBnhAgFxc@HnCvBdA"
  },

Therefore, we're going to need to take this summary_polyline attribute and transpose that onto a map and then convert that into an image to save down into Notion.

This package might help the decoding of the string to coordinates: https://pypi.org/project/polyline/ Then we could use OpenCV to paste in the polylines: https://www.geeksforgeeks.org/python-opencv-cv2-polylines-method/

Seems like a decent feature to have, it might take some time to code up though.