I am working on a tool, which transfers data, including geometries, from different legacy databases to postgis.
Currently this means I have a MS-access Database, which contains point geometries, but since access does not have a geometry type, the points consist of two columns, containing numbers, like so:
lat | lon |
---|---|
371744,668 | 5700069,115 |
During the flow of my tool, I take these coordinates with pyodbc, and use shapely to create a point. This point does not have crs since it is newly created. Now I'm trying to set it to EPSG:25832, since the postgis DB expects geometry data to be in 25832. The code below shows what is going on. In the docs I found an example, and even when I'm directly pasting the example to my code it does not work.
What am I missing here?
def getGeomAsWKB(self, table, ids):
tmp = self.getCoordinates(table) # tmp = list of tuples with coordinate pairs [(X,Y),(X2,Y2)...]
geoms = []
for coords in tmp:
pt = Point(coords) no crs at this point, as to be expected
srid = pyproj.CRS('EPSG:25832')
old_srid = pyproj.CRS('EPSG:25832')
project = pyproj.Transformer.from_crs(old_srid, srid, always_xy=True).transform
t_pt = transform(project, pt) nothing changes
#pt._crs = 'EPSG:25832'# i tried to set it this way, becausei did not know what else to try
tmp_binary = wkb.dumps(t_pt)
geoms.append(tmp_binary)
return geoms
Just to be clear, pt and t_pt are correctly build, its just that t_pt does not contain the crs information after the transformation.
Postgis return the following error code :
Geometry SRID (0) does not match column SRID (25832)
Thank you for your advice.