Places: Reduce GeoJON response size
This commit is contained in:
parent
1eca490f74
commit
f8d64daf00
|
@ -17,10 +17,6 @@
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body class="{{ .config.Flags }}">
|
<body class="{{ .config.Flags }}">
|
||||||
<!--[if lt IE 8]>
|
|
||||||
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade
|
|
||||||
your browser</a> to improve your experience.</p>
|
|
||||||
<![endif]-->
|
|
||||||
|
|
||||||
{{template "app.tmpl" .}}
|
{{template "app.tmpl" .}}
|
||||||
|
|
||||||
|
|
|
@ -30,11 +30,7 @@
|
||||||
window.__CONFIG__ = {{ .config }};
|
window.__CONFIG__ = {{ .config }};
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body class="{{ .config.Flags }}">
|
<body class="shared {{ .config.Flags }}">
|
||||||
<!--[if lt IE 8]>
|
|
||||||
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade
|
|
||||||
your browser</a> to improve your experience.</p>
|
|
||||||
<![endif]-->
|
|
||||||
|
|
||||||
{{template "app.tmpl" .}}
|
{{template "app.tmpl" .}}
|
||||||
|
|
||||||
|
|
|
@ -171,6 +171,10 @@ export class Thumb extends Model {
|
||||||
return new this(result);
|
return new this(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static wrap(data) {
|
||||||
|
return data.map((values) => new this(values));
|
||||||
|
}
|
||||||
|
|
||||||
static fromFiles(photos) {
|
static fromFiles(photos) {
|
||||||
let result = [];
|
let result = [];
|
||||||
|
|
||||||
|
|
|
@ -220,7 +220,7 @@ export default {
|
||||||
return Api.get("geo/view", options).then((r) => {
|
return Api.get("geo/view", options).then((r) => {
|
||||||
if (r && r.data && r.data.length > 0) {
|
if (r && r.data && r.data.length > 0) {
|
||||||
// Show photos.
|
// Show photos.
|
||||||
this.$viewer.show(r.data, 0);
|
this.$viewer.show(Thumb.wrap(r.data), 0);
|
||||||
} else {
|
} else {
|
||||||
// Don't open viewer if nothing was found.
|
// Don't open viewer if nothing was found.
|
||||||
this.$notify.warn(this.$gettext("No pictures found"));
|
this.$notify.warn(this.$gettext("No pictures found"));
|
||||||
|
|
|
@ -49,7 +49,7 @@ func Geo(f form.SearchGeo) (results GeoResults, err error) {
|
||||||
|
|
||||||
s = s.Table("photos").
|
s = s.Table("photos").
|
||||||
Select(`photos.id, photos.photo_uid, photos.photo_type, photos.photo_lat, photos.photo_lng,
|
Select(`photos.id, photos.photo_uid, photos.photo_type, photos.photo_lat, photos.photo_lng,
|
||||||
photos.photo_title, photos.photo_description, photos.photo_favorite, photos.taken_at_local,
|
photos.photo_title, photos.photo_description, photos.photo_favorite, photos.taken_at, photos.taken_at_local,
|
||||||
files.file_hash, files.file_width, files.file_height`).
|
files.file_hash, files.file_width, files.file_height`).
|
||||||
Joins(`JOIN files ON files.photo_id = photos.id AND
|
Joins(`JOIN files ON files.photo_id = photos.id AND
|
||||||
files.file_missing = 0 AND files.file_primary AND files.deleted_at IS NULL`).
|
files.file_missing = 0 AND files.file_primary AND files.deleted_at IS NULL`).
|
||||||
|
|
|
@ -22,7 +22,8 @@ type GeoResult struct {
|
||||||
FileHash string `json:"Hash"`
|
FileHash string `json:"Hash"`
|
||||||
FileWidth int `json:"Width"`
|
FileWidth int `json:"Width"`
|
||||||
FileHeight int `json:"Height"`
|
FileHeight int `json:"Height"`
|
||||||
TakenAtLocal time.Time `json:"TakenAt"`
|
TakenAt time.Time `json:"TakenAt"`
|
||||||
|
TakenAtLocal time.Time `json:"TakenAtLocal"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lat returns the position latitude.
|
// Lat returns the position latitude.
|
||||||
|
@ -65,16 +66,10 @@ func (photos GeoResults) GeoJSON() ([]byte, error) {
|
||||||
props := gin.H{
|
props := gin.H{
|
||||||
"UID": p.PhotoUID,
|
"UID": p.PhotoUID,
|
||||||
"Hash": p.FileHash,
|
"Hash": p.FileHash,
|
||||||
"Width": p.FileWidth,
|
"TakenAt": p.TakenAt,
|
||||||
"Height": p.FileHeight,
|
|
||||||
"TakenAt": p.TakenAtLocal,
|
|
||||||
"Title": p.PhotoTitle,
|
"Title": p.PhotoTitle,
|
||||||
}
|
}
|
||||||
|
|
||||||
if p.PhotoDescription != "" {
|
|
||||||
props["Description"] = p.PhotoDescription
|
|
||||||
}
|
|
||||||
|
|
||||||
if p.PhotoType != entity.TypeImage && p.PhotoType != entity.TypeDefault {
|
if p.PhotoType != entity.TypeImage && p.PhotoType != entity.TypeDefault {
|
||||||
props["Type"] = p.PhotoType
|
props["Type"] = p.PhotoType
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue