Skip to content
This repository has been archived by the owner on Mar 9, 2021. It is now read-only.

contains method only works with Primitives, doesn't work with Terraformer.Circle #281

Closed
cordovapolymer opened this issue Oct 13, 2016 · 2 comments · Fixed by #282
Closed

Comments

@cordovapolymer
Copy link

Terraformer contains and within methods work only with Primitives, and doesn't work with Terraformer.Circle which is a Feature, so it's usage example in docs is confusing.

In the following example only within2 returns true;

var circle = new Terraformer.Circle([10, 10], 5000000, 64);

var rectanglePrimitive = new Terraformer.Polygon({
            type: "Polygon",
            coordinates: [[[-10, -10], [10, -10],
                          [10, 10], [-10, 10]]]
          });

var contains = circle.contains(rectanglePrimitive);
var within = circle.within(rectanglePrimitive);
var contains2 = rectanglePrimitive.contains(circle.geometry);
var within2 = rectanglePrimitive.within(circle.geometry);
var contains3 = circle.contains(mapBounds);
var within3 = circle.within(mapBounds);
var contains4 = mapBounds.contains(circle.geometry);
var within4 = mapBounds.within(circle.geometry);
var contains5 = rectanglePrimitive.contains(circle);
var within5 = rectanglePrimitive.within(circle);
@jgravois
Copy link
Collaborator

jgravois commented Oct 13, 2016

thanks for pointing out the problem.
Terraformer.Circle and Terraformer.Feature are both Primitives so lets just make it work.

@jgravois
Copy link
Collaborator

1.0.7 contains the fix. thanks again.

https://github.com/Esri/Terraformer/releases/tag/v1.0.7

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants