Based on the following tables:
Street
Municipality
I'd like to populate Street.NOM_ENT
with Municipality.NOM_ENT
and Street.NOM_MUN
with Municipality.NOMBRE
any time Street.geom
is within Municipality.geom
.
In other words, I have a table with all the streets in a country and I need to add to which state and county that street belongs.
I know how to check if Street.geom
is within Municipality.geom
, but I'm kind of new working with postgis/postgres and I'm not sure how to use this as a condition for an UPDATE query.
ST_Intersects
you'd get multiple assignments. I would useST_Intersects(municipality.geom, ST_LineInterpolatePoint(road.geom, 0.5))
to do this (assign the area where the midpoint is found within - a better assumption and a unique assignment); are these roads strictly simple LineStrings (as opposed to MultiLineStrings?