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
5
votes
2 answers

How to get the distance of two point geometry in meters using NetTopologySuite?

How to get the distance of two point geometry in meters using NetTopologySuite. I have used the Distance() function, but I'm getting some values and I couldn't identify the unit of those values. Its for a c# application to neglect the tolerance…
Anzeem S N
  • 141
  • 1
  • 8
4
votes
2 answers

Calculate geographic distance between points using NetTopologySuite

I am trying to calculate distance between two points using NetTopologySuite. Since I am referencing Microsoft documentation, I Came up with following GeometryExtension and GeometryHelper classes: public static class GeometryExtensions { …
Filip Skukan
  • 531
  • 1
  • 7
  • 18
4
votes
1 answer

IsWithinDistance could not be translated

I'm trying to return a list of items that are within say 50 Miles of a given location. My table (simplified) is as follows: Id Longitude Latitude Status Active I've got an initial query: var query = db.MyTable.Where(o=> o.Status == "New" &&…
4
votes
0 answers

Is it possible to intersect/clip line with polygon using .NetTopologySuite?

I have question regarding intersecting line segment with polygon. I have some line (green) that represents some walking path and some restriction polygon (black) that represents polygon. You can see in image below: I'm now wondering if it is…
Svinjica
  • 2,389
  • 2
  • 37
  • 66
4
votes
2 answers

Why NetTopologySuite v2.0 does not implement GeoAPI?

What is happening with version 2.0 of Net Topology Suite? My main considerations are: It does not anymore implement Geo API (i like the idea of it) Where is ICoordinateSystem interface (how can I make transform geometry from one coordinate system…
Rok
  • 451
  • 3
  • 21
3
votes
1 answer

How to read Shapefile's prj file?

I'm reading the shp file using NetTopologySuite.IO.ShapefileDataReader, but believe I also need to process the prj file. Is there an api to read the prj file? (The prj file is mentioned here: https://en.wikipedia.org/wiki/Shapefile) I've tried…
Alex B
  • 33
  • 4
3
votes
2 answers

Is it possible to serialize Nettopologysuite geometry to GeoJSON through GeoJSON4STJ?

Hi I have been trying to serialize a polygon to a variable using GeoJSON4STJ for Nettopologysuite. So far deserialization works fine, but I am unable to serialize it. Is there any way to do this? I have added the following code to the startup file…
3
votes
2 answers

NetTopologySuite said that geometry is not valid, but Sql Server said that it's valid

I have polygon: polygon((0 0, 1 0.1, 1 1, 0.5 1, 0.5 1.5, 1 1, 1.5 1.5, 1.5 1, 1 1, 1.5 0.5, 1 0.1, 2 0, 2 2,0 2, 0 0)) For sure it's not looks normal, but Sql Server 2017 said that it's valid. But when i tried to read it with NTE it's say that it…
Kliver Max
  • 5,107
  • 22
  • 95
  • 148
3
votes
1 answer

How to create one or more polygons from OpenStreetMap boundary relation in C#?

I am using OSMSharp (C# OpenStreetMap library) to get the boundary of a region (e.g. a city, state) from an osm.pbf file. The structure I get is a Relation containing Ways which consists of Nodes. The Ways contains a set of WGS84 points (lat.,…
Ton Snoei
  • 2,637
  • 22
  • 23
3
votes
2 answers

Self referencing loop while trying to use Hangfire

I'm developing an Web API in ASP.NET Core and we found ourselves in the need of running a background task for a large bulk insert operation. The model I'm inserting however contains a property of the Geometry type from the .NET Topology Suite.…
makoshichi
  • 2,310
  • 6
  • 25
  • 52
3
votes
0 answers

Using .NetTopologySuite to convert a GeoJson Multipolygon to a single Polygon

We have a GeoJson Multipolyogn((( etc. etc. We need to convert this to a single polygon. We have looked at the .NetTopologySuite but cannot figure out if this is possible. It seems if you already have several polygons you can use union to create a…
user2981411
  • 859
  • 12
  • 34
3
votes
1 answer

write a 2d shape file with NetTopologySuite

I created a routine that writes correctly shape files, but I have a problem: the shape is a 3d, but I need to write a 2d shape file. How can I do this? thanks
Luca Morelli
  • 2,530
  • 3
  • 28
  • 45
3
votes
1 answer

Fast find if points belong to polygon (NetTopologySuite.Geometries, C#. .net core 2.2)

Is there an efficient way to find points of type NetTopologySuite.Geometries.Point that are inside given polygon of type NetTopologySuite.Geometries.PointPolygon using .net core 2.2. I tried following the documentation below, but no luck:…
Goran
  • 43
  • 1
  • 6
3
votes
2 answers

Got NotSupportedException when using Dapper to call a PostgreSQL function with a geography argument

I was using Dapper (using npgsql data provider with NetTopologySuite plugin) to call a PostgreSQL function with a geography argument then received a NotSupportedException: System.NotSupportedException: The member _location of type…
phqb
  • 351
  • 3
  • 14
3
votes
1 answer

Find if Lat Long position is in a shape in an esri shapefile

I am trying to use the Net Topology Suite (v 1.13.2) in a simple console app to find points in a shape file that contains road information. I have loaded the shape file and stored the data in a typed list, and I have checked that the data looks as…
AndrewS
  • 369
  • 5
  • 19
1
2
3
9 10