metadata

package
v0.1.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 2, 2026 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package metadata provides Google Maps location history parsing and structures.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LocationRecord

type LocationRecord struct {
	Latitude  float64   `json:"latitude"`
	Longitude float64   `json:"longitude"`
	Accuracy  int       `json:"accuracy"`
	Timestamp time.Time `json:"timestamp"`
	Source    string    `json:"source,omitempty"`
	Altitude  float64   `json:"altitude,omitempty"`
	Velocity  int       `json:"velocity,omitempty"`
	Heading   int       `json:"heading,omitempty"`
}

LocationRecord represents a single location point from Google Maps timeline.

func ParseRecordsJSON

func ParseRecordsJSON(reader io.Reader) ([]LocationRecord, error)

ParseRecordsJSON streams and parses Records.json location history file. CRITICAL: Uses json.NewDecoder for streaming to handle large files (100MB+).

type MapsLibrary

type MapsLibrary struct {
	LocationHistory []LocationRecord `json:"location_history"`
	SavedPlaces     []SavedPlace     `json:"saved_places"`
	Timeline        []PlaceVisit     `json:"timeline"`
	Stats           map[string]int   `json:"stats"`
}

MapsLibrary represents the complete collection of parsed Maps data.

func (*MapsLibrary) GetCreatedDate

func (l *MapsLibrary) GetCreatedDate() time.Time

GetCreatedDate returns the earliest location timestamp.

func (*MapsLibrary) GetDataType

func (l *MapsLibrary) GetDataType() string

GetDataType returns the data type.

func (*MapsLibrary) GetDescription

func (l *MapsLibrary) GetDescription() string

GetDescription returns a description of the data.

func (*MapsLibrary) GetMediaType

func (l *MapsLibrary) GetMediaType() string

GetMediaType returns the media type.

func (*MapsLibrary) GetMetadata

func (l *MapsLibrary) GetMetadata() map[string]any

GetMetadata returns all metadata as a map.

func (*MapsLibrary) GetModifiedDate

func (l *MapsLibrary) GetModifiedDate() time.Time

GetModifiedDate returns the latest location timestamp.

func (*MapsLibrary) GetSize

func (l *MapsLibrary) GetSize() int64

GetSize returns the total number of location records.

func (*MapsLibrary) GetTags

func (l *MapsLibrary) GetTags() []string

GetTags returns tags/labels (not applicable for location data).

func (*MapsLibrary) GetTitle

func (l *MapsLibrary) GetTitle() string

GetTitle returns the title for display.

func (*MapsLibrary) SetMetadata

func (l *MapsLibrary) SetMetadata(key string, value any) error

SetMetadata updates metadata (no-op for immutable fields).

func (*MapsLibrary) SetTags

func (l *MapsLibrary) SetTags(tags []string) error

SetTags sets tags/labels (not supported).

type PlaceVisit

type PlaceVisit struct {
	Location   SavedPlace    `json:"location"`
	StartTime  time.Time     `json:"start_time"`
	EndTime    time.Time     `json:"end_time"`
	Duration   time.Duration `json:"duration"`
	Confidence string        `json:"confidence,omitempty"`
}

PlaceVisit represents a visit to a location from semantic timeline data.

func ParseTimelineJSON

func ParseTimelineJSON(reader io.Reader) ([]PlaceVisit, error)

ParseTimelineJSON parses semantic location history from monthly timeline JSON.

type SavedPlace

type SavedPlace struct {
	Name          string   `json:"name"`
	Address       string   `json:"address,omitempty"`
	Latitude      float64  `json:"latitude"`
	Longitude     float64  `json:"longitude"`
	GoogleMapsURL string   `json:"google_maps_url,omitempty"`
	Note          string   `json:"note,omitempty"`
	Lists         []string `json:"lists,omitempty"`
}

SavedPlace represents a saved location from Google Maps.

func ParseSavedPlacesKML

func ParseSavedPlacesKML(reader io.Reader) ([]SavedPlace, error)

ParseSavedPlacesKML parses saved places from KML file.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL