geography::STMPolyFromText
static constructor STMPolyFromText (called as type::STMPolyFromText(...))
What changes
- Input
- WKT, WKB, GML or coordinates and SRID
- Output or change
- spatial instance
- Return type
- SQL Server return type: geography CLR return type: Sql Geography OGC type: MultiPolygon
Syntax at a glance
STMPolyFromText ( 'multipolygon_tagged_text' , SRID )
Work example
Use geography.STMPolyFromText to construct a multi-polygon value from WKT.
Check ring closure, geography orientation, and SRID. Keep the geography type and SRID in the review.
Check your work The WKT creates two disjoint, closed polygon rings in a MultiPolygon with SRID 4326.
Practice SQL
Open in SQL FlowOpen the SQL for a walkthrough. Run the example in SQL Server to check its result.
SELECT geography::STMPolyFromText('MULTIPOLYGON(((-122.358 47.653, -122.348 47.649, -122.348 47.658, -122.358 47.658, -122.358 47.653)), ((-122.308 47.653, -122.298 47.649, -122.298 47.658, -122.308 47.658, -122.308 47.653)))', 4326).STNumGeometries() AS region_count;
Open Microsoft Learn for full syntax, permissions, and details for your version.