nettopologysuite

How to index (ingest) geo data (Geometry, GeometryCollection) as GeoShape in ElasticSearch with C#, Nest, NetTopologySuite from GeoJson file / string?

久未见 提交于 2021-01-29 15:41:36
问题 Summary I want to to properly index (ingest) geo data (Geometry, GeometryCollection) as GeoShape in ElasticSearch using C#, Nest and NetTopologySuite (NTS) from GeoJson files or string representations. I'm using the following stack: ElasticSearch 7.10.1 NEST 7.10.1 NetTopologySuite 2.1.0 NetTopologySuite.IO.GeoJSON 2.0.4 In my GitHub GIST you can find the two sample files (postal-area.geojson and the geojson file as a sample for Scenario #7) along with the code presented bellow with what i've

InvalidCastException after upgrading to EF Core 5.0

时光总嘲笑我的痴心妄想 提交于 2021-01-29 07:05:28
问题 I've just upgraded my project from .NET Core 3.1 to .NET 5.0 and updating all packages to the latest version. All built fine, but now I'm having trouble loading some entities, getting this error: Unable to cast object of type 'Microsoft.EntityFrameworkCore.Query.Internal.BufferedDataReader' to type 'Microsoft.Data.SqlClient.SqlDataReader'.' I'm not certain, but I have a couple of entities which have an Address property which is an [Owned] type which has a NetTopologySuite.Geometries.Point

Entity Framework Core 3.1 with NetTopologySuite.Geometries.Point: SqlException: The supplied value is not a valid instance of data type geography

*爱你&永不变心* 提交于 2020-07-09 04:37:27
问题 I have a model that looks like this: public class Facility { [Key] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id { get; set; } public NetTopologySuite.Geometries.Point Location { get; set; } } Test code for adding a Point: var testFacility = new Facility(); testFacility.Location = new NetTopologySuite.Geometries.Point(13.003725d, 55.604870d) { SRID = 3857 }; //Other values tested with the same error error //testFacility.Location = new NetTopologySuite.Geometries.Point(13

Having trouble serializing NetTopologySuite FeaturesCollection to GeoJSON

女生的网名这么多〃 提交于 2020-05-14 18:18:08
问题 Trying to return some pretty simple GeoJSON data. I found NetTopologySuite, and set up a simple FeaturesCollection and tried to serialize it out to a GeoJson string only to get the following error: "Self referencing loop detected for property 'CoordinateValue' with type 'GeoAPI.Geometries.Coordinate'. Path 'Features[0].Geometry.Coordinates[0]'." Looking through the class headers, Point uses Coordinate, which does have a Coordinate property so I can see why there would be a circular reference.

NetTopologySuite Geometry&WKT&WKB&GeoJSON互转

送分小仙女□ 提交于 2020-04-23 13:11:00
WKT To WKB private static byte[] ConvertWKTToWKB(string wkt) { WKBWriter writer = new WKBWriter(); WKTReader reader = new WKTReader(); var wkb = writer.Write(reader.Read(wkt)); return wkb; } WKB To WKT private static string ConvertWKBToWKT(byte[] wkbBytes) { WKBReader reader = new WKBReader(); WKTWriter writer = new WKTWriter(); var wktText = writer.Write(reader.Read(wkbBytes)); return wktText; } WKT To Geometry WKTReader reader = new WKTReader(); NetTopologySuite.Geometries.Geometry geom = reader.Read(WKTText); GeoJSON To Geometry //引用NetTopologySuite.IO.GeoJSON //https://github.com

NetTopologySuite ShapeDataReader Error: Unsupported DBF reader Type 13

萝らか妹 提交于 2020-01-25 06:50:08
问题 I'm trying to read an .shp that I created from geojson.io to do some tests, it gave me an .zip which contains the files below. When I try to read the .shp alone I'm having the error: "System.IO.FileNotFoundException: '.../POLYGON.dbf'". When I try to read the .shp with the .dbf in the same folder I'm having the error: "System.NotSupportedException: 'Unsupported DBF reader Type 13'". I tried to open this .shp in QGIS and it worked. I tried to read other .shp files from other sources with my

How to seed NetTopologySuite.Geometries.Point data from a Json file in ASP.Net core

て烟熏妆下的殇ゞ 提交于 2019-12-23 10:56:06
问题 I want to seed "Location" data for my user object from my seed file The c# object, where Point is a NetTopologySuite.Geometries.Point is part of my user object public class User: IdentityUser<int> { // member data here public Point Location { get; set; } // has lat/lng data points } I seed data to my db on startup by doing something like this public void SeedUsers() { if (!_userManager.Users.Any()) { var userData = System.IO.File.ReadAllText("Data/UserSeedData.json"); var users = JsonConvert