1

我尝试构建一个具有共享功能的应用程序,以在 facebook 上绘制路线作为健身帖子。我认为所有的东西都已经涵盖了在地图上绘制路线。

<!-- Facebook opne graph meta data start -->

<!-- Standard Open Graph object properties -->
<meta property="fb:app_id"      content="FACEBOOK_APP_ID" /> 
<meta property="og:type"        content="fitness.course" /> 
<meta property="og:url"         content="http://sample.url" /> 
<meta property="og:title"       content="User's Diary" /> 
<meta property="og:description" content="User rode 8.0km for 11m 36s" />
<meta property="og:image"       content="http://14.63.224.224/img/logo@220.png" /> 

<!-- Other Open Graph properties -->
<meta property="fitness:distance:value" content="8.0" /> 
<meta property="fitness:distance:units" content="km" /> 
<meta property="fitness:duration:value" content="636" /> 
<meta property="fitness:duration:units" content="s" /> 
<meta property="fitness:speed:value"    content="12.3065" /> 
<meta property="fitness:speed:units"    content="m/s" /> 
<meta property="fitness:calories:value" content="181.7" /> 

<!-- ActivityDataPoint 0 -->
<meta property="fitness:metrics:location:latitude" content="37.51844" />
<meta property="fitness:metrics:location:longitude" content="126.9918" />
<meta property="fitness:metrics:location:altitude" content="16.61127" />

<!-- ActivityDataPoint 1 -->
<meta property="fitness:metrics:location:latitude" content="37.51769" />
<meta property="fitness:metrics:location:longitude" content="126.9908" />
<meta property="fitness:metrics:location:altitude" content="13.85767" /><

!-- ActivityDataPoint 2 -->
<meta property="fitness:metrics:location:latitude" content="37.51714" />
<meta property="fitness:metrics:location:longitude" content="126.9897" />
<meta property="fitness:metrics:location:altitude" content="22.03296" />

<!-- ActivityDataPoint 3 -->
<meta property="fitness:metrics:location:latitude" content="37.51693" />
<meta property="fitness:metrics:location:longitude" content="126.9887" />
<meta property="fitness:metrics:location:altitude" content="23.54077" />

<!-- ActivityDataPoint 4 -->
<meta property="fitness:metrics:location:latitude" content="37.51688" />
<meta property="fitness:metrics:location:longitude" content="126.9878" />
<meta property="fitness:metrics:location:altitude" content="27.52216" />

<!-- Facebook opne graph meta data end -->

我的问题是

  1. 我需要什么样的指标属性才能像 Nike Run 那样绘制正确的路线?

  2. 是否有某种顺序来列出位置值的元数据?

4

2 回答 2

2

这是一个古老的问题,但对于寻找解决方案的人来说:

您应该为每个点添加 Fitness:metrics:timestamp 属性以查看路线:

<!-- ActivityDataPoint 0 -->
<meta property="fitness:metrics:location:latitude" content="37.51844" />
<meta property="fitness:metrics:location:longitude" content="126.9918" />
<meta property="fitness:metrics:location:altitude" content="16.61127" />
<meta property="fitness:metrics:timestamp" content="2011-01-26T00:00" />

<!-- ActivityDataPoint 1 -->
<meta property="fitness:metrics:location:latitude" content="37.51769" />
<meta property="fitness:metrics:location:longitude" content="126.9908" />
<meta property="fitness:metrics:location:altitude" content="13.85767" />
<meta property="fitness:metrics:timestamp" content="2011-01-26T00:30" />
于 2013-09-09T09:33:13.623 回答
0

我自己找到了答案。

要在 facebook 地图(?)上绘制路线,您必须为每个活动数据点提供位置(纬度、经度)、距离(值、单位)、步速(值、单位)。而且由于您的骑行、跑步和任何通常有很多地理点的课程,您总是最好有一个单独的课程元数据页面。Facebook实际上推荐它。使用适当的单位也很重要,但有时你找不到。然后使用 m/s 代替 mph。Facebook 将通过 MPH 处理事情以展示其价值。

我附上了下面的示例代码。希望它可以帮助像我这样的人。

课程对象 HTML

<!-- Standard Open Graph object properties -->
<meta property="fb:app_id" content="FACEBOOK_APP_ID" /> 
<meta property="og:type" content="fitness.course" /> 
<meta property="og:url" content="SAMPLE_CANONICAL_URL" /> 
<meta property="og:title" content="ABC's Diary" /> 
<meta property="og:description" content="ABC's burned 0 kcal for 3m 30s. The best speed was 0.0. " />
<meta property="og:image" content="SAMPLE_CANONICAL_URL/img/img.png" /> 

<!-- Other Open Graph properties -->
<meta property="fitness:distance:value" content="0.0" /> 
<meta property="fitness:distance:units" content="km" /> 
<meta property="fitness:calories" content="0" /> 
<meta property="fitness:duration:value" content="150" /> 
<meta property="fitness:duration:units" content="s" /> 
<meta property="fitness:speed:value" content="0.0000" /> 
<meta property="fitness:speed:units" content="m/s" /> 

<link rel="opengraph" href="SAMPLE_CANONICAL_URL"/>

地理点对象(rel="opengraph")

<!-- Special type for an Open Graph metadata object -->
<meta property="og:type" content="metadata" />

<!-- Pointer to the source URL -->
<link rel="origin" href="http://SAMPLE_CANONICAL_URL_FOR_COURSE" />

<!-- ActivityDataPoint 0 -->
<meta property="fitness:metrics:location:latitude" content="37.43357" />
<meta property="fitness:metrics:location:longitude" content="127.1585" />
<meta property="fitness:metrics:location:altitude" content="110.3485" />
<meta property="fitness:metrics:distance:value" content="0" />
<meta property="fitness:metrics:distance:units" content="km" />
<meta property="fitness:metrics:pace:value" content="0" />
<meta property="fitness:metrics:pace:units" content="s/m" />

<!-- ActivityDataPoint 1 -->
<meta property="fitness:metrics:location:latitude" content="37.43357" />
<meta property="fitness:metrics:location:longitude" content="127.1585" />
<meta property="fitness:metrics:location:altitude" content="108.1185" />
<meta property="fitness:metrics:distance:value" content="0" />
<meta property="fitness:metrics:distance:units" content="km" />
<meta property="fitness:metrics:pace:value" content="0" />
<meta property="fitness:metrics:pace:units" content="s/m" />
于 2013-05-11T06:06:17.010 回答