Skip to content

Simple Polygon not working for this test case #1

@bosborn

Description

@bosborn

Discussed in ngageoint/simple-features-geojson-java#6

Screenshot 2023-01-12 at 13 39 01

@Test
public void test() {

	LineString ring = new LineString();
	ring.addPoint(new Point(119.65450502825215, 234.97190110269844));
	ring.addPoint(new Point(120.94208471603682, 241.47274889005215));
	ring.addPoint(new Point(120.57389187028015, 240.42380619065557));
	ring.addPoint(new Point(120.40553233952696, 239.3249423106921));
	ring.addPoint(new Point(120.44278575100797, 238.2138802324909));
	ring.addPoint(new Point(120.68437322950616, 237.12876169126298));
	ring.addPoint(new Point(121.12200129996195, 236.1068378045508));
	ring.addPoint(new Point(121.74064659481407, 235.18319027576013));
	ring.addPoint(new Point(122.51907159233552, 234.38952707167576));
	Polygon polygon = new Polygon();
	polygon.addRing(ring);

	TestCase.assertFalse(polygon.isSimple());
}

Must be a bug in the ported code. The original code has been take down, but this npm library seems to work for that case.

const isSimple = require('shamos-hoey')

const box = {type: 'Polygon', coordinates: [[
[119.65450502825215, 234.97190110269844], 
[120.94208471603682, 241.47274889005215], 
[120.57389187028015, 240.42380619065557], 
[120.40553233952696, 239.3249423106921], 
[120.44278575100797, 238.2138802324909], 
[120.68437322950616, 237.12876169126298], 
[121.12200129996195, 236.1068378045508], 
[121.74064659481407, 235.18319027576013], 
[122.51907159233552, 234.38952707167576]]]}
isSimple(box)

false

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions