Giter Club home page Giter Club logo

geometryconversions's Introduction

GeometryConversions

Provides conversion between ArcGIS Runtime Geometry and other Geometry data objects.

Currently supported dataformats:

  • To and from Well-known Binary
  • To and from System.Spatial Geometry Type
  • To and from System.Spatial Geography Type
  • To and from Sql Server Spatial Geometry Type (Windows Desktop only)
  • To and from Sql Server Spatial Geography Type (Windows Desktop only)

System.Spatial supports conversion for GML, GeoJSON and Well-known Text*, so these formats can be accomplished using System.Spatial as an intermediary format. Future plans might include direct conversion support to reduce overhead.





*Please use Well-Known Binary instead of Well-Known Text. Every time someone uses WKT instead of WKB, a baby-seal gets clubbed to death.

geometryconversions's People

Contributors

dotmorten avatar mstefarov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

geometryconversions's Issues

SqlServerConverter.ReadGeometry

I think I found a few issues in SqlServerConverter.ReadGeometry, perhaps its because we're using different version of SQL Server, but I had to make these changes to get it to work:

In ReadGeometryPolygon I had to change
.Select(i => poly.STExteriorRing().STPointN(i))
to
.Select(i => poly.STExteriorRing().STPointN(i+1))
In the docs I could find STPointN starts with index of 1 (Not 0)

Similarly, in ReadGeometryMultiPolygon I had to add +1 to these lines because of the index starting at 1 and not 0.
var poly = mpoly.STGeometryN(j+1);
.Select(i => poly.STExteriorRing().STPointN(i+1))

Also, I do not understand what this line was doing:
rings.AddRange(rings);
It's just adding a empty ring. And outerRing is not getting added at all. I changed it to this, and it seems to work:
rings.Add(outerRing);

Utilities.SplitMultiPolygon Bug

I seem to have found a logic issue with the SplitMultiPolygon method in GeometryConversions.Shared.Utilities.

The 1st issue that I found is that on line 19, where the ring is returned as points and IsCcw is being called. IsCcw executes as expected, but the if condition checks if the evaluation is true. In my opinion, this should be changed to
if (!IsCcw(ring.GetPoints()))
{
outerRings.Add(new Tuple<ReadOnlySegmentCollection, IList>(ring, new List()));
}
else
innerRings.Add(ring);
}

The 2nd identified issue, is that a System.IO exception is thrown at the end of the foreach loop that traverses the innerRings, on line 37

Wrong index results in orientation error

Hello, Morten- I have had the luck of having some really strange geometry in some testing I've been doing, and one of the polygons was reported by your code as having the ring orientation wrong. This was the result of the IsCcw() method using an incorrect index for the points used in determining the cross product. It computed an outer ring to be counter-clockwise when it actually wasn't.

Quick fix- change the index offset in line 72 in utilities.cs from 2 to 1.

Cheers!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.