[mapguide-users] SQL Server Spatial and SRS for geometry data type

Brent Robinson brent.robinson at autodesk.com
Wed Jul 17 05:36:50 PDT 2013


Hi,

If you don't mind a small schema change, a workaround would be to rename the spatial index for the geometry column to append "srid=25832". This should force the provider to insert new geometries with this srid. This was implemented to support Map, when it creates classes. Initially, the class table is empty and there is no native way to determine the srid for any of its geometry or geography columns. To get around this, the provider supports encoding the srid in the spatial index name.

Could you log a ticket for adding " WHERE geom IS NOT NULL") to the fallback select? The provider should be changed to skip null geometry values in this case.

Brent.

-----Original Message-----
From: mapguide-users-bounces at lists.osgeo.org [mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Gunter Becker
Sent: Wednesday, July 17, 2013 6:12 AM
To: mapguide-users at lists.osgeo.org
Subject: [mapguide-users] SQL Server Spatial and SRS for geometry data type

Hi,

I'm struggling with inserting geometries into SQL Server. After a coordinate system transformation all my geometries now have the appropriate SRS (SRID=25832). Before SRID was just 0.

Now when inserting new geometries via MapGuide/FDO into the tables I realized that sometimes they are written in the correct SRS (SRID=25832) and sometimes not (SRID=0). So I debugged the SQL that was send from MapGuide/FDO to the SQL Server and found out that the provider determine the SRID from the first row of the table where the geometry should be insert in:

SELECT TOP 1 [geom].STSrid as srid from [tablename]

BUT, when the first row has no geometry (geom=NULL) then this query returns NULL and the new geometry is written into the table with SRID=0 instead of the correct SRID=25832. (As a side note: that wouldn't have happen if there is a where-clause in this query like " WHERE geom IS NOT NULL")

MapGuide doesn't show up the new geometry since it has the wrong SRS. 
Is there a way to insert the geometry with the correct SRS? Can I use fdo schema tables? 
If yes, then which tables do I have to use to achieve my goal? Any other ideas?

Thanks, Gunter



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/SQL-Server-Spatial-and-SRS-for-geometry-data-type-tp5067010.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
_______________________________________________
mapguide-users mailing list
mapguide-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users


More information about the mapguide-users mailing list