Commit df0bfbe0 authored by ARCHER's avatar ARCHER

changed default temp_method to 'sql', to allow mixed geometry

parent c2d33ca4
......@@ -301,12 +301,15 @@ def to_postgis(gdf,*args,**kwargs):
# set dtype converter for geometry columun
if 'dtype' not in kwargs:
if 'temp_method' not in kwargs:
geom_cols = gdf.get_all_geometry_names()
for geom_col in geom_cols :
geom_types=gdf[geom_col].apply(lambda x: x.__geo_interface__['type']).unique().tolist()
if len(geom_types) != 1:
raise TypeError("mixed types not implemented : %s" % ",".join(geom_types))
if len(geom_types) != 1 and kwargs['temp_method'] != 'sql':
raise TypeError("mixed types not implemented with temp_method='%s' (use 'sql' instead) : %s" % (kwargs['temp_method'],",".join(geom_types)))
logger.debug("%s type : %s" % (geom_col , geom_type))
kwargs['dtype'][geom_col] = Geo(geom_type,srid=srid) #, srid=srid)
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment