A photo gallery placed on a map!
Update 2022-04-07: Looks like gx:Carousel no longer works in browser. I will try to investigate this further and fix it.
- simple CLI program
- generate a KML file with images placed on a map (can be opened in eg. Google Earth)
- location is automatically extracted from EXIF
- specify custom image information using a JSON or YAML file
- order images by time
- generate trip path
- embed images in base64 for easier sharing
- add external images
- zip KML and resources to KMZ file
Just download a binary file from Releases. You may want to add photo-map to the path.
You should be able to run:
photo-map -h
If there is no binary file for your OS and architecture, follow the Build section.
Go and Git have to be installed.
Clone or download this repo somewhere into $GOPATH
, preferably into $GOPATH/src/github.com/sykoram/photo-map
.
Download and install all dependencies:
go get ./...
And install the photo-map:
go install
This creates an executable inside $GOBIN
(usually $GOPATH/bin
), and photo-map should work now. You can try to run:
photo-map -h
Use flag -h
or --help
to display the help.
The most basic command would be:
photo-map -i IMAGE_DIR -o OUTPUT_DIR
-
-i IMAGE_DIR
: Input directory with images (required) -
-o OUTPUT_DIR
: Output directory -
-mode MODE
: Mode of an image representation -
-name NAME
: Project name -
-data DATA_FILE
: Path to a file with user-specified image data -
-timesort
: Order images by timestamp. -
-path
: Draw a line between the images (-timesort
is recommended). -
-pathcolor
: Color of the path in formatrrggbb
orrrggbbaa
(hex) -
-include-no-location
: Do not skip images without location. They are placed on [0,0]. -
-base64
: Embed images in base64 into the KML document.
It may be a good idea to reduce size of the images; otherwise, the generated output KML/KMZ file might be large. -
-maxsize
: Resize internal images to fit into a MAXSIZE x MAXSIZE box. -
-kmz
: Zip the output directory into a one KMZ file.
Different applications use different types of image representation.
g-earth-web
(Google Earth Web): <gx:Carousel>
is used. (recommended, default)
g-earth-web-panel
(Google Earth Web): <img>
tag inside HTML, panel
balloon style.
g-earth-pro
(Google Earth Pro): The image is an <img>
tag inside a HTML balloon style (it is not in the description field).
g-maps
(Google Maps): The image is a HTML <img>
tag in the description.
g-earth-photo-overlay
(Google Earth Pro): The image is placed above the map using PhotoOverlay.
Google Earth mobile app supports usually same modes as Google Earth Web
Using the custom data file, you can specify some information about the images. This will overwrite information extracted from the EXIF. Both JSON and YAML files are supported, and they follow the same structure.
Inside the main JSON or YAML object, there has to be a key items
, and its value is an array of objects. Each of these objects contains information about an image:
-
file
specifies the file (image). The path should be relative to the input directory (containing images), so it might be a good idea to put the JSON file also in this directory. -
dateTime
sets the date and time using the EXIF format:"2006:01:02 15:04:05"
. Any trailing spaces or null characters are trimmed. -
timeZone
sets the time zone. It has to be either a valid tz database name or"Local"
. If thedateTime
is not specified in JSON for an image, thedateTime
from EXIF will be recalculated using the difference between the EXIF time zone (if exists) and the specified zone. This can be used to correct the time and date. -
latitude
andlongitude
define the GPS coordinations of the image. Positive for north and east, and negative for south and west. -
external
specifies the absolute path to the corresponding image that is somewhere else (eg. on a website) and is not included in the KMZ file.
If a field is left out, the data from EXIF will not be overwritten. Unknown keys are ignored.
---
items:
- file: path/to/image.jpg
dateTime: 2006:01:02 15:04:05
timeZone: UTC
latitude: 50.09
longitude: 14.4
external: https://example.com/path/to/image.jpg
- file: image2.jpg
latitude: 50.087
longitude: 14.42
- file: path/to/image3.jpg
external: https://example.com/path/to/image3.jpg
{"items": [
{
"file": "path/to/image.jpg",
"dateTime": "2006:01:02 15:04:05",
"timeZone": "UTC",
"latitude": 50.09,
"longitude": 14.4,
"external": "https://example.com/path/to/image.jpg"
},
{
"file": "image2.jpg",
"latitude": 50.087,
"longitude": 14.42
},
{
"file": "path/to/image3.jpg",
"external": "https://example.com/path/to/image3.jpg"
}
]}
- open Google Earth in a browser
- in menu (three horizontal lines in the left upper corner), click on "Projects"
- click "Open" or "New project" > "Import KML file from computer" and select the generated KML or KMZ file > "Present"
- open Google Earth app
- in menu (three horizontal lines in the left upper corner), tap on "Projects"
- tap "Open" > "Import KML file" and select the KML or KMZ file > "Present"
- start Google Earth Pro
- click "File" > "Open" > select the generated KML or KMZ file
- go to Google My Maps
- click "Create a new map"
- under New layer or Untitled layer, click "Import", and select the generated KML or KMZ file