Use embedded address location rather than external location on geocode

This commit is contained in:
Eli Ribble 2026-04-14 01:32:32 +00:00
parent 3c62fe2ca1
commit cadf6afb5f
No known key found for this signature in database
6 changed files with 22 additions and 23 deletions

View file

@ -139,14 +139,17 @@ func geocodePool(ctx context.Context, txn bob.Tx, client *stadia.StadiaMaps, job
PostalCode: pool.AddressPostalCode,
Street: pool.AddressStreet,
}
address, err := geocode.GeocodeStructured(ctx, job.org, a)
geo, err := geocode.GeocodeStructured(ctx, job.org, a)
if err != nil {
addError(ctx, txn, job.csv, job.rownumber, 0, err.Error())
}
geom_query := geom.PostgisPointQuery(address.Location)
if geo.Address.Location == nil {
return fmt.Errorf("nil location")
}
geom_query := geom.PostgisPointQuery(*geo.Address.Location)
_, err = psql.Update(
um.Table("fileupload.pool"),
um.SetCol("h3cell").ToArg(address.Cell),
um.SetCol("h3cell").ToArg(geo.Cell),
um.SetCol("geom").To(geom_query),
um.Where(psql.Quote("id").EQ(psql.Arg(pool.ID))),
).Exec(ctx, txn)