views:

365

answers:

1

Hi there,

Using SQL Server 2008: assuming I have a valid geography object geog1, converting it to a geometry instance geom1 (using the same SRID) and converting it back to an object geography geog2 shows no difference between geog1 and geog2.

However, due to a problem already discussed here I cannot create a geography object containing a linestring from my original data. It works with geometry objects. However, if I perform a "makevalid()" on the resulting geometry, I can create a geography object again. The problem is that I don´t know if this geography will be much different compared to the original linestring that was not accepted by geography::STGeomFromText() before. Especially the object length (STLength()) is of interest to me.

Does anyone know if the conversion between geography and geometry types is losless and if a Makevalid() call on a geometry changes the data (especially when it comes to length)?

Thanks

A: 

MakeValid(), by necessity, changes the underlying data of a geometry instance. (If it made no changes, then the resulting geometry would still be just as invalid as the original).

In many cases, the only change is to the type of the resulting geometry (i.e. an invalid, self-intersecting linestring may become a valid multilinestring), but it is also possible for coordinate values to change. However, these only shift by absolutely fractional amounts necessary to validate the geometry, and will not make a significant difference to the length.