-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #63 from Geodan/add_multiple_source_epsg_codes_sup…
…port add multiple source epsg code support
- Loading branch information
Showing
5 changed files
with
50 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System.Data; | ||
|
||
namespace i3dm.export; | ||
public static class DatabaseReader | ||
{ | ||
public static int ReadScalar(IDbConnection conn, string sql) | ||
{ | ||
conn.Open(); | ||
var command = conn.CreateCommand(); | ||
command.CommandText = sql; | ||
var reader = command.ExecuteReader(); | ||
reader.Read(); | ||
var scalar = reader.GetInt32(0); | ||
reader.Close(); | ||
conn.Close(); | ||
return scalar; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System.Data; | ||
|
||
namespace i3dm.export; | ||
public static class SpatialReferenceRepository | ||
{ | ||
public static int GetSpatialReference(IDbConnection conn, string geometry_table, string geometry_column, string query = "") | ||
{ | ||
var q = query == "" ? "" : $"WHERE {query}"; | ||
var sql = $"SELECT ST_SRID({geometry_column}) from {geometry_table} {q} limit 1"; | ||
var sr = DatabaseReader.ReadScalar(conn, sql); | ||
return sr; | ||
} | ||
} |