0

I have an in-house .NET library which processes geometry data in GeoAPI form (https://github.com/NetTopologySuite/GeoAPI). Within this library I have a method which I need to call which is expecting a GeoAPI.Geometries.IGeometry parameter.

I'm processing OSM PBF data using the PbfReader in SpatialLite.Osm (http://spatial.litesolutions.net/index.html). This gives me objects which implement SpatialLite.Core.API.IGeometry.

My question is how can acheive a conversion from SpatialLite.Core.API.IGeometry to GeoAPI.Geometries.IGeometry? I've made a few searches and found nothing to help me. I can go about creating a conversion procedure myself but it strikes me that there might be a better way.

Any suggestions?

2 Answers 2

1

Use a common geometry binary/wire format that both GeoAPI and SpatialLite.Core can understand, like WKB or WKT

Then have your GeoAPI geometry output to WKB/WKT and have your WKB/WKT reader class from SpatialLite.Core read from the WKB/WKT

1
  • WKB (or EWKB if the GeoAPI reader supports it) would be a better bet than WKT.
    – BradHards
    Mar 29, 2016 at 6:41
0

Exporting to WKB and parsing that using NetTopologySuite's WKB Reader is one way to go, you could also use a converter like this: https://github.com/NetTopologySuite/NetTopologySuite/tree/master/NetTopologySuite.Converter/NetTopologySuite.Converter.SpatialLite

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.