Tools developed by KartaView to help contributors.
virtualenv -p python3 .
source bin/activate
pip3 install -r requirements.txt ```
This script is used to upload sequences from a local directory. The available formats are: * Sequences taken with the OSC mobile apps * Exif images
``` cd /path_to_scripts/osc_tools
python osc_tools.py -h
python osc_tools.py upload -h
python osc_tools.py upload -p ~/OSC_seqences
```
This script generates GPS Exif for each image. It has two options generating exif info from metadata file or generating exif info from a custom geojson file.
``` cd /path_to_scripts
python osc_tools.py -h
python osc_tools.py generate_exif -h ```
```
python osc_tools.py generate_exif -exif_source metadata -p ~/OSC_seqences/Sequence1
```
```
python osc_tools.py generate_exif -exif_source custom_geojson -p ~/CustomFolderContainingGeoJsonAndImages
```
To run the scripts inside a Docker container:
make docker
docker run -Pit osc-up osc_tools.py
docker run -Pit --mount type=bind,source="$(pwd)",target=/opt/osc osc-up /opt/osc/osc_tools.py
The 'images' directory in the repo will be available in the container at /opt/osc/images
Hi,
I've tried to install the dependencies for the Script but I get an error message when I run the second line:
pip3 install virtualenv
virtualenv -p python3 .
source bin/activate
pip3 install -r requirements.txt
After I've run pip3 install virtualenv I get these warnings
WARNING: The script virtualenv is installed in '/home/hermann/.local/bin' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
I run
virtualenv -p python3 .
It says,
virtualenv not found but can be installed with sudo apt install python3-virtualenv
I've installed it and run
virtualenv -p python3 .
Then came an error message:
AttributeError: module 'virtualenv.create.via_global_ref.builtin.cpython.mac_os' has no attribute 'CPython2macOsArmFramework'
From some internet reseach someone suggested
pip3 uninstall virtualenv
sudo pip3 uninstall virtualenv
sudo apt purge python3-virtualenv
sudo pip3 install virtualenv
That didn't help, so I started over again with
sudo pip3 uninstall virtualenv
sudo apt purge python3-virtualenv
pip3 install virtualenv
virtualenv -p python3 .
Then an error came with
File or directory not found
I did
export PYTHONPATH="/home/hermann/.local/bin"
but it didn't help. It still says
File or directory not found
do you have any sugggestions what else I could do to get this running?
I'm on Linux Mint 20.1 with Python 3.8.10 Thanks for your help.
Fixed: JSONDecodeError occurs when Image Description tag is not in JSON format #134
When I uploaded photos that did not have an Image Description tag in JSON format, I got a json.decoder.JSONDecodeError as shown in the traceback below.
Traceback (most recent call last):
File "./osc_tools.py", line 243, in <module>
main()
File "./osc_tools.py", line 24, in main
args.func(args)
File "./osc_tools.py", line 95, in upload_command
sequences = discoverer.discover(path)
File "/home/pi/src/upload-scripts/osc_discoverer.py", line 113, in discover
sequences = sequences + self.discover(full_path)
File "/home/pi/src/upload-scripts/osc_discoverer.py", line 114, in discover
sequence = self.create_sequence(path)
File "/home/pi/src/upload-scripts/osc_discoverer.py", line 129, in create_sequence
(visual_data, data_type) = self.visual_data.discover(path)
File "/home/pi/src/upload-scripts/visual_data_discover.py", line 50, in discover
photo = cls._photo_from_path(os.path.join(path, file_path))
File "/home/pi/src/upload-scripts/visual_data_discover.py", line 130, in _photo_from_path
exif_parser.next_item_with_class(PhotoMetadata))
File "/home/pi/src/upload-scripts/parsers/exif/exif.py", line 47, in next_item_with_class
return self._photo_item(self.tags)
File "/home/pi/src/upload-scripts/parsers/exif/exif.py", line 171, in _photo_item
gps = self._gps_item(tags_data)
File "/home/pi/src/upload-scripts/parsers/exif/exif.py", line 133, in _gps_item
gps.timestamp = self._gps_timestamp(tags_data)
File "/home/pi/src/upload-scripts/parsers/custom_data_parsers/custom_mapillary.py", line 21, in _gps_timestamp
description = json.loads(description)
File "/usr/lib/python3.7/json/__init__.py", line 348, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.7/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.7/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Just so that users know. :wink:
Feel free to cherry pick this PR.
Hi, the credentials.json should not be in the current directory but in the normal XDG namespace somethink like ~/.config/karta/credentials.json
Currently i need to login on every upload because i change into the directory of the images and upload "."
Flo
Thanks to the updates of @salabogdan I can upload 360 photos to KV very well by Python, creating EXIFs from custom geojson:
Sample KV metadata file to generate of Exif info #117 https://github.com/kartaview/upload-scripts/issues/117
In KV I can dynamically and interactively see each 360 photo of the sequence: https://kartaview.org/details/3936361/0/track-info
I can also see the sequence in OpenStreetMap's iD Editor, but in the photo viewer I only see the plan photo mode: https://github.com/openstreetmap/iD
360 photos on OpenStreetMap iD Editor:
https://www.openstreetmap.org/edit?editor=id#map=19/41.91031/12.50307
Wonder if there is a way to view the KartaView viewer in interactive 360 degree panoramic mode with the angle pointer dynamically moving with the 360 photo in OpenStreetMap iD Editor, very usefull for mapping in OSM with own 360 photos.
I have seen that some Mapillary 360 photo sequences are displayed interactively on the OpenStreetMap iD Editor.
Thanks a lot
KartaView - the crowdsourced, free and open street level imagery platform for OpenStreetMap
GitHub Repository