Compare commits

...

2 Commits

Author SHA1 Message Date
69e1b8ca7b up licence osm heading 2023-08-28 22:57:42 +02:00
2afaf45d7e main kartaview conversion 2023-08-28 22:57:33 +02:00
2 changed files with 48 additions and 23 deletions

View File

@ -4,15 +4,13 @@
**/
// @ts-ignore
import piexif from 'piexif';
import * as fs from 'node:fs';
// @ts-ignore
import path from "node:path";
// @ts-ignore
import minimist from 'minimist';
import * as Buffer from "buffer";
// @ts-ignore
const moment = require( "moment");
const moment = require("moment");
// configs
let sequence_name: string = '3596977'
@ -48,7 +46,7 @@ let folders_list_txt: any = [
let enable_write_gpx_file = true;
let just_one_photo_in_folder = false;
let folder = "/home/poule/encrypted/stockage-syncable/photos/imagerie kartaview carto tel/kartaview_export_storage/share2tykayn/"
let folder_photos = folder+"photo"
let folder_photos = folder + "photo"
let dossier_gpx: string = "./output_gpx"
let file_gpx: string = "3596249_d875a_60a0f9bf38f99.txt"
@ -69,7 +67,6 @@ if (mini_arguments['gpx-input']) {
}
// let dossier_photo: string = folder + "test_photo_apply"
let dossier_photo: string = folder_photos
let dossier_gpx_input: string = folder + "metadata_file"
@ -81,7 +78,7 @@ if (mini_arguments['gpx-input-path']) {
let gpxData: any = {}
let exif_commands:any = ['#!/bin/bash' ,'# apply exif data to photos']
let exif_commands: any = ['#!/bin/bash', '# apply exif data to photos']
function makeGpxFromKartaview(tableKartaviewTrace: any) {
@ -92,14 +89,18 @@ function makeGpxFromKartaview(tableKartaviewTrace: any) {
tableKartaviewTrace.forEach((elem: any) => {
// console.log('elem', elem)
// console.log('elem', elem[6] *1000)
let utc_time = new Date(elem[6] * 1000)
if (elem.length && elem[6]) {
let utc_time = new Date(elem[6] * 1000)
// console.log('utc_time', utc_time.toISOString())
track_points = `${track_points}<trkpt lat="${elem[0]}" lon="${elem[1]}">
// console.log('utc_time', utc_time.toISOString())
track_points = `${track_points}<trkpt lat="${elem[0]}" lon="${elem[1]}">
<ele>${elem[2]}</ele>
<time>${utc_time.toISOString()}</time>
</trkpt>
`
}else{
console.log('!!!!!! makeGpxFromKartaview no good element in gpx', elem)
}
})
let content = `<?xml version='1.0' encoding='UTF-8'?>
@ -149,7 +150,7 @@ function reduceGpxPointsToInterval(sequence_name: any) {
let lon = elem[1]
let date = new Date(timestamp)
let date_simezone_indicator = ''; // +2:00
let iso = moment(date).format('YYYY:MM:DD HH:mm:ss')+date_simezone_indicator
let iso = moment(date).format('YYYY:MM:DD HH:mm:ss') + date_simezone_indicator
ii = interval * 1
@ -160,10 +161,10 @@ function reduceGpxPointsToInterval(sequence_name: any) {
// set exif data
// console.log('file_photo_name to apply exif data', photo_counter, file_photo_name)
// -File:ModificationDateTime=="${iso}" \\
// -File:CreateDate="${iso}" \\
let exif_command= `\n
let exif_command = `\n
exiftool -overwrite_original \\
-GPSDateTime="${iso}" \\
-AllDates="${iso}" \\
@ -173,7 +174,7 @@ function reduceGpxPointsToInterval(sequence_name: any) {
-TrackModifyDate=="${iso}" \\
-GPSLongitude="${lon}" \\
-GPSLatitude="${lat}" \\
"${dossier_photo+'/'+sequence_name+'/'+file_photo_name}"
"${dossier_photo + '/' + sequence_name + '/' + file_photo_name}"
`
// -GPSLongitudeRef="West" \
@ -186,11 +187,11 @@ function reduceGpxPointsToInterval(sequence_name: any) {
}
})
exif_commands.push( `geovisio upload --api-url https://panoramax.openstreetmap.fr "${dossier_photo}/${sequence_name}"`)
exif_commands.push(`geovisio upload --api-url https://panoramax.openstreetmap.fr "${dossier_photo}/${sequence_name}"`)
let exif_bash_file = exif_commands.join('\n')
writeFile(`_exif_commmand_sequence_${sequence_name}.sh`,exif_bash_file)
writeFile(`_exif_commmand_sequence_${sequence_name}.sh`, exif_bash_file)
console.log('\n ----- apply exif data:', `\n bash ${dossier_gpx}/${exif_bash_file}`)
console.log('\n\nDONE for sequence_name', sequence_name)
@ -200,7 +201,7 @@ function openKartaviewTxtGPX(filepath: any, sequence_name: string) {
console.log('openKartaviewTxtGPX filepath', filepath)
let boom = filepath.split('/')
let fileName = boom[boom.length - 1]
console.log('openKartaviewTxtGPX fileName', fileName, )
console.log('openKartaviewTxtGPX fileName', fileName,)
fs.readFile(filepath, 'utf8', (err, data) => {
if (err) {
throw err;
@ -229,7 +230,7 @@ function openKartaviewTxtGPX(filepath: any, sequence_name: string) {
gpxData[sequence_name] = [...tableKartaviewTrace]
// console.log('gpxData', gpxData)
console.log(' makeGpxFromKartaview for sequence ', sequence_name)
let content_gpx = makeGpxFromKartaview(tableKartaviewTrace)

View File

@ -113,11 +113,14 @@
<title>OpenStreetMap</title>
</head>
<body>
<body class="site site-about">
<div id="main">
<div id="content">
<div class="content-body">
<header class="closed clearfix">
<h1>
<a class="geolink" href="https://www.openstreetmap.org/">
@ -235,16 +238,36 @@
<div id="content_inner">
<div class="content-inner">
<div dir="ltr" lang="fr">
<div class="container-lg attr">
<div class="row">
<div class="col-sm-7 user-image"></div>
<div class="col-sm-5 px-5 py-3 byosm">
<p class="h5 text-white text-nowrap">
<span>©</span>contributeurs<br> dOpenStreetMap
</p>
</div>
</div>
<div class="row">
<div class="px-5 py-4 bg-dark">
<h1 id="head" class="text-white fw-light">
<img alt="icon" class="custom-icon icon-noun" src="img/noun-heart-5454846.svg">
<span class="user-name">OpenStreetMap</span> la base de données cartographique ouverte, collaborative et mondiale
</h1>
</div>
</div>
</div>
</div>
<article>
<div class="heading-box">
<h1 id="head">
<img alt="icon" class="custom-icon icon-noun" src="img/noun-heart-5454846.svg">
<!-- <h1 id="head">-->
<!-- <img alt="icon" class="custom-icon icon-noun" src="img/noun-heart-5454846.svg">-->
<!-- noun-heart-5454846-->
OpenStreetMap : la base de données cartographique ouverte, collaborative et mondiale
</h1>
<!-- OpenStreetMap : la base de données cartographique ouverte, collaborative et mondiale-->
<!-- </h1>-->
<p>
<div class="lang-selector">
@ -529,6 +552,7 @@
</div>
</div>
</div>
</div>
</div>
<script src="script.js"></script>