Skip to main content
Solved

SQL Server - Store the proper SRID in table with multiple geometry columns

  • March 15, 2022
  • 4 replies
  • 228 views

oscard
Influencer
Forum|alt.badge.img+22

Good morning.

 

I have a table with two geometry fields in a SQL Server database. The coordinate system for both of them is EPSG:25830.

 

I've followed this article to be able to write both columns at the same time: https://community.safe.com/s/article/writing-to-tables-that-contain-multiple-geometry-c

 

It works great; but, when I check the SRID of both fields with the function STSrid, I get the 0 value for both of them instead of 25830. Before writing, I set the coordiante system with a CoordinateSystemSetter, so I don't know why it's not stored properly. That doesn't happen with tables with just one geometry column.

 

imageThe data comes from a DGN (v7) file. I'm using FME 2021.1.0.0. Am I missing something?

 

I've found this question with a similar issue from 5 years ago: https://community.safe.com/s/question/0D54Q000080hQwSSAU/multiple-geometries-with-different-srsid-

The last answer was by @mark2atsafe​  saying the devs were going to check it, but no further posts about it.

 

Thanks for any help provided.

 

Best answer by markatsafe

@oscard​ FME can preserve the SRID on multiple geometry columns. To do this you need to set the geometry trait "Coordsys" with the coordinate system name that can be determined using the CoordinateSystemExtractor.

For each geometry:

  • CoordinateSystemExtractor and set the attribute "Coordsys"
  • GeometryPropertySetter with Traits from Attributes and the attribute Coordsys selected.
  • then aggregate the geometries and use the MultipleGeometrySetter

Example workspace attached (FME 2021.2)

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

4 replies

Forum|alt.badge.img+2
  • 1891 replies
  • March 15, 2022

@oscard​ I couldn't reproduce this in FME 2021.2. But perhaps that's because I'm using geography columns. I've attached my example. You can use the SQLCreators to create the table and query the SRID. If you want to alter this example to reproduce your issue I can take a deeper look. Looks like something we should ix in FME


oscard
Influencer
Forum|alt.badge.img+22
  • Author
  • Influencer
  • 344 replies
  • March 16, 2022

@oscard​ I couldn't reproduce this in FME 2021.2. But perhaps that's because I'm using geography columns. I've attached my example. You can use the SQLCreators to create the table and query the SRID. If you want to alter this example to reproduce your issue I can take a deeper look. Looks like something we should ix in FME

Thanks for the answer.

 

I've checked your example and there is no big differences with my workspace. I can't share an example in a public forum, but I will open a case to attach it.

 

The case number is C671145.


Forum|alt.badge.img+2
  • 1891 replies
  • Best Answer
  • March 17, 2022

@oscard​ FME can preserve the SRID on multiple geometry columns. To do this you need to set the geometry trait "Coordsys" with the coordinate system name that can be determined using the CoordinateSystemExtractor.

For each geometry:

  • CoordinateSystemExtractor and set the attribute "Coordsys"
  • GeometryPropertySetter with Traits from Attributes and the attribute Coordsys selected.
  • then aggregate the geometries and use the MultipleGeometrySetter

Example workspace attached (FME 2021.2)


oscard
Influencer
Forum|alt.badge.img+22
  • Author
  • Influencer
  • 344 replies
  • March 18, 2022

@oscard​ FME can preserve the SRID on multiple geometry columns. To do this you need to set the geometry trait "Coordsys" with the coordinate system name that can be determined using the CoordinateSystemExtractor.

For each geometry:

  • CoordinateSystemExtractor and set the attribute "Coordsys"
  • GeometryPropertySetter with Traits from Attributes and the attribute Coordsys selected.
  • then aggregate the geometries and use the MultipleGeometrySetter

Example workspace attached (FME 2021.2)

Thank you! It's working now.

 

Before posting the issue I tried to do something similar with the GeometryPropertySetter, but I was using an incorrect name for the attribute. Is there any documentation where all the possible geometry traits are listed?