{"id":15003362,"url":"https://github.com/xfischer/sqlserverspatial.toolkit","last_synced_at":"2025-10-30T11:30:28.017Z","repository":{"id":73948653,"uuid":"45075956","full_name":"xfischer/SqlServerSpatial.Toolkit","owner":"xfischer","description":"Visual Trace and debugger visualizer for SQL Server types in Visual Studio","archived":false,"fork":false,"pushed_at":"2024-08-28T16:40:18.000Z","size":23053,"stargazers_count":3,"open_issues_count":2,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-12T08:19:31.574Z","etag":null,"topics":["debugger","debugger-visualizer","geometry","ms-sql-server","spatial","sql-server","trace-viewer","visual-studio","visualizer"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xfischer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-10-27T23:16:18.000Z","updated_at":"2022-09-16T10:27:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"406fb976-bba2-4aa3-a773-ba283b7e1256","html_url":"https://github.com/xfischer/SqlServerSpatial.Toolkit","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xfischer%2FSqlServerSpatial.Toolkit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xfischer%2FSqlServerSpatial.Toolkit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xfischer%2FSqlServerSpatial.Toolkit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xfischer%2FSqlServerSpatial.Toolkit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xfischer","download_url":"https://codeload.github.com/xfischer/SqlServerSpatial.Toolkit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238955607,"owners_count":19558452,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["debugger","debugger-visualizer","geometry","ms-sql-server","spatial","sql-server","trace-viewer","visual-studio","visualizer"],"created_at":"2024-09-24T18:58:07.018Z","updated_at":"2025-10-30T11:30:19.942Z","avatar_url":"https://github.com/xfischer.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![NuGet Version](http://img.shields.io/nuget/v/SqlServerSpatial.Toolkit.svg?style=flat)](https://www.nuget.org/packages/SqlServerSpatial.Toolkit)\n[![Build status](https://ci.appveyor.com/api/projects/status/github/xfischer/SqlServerSpatial.Toolkit)](https://ci.appveyor.com/project/xfischer/SqlServerSpatial-Toolkit)\n\n# SqlServerSpatial.Toolkit \nGeometry trace for Sql Spatial data + debugger visualizer for SQL Server data types in Visual Studio\n\n ![Viewer](/img/traceviewer.png?raw=true \"Trace Viewer\")\n\n - Debugger visualizer for SqlGeometry and SqlGeography types\n - Extensions methods\n - Custom trace writer with colorful syntax\n - Trace viewer\n\n## Install\nVia NuGet: `Install-Package SqlServerSpatial.Toolkit`\n\n## Using the toolkit\n### Spatial Trace\n\nVery useful when processing geometries. **SpatialTrace** lets you track what is going on along the way.\n\n**Important: Trace will actually write only if a debugger is attached.**\nThis is by design, to avoid tracing in a production environment.\n\n```csharp\nusing SqlServerSpatial.Toolkit;\n\n// Enable tracing\nSpatialTrace.Enable(); \n// Trace sample geometry instance. \n// Works with SqlGeometry, SqlGeography and IEnumerable\u003c\u003e of those\nSpatialTrace.TraceGeometry(geometry, \"Sample geometry with default style\");\n\n// Change styling\nSpatialTrace.SetLineWidth(3); // Current stroke style is 3px wide\nSpatialTrace.SetFillColor(Color.FromArgb(128, 255, 0, 0)); // Fills with red\n\n// Style is applied to subsequent traces \nSpatialTrace.TraceGeometry(geometry, \"Some text\");\n\n// Reset style\nSpatialTrace.ResetStyle();\n```\nThis will generate a SpatialTrace.txt file in running assembly directory.\nYou can directly view this trace by calling\n```csharp\nSpatialTrace.ShowDialog();\n```\n\n### Trace Viewer\n\nOpen the viewer. Drag the file on it like a ninja and drop it like a samuraï, and the trace viewer will show what you haved logged through the SpatialTrace.Trace...\n\n### Debugger Visualizer\n#### Installation\n\n - Copy the following files\n \t- SqlServerSpatial.Toolkit.dll\n \t- SqlServerSpatial.Toolkit.DebuggerVisualizer.VS2013.dll\n \t- Microsoft.SqlServer.Types.dll and the SqlServerTypes directory\n - in Binaries\\Release to either of the following locations: \n\t - VisualStudioInstallPath\\Common7\\Packages\\Debugger\\Visualizers\n\t - My Documents\\VisualStudioVersion\\Visualizers\n - Restart your debugging session\n - More information here [on MSDN](https://msdn.microsoft.com/en-us/library/sb2yca43.aspx).\n\n#### Usage\n\nHover any `SqlGeometry` or `SqlGeography` variable and click on the lens icon. The visualizer will popup and display your geometry. Use mouse to pan and zoom.\n\n![Screen capture](/img/debugvis.png?raw=true \"Screen capture\")\n\n### Extension methods\n\n#### 1. Point enumerator\nEnumerate points in a more natural manner. Here's a look of how it is without the toolkit:\n```csharp\nfor (int i = 1; i\u003c=geom.STNumPoints(); i++)\n{\n\tSqlGeometry point = geom.STPointN(i);\n\t// ... do something with point\n}\n```\nNow, with the toolkit, you can iterate point with a *foreach* syntax:\n```csharp\nforeach(SqlGeometry point in geom.Points())\n{\n\t// ... do something with point\n}\n```\n#### 2. Geometry parts enumerator\nEnumerate parts of a geometry. Here's a look of how it is without the toolkit:\n```csharp\nfor (int i = 1; i \u003c= geom.STNumGeometries(); i++)\n{\n\tSqlGeometry geometryPart = geom.STGeometryN(i);\n\t// ... do something with geometryPart\n}\n```\nNow, with the toolkit:\n```csharp\nforeach (SqlGeometry geometryPart in geom.Geometries())\n{\n\t// ... do something with geometryPart\n}\n```\n#### 3. Polygon helpers\nYou can handle polygon interior rings easily:\n```csharp\nbool hasInteriorRings = polygon.HasInteriorRings();\nforeach(SqlGeometry ring in geom.InteriorRings())\n{\n\t// ... do something with ring\n}\n```\n#### 4. `MakeValidIfInvalid()` helper\n`MakeValid()` can create strange artefacts and awkward geometries. The `MakeValidIfInvalid()` method will help you.\nIt takes two parameters:\n- **retainDimension** : guarantees that every geometry returned will be at least of the specified dimension. For example, `MakeValid()` or `Reduce()` sometimes returns a geometry collection object with lines, points and polygons. Calling `MakeValidIfInvalid(2)` will guarantee that lines and points are removed.\n- **minimumRatio** : guarantees that every geometry under this ratio will not be returned. For example, if you have a geometry collection with a 10000m² polygon and 0.5m² negligible polygon, you can call `MakeValidIfInvalid(2, 0.00001)` and this polygon will be removed.\n\n#### 5. Serialization helpers\nYou can save and load SqlGeometry from disk:\n```csharp\n// Loads SqlGeometry from disk\nSqlGeometry geom = SqlTypesExtensions.Read(\"file.bin\");\n\n// Save SqlGeometry to disk\ngeom.Save(\"file.bin\");\n\n// Loads a list of SqlGeometry from disk\nList\u003cSqlGeometry\u003e geometries = SqlTypesExtensions.ReadList(\"file.bin\");\n\n// Saves a list of SqlGeometry to disk\ngeometries.Save(\"file.bin\");\n```\n## How to build the toolkit from source\n\n - Grab the repo\n - Choose the solution matching your Visual Studio version (VS2013 or VS2015)\n - Restore NuGet packages (Microsoft.SqlServer.Types and DotSpatial.Projections)\n - Build. Binaries are generated in Binaries directory\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxfischer%2Fsqlserverspatial.toolkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxfischer%2Fsqlserverspatial.toolkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxfischer%2Fsqlserverspatial.toolkit/lists"}