Questions tagged [nettopologysuite]

NetTopologySuite is a direct-port of all the functionalities offered by the [JTS] Topology Suite

NetTopologySuite is a direct-port of all the functionalities offered by the JTS Topology Suite. NTS exposes JTS in a '.NET way', as example using Properties, Indexers etc...

An excerpt from the JTS website explains the capabilities of NetTopologySuite:
"The JTS Topology Suite is an API for modelling and manipulating 2-dimensional linear geometry. It provides numerous geometric predicates and functions. JTS conforms to the Simple Features Specification for SQL published by the Open GIS Consortium."

138 questions
1
vote
1 answer

Convert GeoJson to FeatureCollection and save in NetTopologySuite.Geometries.Geometry column using ef core 5

I have a model named Layer.cs and it has a property named Geometry like: public NetTopologySuite.Geometries.Geometry Geometry { get; set; } I want to convert a sample GeoJson file (you can find it HERE) to feature collection…
1
vote
1 answer

How do I configure a custom converter that returns json, instead of a string, in NewtonSoft.Json?

I have a simple model that contains a NetTopologySuite Polygon: public class MyModel { [Newtonsoft.Json.JsonConverter(typeof(MyPolygonConverter))] public NetTopologySuite.Geometries.Polygon poly { get; set; } } And I've build a custom…
Jeff Dege
  • 11,190
  • 22
  • 96
  • 165
1
vote
0 answers

How do I use Spatial types, in Entity Framework 6.4, in .NET 5.0?

We're trying to port a .NET 4.5.2 project to 5.0. My particular problem is to get the spatial queries to work. The existing code makes extensive use of the System.Data.Entity.Spatial.DbGeometry type, which doesn't seem to be available in .NET…
Jeff Dege
  • 11,190
  • 22
  • 96
  • 165
1
vote
2 answers

Multipolygon support in Lucene .net

I am trying to learn lucene .net spatial capabilities . I want to find if a point exist inside a multi-polygon or not. From my studies on google, I understand I need to use Net topology suite to describe the multi polygon. but i am unable to find…
user2799564
  • 147
  • 2
  • 8
1
vote
0 answers

Distance between two arbitrary WGS84 geometries

I have a .NET Core 3.1 (soon to be .NET 5) app where I use NetTopologySuite to work with spatial data. The task at hand is to find distance between a pair of arbitrary NTS Geometries (let's say a Point and MultiLineString). Both are in WGS84. I need…
Dmytro Gokun
  • 405
  • 3
  • 24
1
vote
1 answer

.NET TopologySuite & ProjNet problem with LineString length calculation

I have below code in order to compute distance from A(60.054166, -35.542222) to B(-48.175833, -8.541111). Above coordinates are in EPSG:4326 system (which is the standard GPS Lat/Lon coordinates). Default unit of measure is angle, so I transform…
Jimi
  • 198
  • 2
  • 13
1
vote
2 answers

How to send data from ajax to a base controller method that runs on every visited page

I want user's latitude and longitude to be updated on every page visited. In order not to duplicate things, I created a base controller where I also implemented the onActionExecuting which allows the method to run every time on every action from the…
Qudus
  • 1,440
  • 2
  • 13
  • 22
1
vote
1 answer

Cannot find polygons within polygons using spatial LINQ queries

I loaded this (Quebec) OSM PBF file in my PostgreSQL database and from a .NET Core Web Api, I'm trying to do basic queries, like finding polygons within a specified area, but getting no results. I have scaffolded a DbContext using this…
Francis Ducharme
  • 4,848
  • 6
  • 43
  • 81
1
vote
1 answer

Remove bbox field of GeoJSON using NetTopologySuite

In a .NET Core 3 WebAPI project, I'm creating a FeatureCollection using NetTopologySuite. Then I serialize to a GeoJSON response. Full code below: using System.Collections.Generic; using System.Linq; using Microsoft.AspNetCore.Mvc; using…
Giox
  • 4,785
  • 8
  • 38
  • 81
1
vote
0 answers

How to use/translate NetTopologySuite geomety to GeoJSON for use in Web API

I am using NetTopologySuite 2.0 and I would like to return some geo data thru my Web API. I would like to use GeoJSON for DTOs, but I can not find any GeoJSON model which is compatible with NTS. I know there exist NTS reader/writer for GeoJSON, but…
Rok
  • 451
  • 3
  • 21
1
vote
1 answer

Cannot call methods on varbinary using nettopologysuite

I try to request my db with efcore and linq but I have the error: Cannot call methods on varbinary. I can't sort it out. The code is: places .Where(p => p.Place.Location != null && p.Place.Location.Distance(currentLocation)<=input.Radius) .OrderBy(p…
dalton5
  • 915
  • 2
  • 14
  • 28
1
vote
1 answer

Calculate distance between to points(lat, lon) with NetTopologySuite

I followed this article https://learn.microsoft.com/en-us/ef/core/modeling/spatial but is not working. var seattle = new Point(-122.333056, 47.609722) { SRID = 4326 }; var redmond = new Point(-122.123889, 47.669444) { SRID = 4326 }; var distance =…
1
vote
1 answer

NetTopologySuite ShapeDataReader Error: Unsupported DBF reader Type 13

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…
Raul
  • 167
  • 9
1
vote
1 answer

Mapping geometries with EF Core 2.2, Npgsql and NetTopologySuite

I`m trying to map this class: using NetTopologySuite.Geometries; using System.Collections.Generic; namespace Project.API.Models { public class Geo { public int Id { get; set; } public IEnumerable Geometries{ get;…
1
vote
0 answers

EF Core 2.2.6 query doesn't work when trying to use NetTopologySuite

I'm trying to use NetTopologySuite with EF Core 2.2.6 to perform a geographical search. I've successfully added a location Point to my model, and EF Core can read and write this property. However, when I try to add this predicate to my query I see…
James
  • 2,404
  • 2
  • 28
  • 33