The actual bytes of the photo live in the column called blob in the table blobbytes.
The way users interact with binary data is through a Blob object whose metadata is stored in the photodoc table. This allows for naming, describing, and linking multiple objects to the same underlying byte array without duplicating the bytes themselves. So any object that wants to connect to a photo or document has a linking table that connects that object to a record in photodoc and then photodoc has a foreign key to a single record in blobbytes called blobbytes_bytesid.
The photo that the map ultimately should grab is the bytes that are linked in the record in photodoc pointed to by the FK called broadview_photodocid on the parcel table.
Suggested design steps:
Write a SQL query for each parcel that gets you the bytes for any given parcel's broadview photo
Figure out how to extract the byte array called blob from blobtyes and feed that into an object that can be shipped to the client. This probably involves a JS streaming library of some kind and your postgres driver will also need streaming support--probably start there for design help (the documentation of the postgres - JS driver)
Overview of how photos live in Postgresql
The actual bytes of the photo live in the column called
blob
in the tableblobbytes
. The way users interact with binary data is through aBlob
object whose metadata is stored in thephotodoc
table. This allows for naming, describing, and linking multiple objects to the same underlying byte array without duplicating the bytes themselves. So any object that wants to connect to a photo or document has a linking table that connects that object to a record inphotodoc
and thenphotodoc
has a foreign key to a single record inblobbytes
calledblobbytes_bytesid
.The photo that the map ultimately should grab is the bytes that are linked in the record in
photodoc
pointed to by the FK calledbroadview_photodocid
on theparcel
table.Suggested design steps:
bytes
for any given parcel's broadview photoblob
fromblobtyes
and feed that into an object that can be shipped to the client. This probably involves a JS streaming library of some kind and your postgres driver will also need streaming support--probably start there for design help (the documentation of the postgres - JS driver)