{"id":711,"date":"2022-05-23T17:57:52","date_gmt":"2022-05-23T15:57:52","guid":{"rendered":"https:\/\/sigeo.cerege.fr\/?p=711"},"modified":"2022-05-23T18:03:24","modified_gmt":"2022-05-23T16:03:24","slug":"use-reach-m2-with-phantom-4-pro","status":"publish","type":"post","link":"https:\/\/sigeo.cerege.fr\/?p=711","title":{"rendered":"Use Reach M2 with Phantom 4 Pro"},"content":{"rendered":"\n<p>dataset : <\/p>\n\n\n\n<p>photos with timestamps<\/p>\n\n\n\n<p>UBX from M2 and from base station<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>Processing:<\/p>\n\n\n\n<p>1- Post-Process base station and get corrected coordinates<\/p>\n\n\n\n<p>2- with Emlid Studio (or RTKLib) calculate events (triggers) positions from UBX<\/p>\n\n\n\n<p>as output one gets an &#8230;._events.pos file that gives corrected coordinates for each event together with a timestamp<\/p>\n\n\n\n<p>3- extract timestamps from exif of pictures<\/p>\n\n\n\n<p>use exiftool with this command<\/p>\n\n\n\n<p>exiftool -n -csv -filemodifydate -api TimeZone=UTC *.JPG &gt; metadata.csv<\/p>\n\n\n\n<p>the output file &#8220;metadata.csv&#8221; gives the name of the picture and the timestamp in UTC format<\/p>\n\n\n\n<p>4- Merge &#8230;_events.pos and pictures events<\/p>\n\n\n\n<p>For now I&#8217;ve got this ugly Python script:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#! \/usr\/bin\/env python\n\n\"\"\"\nUpdate Emlid Reach Survey points with PPK position output from RTKLIB\nDavid Shean\ndshean@gmail.com\nEdited to fix Pandas datetime\/Timestamp tz issues, and a few key changes likely based on Emlid updates\n\"\"\"\n\nimport os\nimport argparse\nimport numpy as np\nimport pandas as pd\n\ndef getparser():\n    parser = argparse.ArgumentParser(description='Update Emlid Reach Survey points with \\\n            PPK positions from RTKLIB')\n    parser.add_argument('survey_pts_csv_fn', type=str, help='Survey point csv filename')\n    parser.add_argument('ppk_pos_fn', type=str, help='PPK pos filename')\n    return parser\n\n\ndef main():\n    parser = getparser()\n    args = parser.parse_args()\n\n    survey_pts_csv_fn = args.survey_pts_csv_fn\n    ppk_pos_fn = args.ppk_pos_fn\n\n    print('Loading: %s' % survey_pts_csv_fn)\n    survey_pts = pd.read_csv(survey_pts_csv_fn, parse_dates=&#91;1], header=0)\n    survey_pts&#91;'date']=pd.to_datetime(survey_pts&#91;'FileModifyDate'],format=\"%Y:%m:%d %H:%M:%S+00:00\")\n    survey_pts.sort_values('date', inplace=True)\n    survey_pts.index=survey_pts&#91;'date']\n    print(survey_pts.dtypes)\n    print(survey_pts)\n    header = 'Date UTC latitude(deg) longitude(deg)  height(m)   Q  ns   sdn(m)   sde(m)   sdu(m)  sdne(m)  sdeu(m)  sdun(m) age(s)  ratio'\n    print('Loading: %s' % ppk_pos_fn)\n    ppk_pos = pd.read_csv(ppk_pos_fn, comment='%', delim_whitespace=True, names=header.split(), parse_dates=&#91;&#91;0,1]])\n    ppk_pos&#91;'date']=pd.to_datetime(ppk_pos&#91;'Date_UTC'])\n    ppk_pos.index=ppk_pos&#91;'Date_UTC']\n    print(ppk_pos.dtypes)\n    print(ppk_pos)\n\n    # Applying merge_asof on data and store it\n    # in a variable\n    merged_dataframe = pd.merge_asof(ppk_pos, survey_pts, right_index=True,left_index=True,direction='nearest',tolerance=pd.Timedelta(\"1s\"))\n\n    print(merged_dataframe)\n\n    #Write out new file\n    out_fn = os.path.splitext(survey_pts_csv_fn)&#91;0]+'_merged.csv'\n    print(\"Writing out: %s\" % out_fn)\n    merged_dataframe.to_csv(out_fn)    \n\nif __name__ == \"__main__\":\n    main()<\/code><\/pre>\n\n\n\n<p>5- In Metashape, import the coordinates of the cameras from the new file<\/p>\n","protected":false},"excerpt":{"rendered":"<p>dataset : photos with timestamps UBX from M2 and from base station Processing: 1- Post-Process base station and get corrected coordinates 2- with Emlid Studio (or RTKLib) calculate events (triggers) positions from UBX as output one gets an &#8230;._events.pos file that gives corrected coordinates for each event together with a timestamp 3- extract timestamps from &hellip; <a href=\"https:\/\/sigeo.cerege.fr\/?p=711\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Use Reach M2 with Phantom 4 Pro&#8221;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24,8,1],"tags":[],"class_list":["post-711","post","type-post","status-publish","format-standard","hentry","category-gps","category-photogrammetrie","category-sigeo"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/sigeo.cerege.fr\/index.php?rest_route=\/wp\/v2\/posts\/711","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sigeo.cerege.fr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sigeo.cerege.fr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sigeo.cerege.fr\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/sigeo.cerege.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=711"}],"version-history":[{"count":4,"href":"https:\/\/sigeo.cerege.fr\/index.php?rest_route=\/wp\/v2\/posts\/711\/revisions"}],"predecessor-version":[{"id":719,"href":"https:\/\/sigeo.cerege.fr\/index.php?rest_route=\/wp\/v2\/posts\/711\/revisions\/719"}],"wp:attachment":[{"href":"https:\/\/sigeo.cerege.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=711"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sigeo.cerege.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=711"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sigeo.cerege.fr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=711"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}