Skip to content

Question: How do I set general geometry column with specific SRID? #2139

@swidz

Description

@swidz

Hi,
I need to create a table with generic geometry type column. All geometries will be in a specific SRID
but I cannot specify the exact geometry type. Is it possible to setup SRID using fluent API without specifying the type?

When I know the geometry type I can do this:
builder.Property(x => x.Location).HasColumnType("geometry (point, 3857)");

For SQLite I was using HasSrid but I think it does not work with Npgsql:
builder.Property(x => x.Location).HasSrid(3857);

How to specify SRID for general geometry?

builder.Property(x => x.StreetGeometry).HasSrid(3857);
builder.Property(x => x.StreetGeometry).HasColumnType("geometry");

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions