Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repository structure #1

Closed
KubaSzostak opened this issue Mar 24, 2022 · 8 comments
Closed

Repository structure #1

KubaSzostak opened this issue Mar 24, 2022 · 8 comments
Labels
question Further information is requested

Comments

@KubaSzostak
Copy link
Member

Before I get started I would like clarify proposed repository structure.

  1. My Wip/redo everything NetTopologySuite.IO.ShapeFile#69 pull request introduced two new VS projects: NetTopologySuite.IO.Esri.Core and NetTopologySuite.IO.Esri. The former provides shapefile readers and writers as vanilla .NET Standard 2.0 library without any dependencies. The latter is a wrapper around Core project which gives NTS geometries instead of bunch of collections of coordinates. This separation causes some issues. For example coordinates are first loaded into plain Array and then copied to NTS' CoordinateSequence. It would be more efficient to load them directly from binary into CoordinateSequence. Furthermore the Core project doesn't contain any geometry logic (line length, polygon area, ...). Because of that some issues will be very hard to fix directly in Core project. For example fixing Cannot read a polygon with a hole from a ShapeFile NetTopologySuite.IO.ShapeFile#70 will be much easier having NTS' LinearRing.IsCCW property. For that reasons I would like to combine those two projects into one project which is tightly integrated with NTS library.
  2. We can consider moving dBASE part into separate project without NTS dependencies. After doing so one would be able to read/write dBASE tables without referencing NTS dependencies. As my implementation uses "Esri flavored" dBASE format it fits to this repository very well.
  3. I'm not a fan of maintaining NetTopologySuite.IO.GDB anymore
  4. Project naming convention - shouldn't the project names correspond strictly to NetTopologySuite.IO.Esri?
    • NetTopologySuite.IO.Esri.Shapefile
    • NetTopologySuite.IO.Esri.GDB
    • [NetTopologySuite.IO.Esri.Dbase]
    • [NetTopologySuite.IO.Esri.EnterpriseGeodatabase]

What do you think, @FObermaier?

@KubaSzostak KubaSzostak added the question Further information is requested label Mar 24, 2022
@airbreather
Copy link
Member

airbreather commented Mar 24, 2022

For example coordinates are first loaded into plain Array and then copied to NTS' CoordinateSequence. It would be more efficient to load them directly from binary into CoordinateSequence.

If this were the only concern, then perhaps you could give RawCoordinateSequenceFactory a try? CommunityToolkit.HighPerformance includes some helpers that should let you reinterpret any Memory<byte> as a Memory<double>, then you could create a CoordinateSequence wrapping it.

I expect a little bit of a performance penalty compared to some other sequence types when the Geometry is actually used, but it may well be worth it to avoid full copies...

@KubaSzostak
Copy link
Member Author

Thank you @airbreather for your comment. Storing coordinates in efficient way is a big concern for me to. I'm not familiar with all different types of geometry factories, so I was going to require GeometryFactory in the constructor and use NtsGeometryServices.Instance.CreateGeometryFactory() if null provided.

public ShpStreamBase(ShapeType shapeType, GeometryFactory factory)
{
    ...  
    Factory = factory ?? NtsGeometryServices.Instance.CreateGeometryFactory();
    ...  
}

internal CoordinateSequence GetCoordinateSequence(int size)
{
    return Factory.CoordinateSequenceFactory.Create(...);
}

You mean I should always use RawCoordinateSequenceFactory? In my project I have referenced NetTopologySuite 2.0.0 and RawCoordinateSequenceFactory isn't visible within NetTopologySuite.Geometries.Implementation namespace. Should I upgrade NTS version? To which one?

@FObermaier
Copy link
Member

A few notes:

@DGuidi
Copy link

DGuidi commented Mar 25, 2022

I'm not sure (and probably any new consumer of the library won't be) which GDB is actually implemented

Looking at the docs it "Writes features as ESRI GeoDatabase binary format in a SqlServer database", looking at the code it simply extends snts.io.shp ShapeReader/Writer and adds almost nothing.

So I can assume that ESRI binary format is exactly the shapefile geometry format, stored in a sql column. +1 to leave this code in the deprecated library, at least for now.

@FObermaier
Copy link
Member

@KubaSzostak if you are already working on this topic I encourage you to let us take part in the process.

@KubaSzostak
Copy link
Member Author

KubaSzostak commented Mar 28, 2022

I have started working on merging and cleaning up the projects at the weekend. I will push the code within the next few days.

@KubaSzostak
Copy link
Member Author

KubaSzostak commented Mar 31, 2022

Initial commit

@FObermaier
Copy link
Member

Thanks @KubaSzostak !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants