retrieve boundaries from location using GMaps API

This commit is contained in:
itskovacs 2025-11-03 18:52:21 +01:00
parent 32d536b4cc
commit a30dfe730e
2 changed files with 10 additions and 1 deletions

View File

@ -1,6 +1,6 @@
import { inject, Injectable } from '@angular/core'; import { inject, Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
import { Category, GooglePlaceResult, Place } from '../types/poi'; import { Category, GoogleBoundaries, GooglePlaceResult, Place } from '../types/poi';
import { BehaviorSubject, map, Observable, shareReplay, tap } from 'rxjs'; import { BehaviorSubject, map, Observable, shareReplay, tap } from 'rxjs';
import { Info } from '../types/info'; import { Info } from '../types/info';
import { Backup, ImportResponse, Settings } from '../types/settings'; import { Backup, ImportResponse, Settings } from '../types/settings';
@ -325,4 +325,8 @@ export class ApiService {
gmapsSearchText(q: string): Observable<GooglePlaceResult[]> { gmapsSearchText(q: string): Observable<GooglePlaceResult[]> {
return this.httpClient.get<GooglePlaceResult[]>(`${this.apiBaseUrl}/places/google-search`, { params: { q } }); return this.httpClient.get<GooglePlaceResult[]>(`${this.apiBaseUrl}/places/google-search`, { params: { q } });
} }
gmapsGeocodeBoundaries(q: string): Observable<GoogleBoundaries> {
return this.httpClient.get<GoogleBoundaries>(`${this.apiBaseUrl}/places/google-geocode`, { params: { q } });
}
} }

View File

@ -35,3 +35,8 @@ export interface GooglePlaceResult {
allowdog: boolean; allowdog: boolean;
description: string; description: string;
} }
export interface GoogleBoundaries {
northeast: { lat: number; lng: number };
southwest: { lat: number; lng: number };
}