Add geolocation file download from map preview

pull/1615/head
Piero Toffanin 2025-02-18 14:26:38 +01:00
rodzic a8552b9722
commit e2eafe0507
2 zmienionych plików z 10 dodań i 1 usunięć

Wyświetl plik

@ -66,7 +66,7 @@ export default class ExportAssetPanel extends React.Component {
}, },
'csv': { 'csv': {
label: "CSV", label: "CSV",
icon: "fa fa-file-text" icon: "fas fa-file-alt"
} }
}; };

Wyświetl plik

@ -511,6 +511,10 @@ _('Example:'),
download = format => { download = format => {
let output = ""; let output = "";
let filename = `images.${format}`; let filename = `images.${format}`;
if (format === "geo"){
filename = "geo.txt";
}
const feats = { const feats = {
type: "FeatureCollection", type: "FeatureCollection",
features: this.exifData.map(ed => { features: this.exifData.map(ed => {
@ -538,6 +542,10 @@ _('Example:'),
output = `Filename,Timestamp,Latitude,Longitude,Altitude\r\n${feats.features.map(feat => { output = `Filename,Timestamp,Latitude,Longitude,Altitude\r\n${feats.features.map(feat => {
return `${feat.properties.Filename},${feat.properties.Timestamp},${feat.geometry.coordinates[1]},${feat.geometry.coordinates[0]},${feat.geometry.coordinates[2]}` return `${feat.properties.Filename},${feat.properties.Timestamp},${feat.geometry.coordinates[1]},${feat.geometry.coordinates[0]},${feat.geometry.coordinates[2]}`
}).join("\r\n")}`; }).join("\r\n")}`;
}else if (format === 'geo'){
output = `EPSG:4326\r\n${feats.features.map(feat => {
return `${feat.properties.Filename} ${feat.geometry.coordinates[0]} ${feat.geometry.coordinates[1]} ${feat.geometry.coordinates[2]}`
}).join("\r\n")}`;
}else{ }else{
console.error("Invalid format"); console.error("Invalid format");
} }
@ -569,6 +577,7 @@ _('Example:'),
<li> <li>
<a href="javascript:void(0);" onClick={() => this.download('geojson')}><i className="fas fa-map fa-fw"></i> GeoJSON</a> <a href="javascript:void(0);" onClick={() => this.download('geojson')}><i className="fas fa-map fa-fw"></i> GeoJSON</a>
<a href="javascript:void(0);" onClick={() => this.download('csv')}><i className="fas fa-file-alt fa-fw"></i> CSV</a> <a href="javascript:void(0);" onClick={() => this.download('csv')}><i className="fas fa-file-alt fa-fw"></i> CSV</a>
<a href="javascript:void(0);" onClick={() => this.download('geo')}><i className="fas fa-file-alt fa-fw"></i> Geolocation File</a>
</li> </li>
</ul> </ul>
</div> : ""} </div> : ""}