Code Monkey home page Code Monkey logo

geometry-api-java's Introduction

Build Status

geometry-api-java

The Esri Geometry API for Java can be used to enable spatial data processing in 3rd-party data-processing solutions. Developers of custom MapReduce-based applications for Hadoop can use this API for spatial processing of data in the Hadoop system. The API is also used by the Hive UDF’s and could be used by developers building geometry functions for 3rd-party applications such as Cassandra, HBase, Storm and many other Java-based “big data” applications.

Features

  • API methods to create simple geometries directly with the API, or by importing from supported formats: JSON, WKT, and Shape
  • API methods for spatial operations: union, difference, intersect, clip, cut, and buffer
  • API methods for topological relationship tests: equals, within, contains, crosses, and touches

Instructions

Building the source:

  1. Download and unzip the .zip file, or clone the repository.
  2. To build the jar, run the mvn compile command-line command from within the cloned directory.
  3. Deploy the esri-geometry-api.jar to the target system, add a reference to it in a Java project.
  4. To run the unit-tests, run the mvn test command-line command from within the cloned directory.

The project is also available as a Maven dependency:

<dependency>
  <groupId>com.esri.geometry</groupId>
  <artifactId>esri-geometry-api</artifactId>
  <version>2.2.4</version>
</dependency>

Requirements

  • Java JDK 1.6 or greater.
  • Apache Maven build system.
  • Experience developing MapReduce applications for Apache Hadoop.
  • Familiarity with text-based spatial data formats such as JSON or WKT would be useful.

Documentation

Resources

Issues

Find a bug or want to request a new feature? Please let us know by submitting an issue.

Contributing

Esri welcomes contributions from anyone and everyone. Please see our guidelines for contributing

Licensing

Copyright 2013-2019 Esri

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

A copy of the license is available in the repository's license.txt file.

geometry-api-java's People

Contributors

alocke avatar climbage avatar danio avatar davidraleigh avatar desruisseaux avatar doneill avatar erikhoel avatar estoianovici avatar fabian-maysen avatar geographist avatar gisdev01 avatar johansettlin avatar kenil121200 avatar kjkrum avatar mbasmanova avatar panchenko avatar randallwhitman avatar satish-csi avatar satol avatar sllynn avatar snodnipper avatar stolstov avatar tcalmant avatar tdcmeehan avatar tlpinney avatar willtemperley avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

geometry-api-java's Issues

Export to GeoJSON: Expected MultiLineString but got LineString

When exporting a MultiLineString to GeoJSON, I expected MultiLineString, but got LineString.

        String wkt = "multilinestring((1 1,2 2,3 3),(7 7,8 8,9 9))";
        OGCGeometry og0 = OGCGeometry.fromText(wkt);
        og0.setSpatialReference(null);
        System.out.println(og0.asText());  // MultiLineString, as expected
        String outJson = og0.asGeoJson();
        System.out.println(outJson);  // expect MultiLineString, got LineString
        OGCGeometry og1 = OGCGeometry.fromGeoJson(outJson);
        System.out.println(og1.asText());  // expect MultiLineString, got LineString

This impacts ST_AsGeoJSON in spatial-framework-for-hadoop: Esri/spatial-framework-for-hadoop#10 .

Can't find operator intersects

Hi,
I am trying to use Operator Intersects but GeometryEngine does not have an intersects that returns boolean.
There is a intersect (returns Geometry) but no intersects.
Is it a new addition that will only be available for the new release.(But documented early.)

Thanks
Manas

Scala: Can not create Line using new Line() constructor

Hi,
I am trying to use ESRI api to create Line from two points using scala.
If I try the following line
val line = new Line() // same as trying "Line line = new Line() in java"
I get a stack trace on my scala interpreter.

I am using esri geometry api version = 1.2
When I create point or polygon I don't get any crash. Only when I try Line I get this stack trace.
The problem can't be as big as the constructor is bad; I think I am doing something wrong just can't figure out what?

The stack trace that I get is copied below:

com.esri.core.geometry.GeometryException: invalid call
atcom.esri.core.geometry.JsonStringWriter.start(JsonStringWriter.java:264)

atcom.esri.core.geometry.JsonStringWriter.next(JsonStringWriter.java:235)_
atcom.esri.core.geometry.JsonStringWriter.getJson(JsonStringWriter.java:30)
atcom.esri.core.geometry.OperatorExportToJsonCursor.exportToString(OperatorExportToJsonCursor.java:65)
atcom.esri.core.geometry.OperatorExportToJsonCursor.next(OperatorExportToJsonCursor.java:57)
atcom.esri.core.geometry.OperatorExportToJsonLocal.execute(OperatorExportToJsonLocal.java:40)
atcom.esri.core.geometry.Geometry.toString(Geometry.java:572)
atscala.runtime.ScalaRunTime$.scala$runtime$ScalaRunTime$$inner$1(ScalaRunTime.scala:324)
atscala.runtime.ScalaRunTime$.stringOf(ScalaRunTime.scala:329)
atscala.runtime.ScalaRunTime$.replStringOf(ScalaRunTime.scala:337)
at.(:10)
at.()
at$print()
atsun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
atsun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
atsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
atjava.lang.reflect.Method.invoke(Method.java:606)
atscala.tools.nsc.interpreter.IMain$ReadEvalPrint.call(IMain.scala:734)
atscala.tools.nsc.interpreter.IMain$Request.loadAndRun(IMain.scala:983)
atscala.tools.nsc.interpreter.IMain.loadAndRunReq$1(IMain.scala:573)
atscala.tools.nsc.interpreter.IMain.interpret(IMain.scala:604)
atscala.tools.nsc.interpreter.IMain.interpret(IMain.scala:568)
atscala.tools.eclipse.interpreter.EclipseRepl$DefaultBuilder$$anon$1.interpret(EclipseRepl.scala:152)
atscala.tools.eclipse.interpreter.EclipseRepl.scala$tools$eclipse$interpreter$EclipseRepl$$doit(EclipseRepl.scala:233)
atscala.tools.eclipse.interpreter.EclipseRepl.scala$tools$eclipse$interpreter$EclipseRepl$$add(EclipseRepl.scala:212)
atscala.tools.eclipse.interpreter.EclipseRepl$$anonfun$act$1$$anonfun$applyOrElse$1.apply(EclipseRepl.scala:266)
atscala.tools.eclipse.interpreter.EclipseRepl$$anonfun$act$1$$anonfun$applyOrElse$1.apply(EclipseRepl.scala:266)
atscala.tools.eclipse.interpreter.EclipseRepl$$anonfun$scala$tools$eclipse$interpreter$EclipseRepl$$safely$1$$anonfun$apply$mcV$sp$1.apply$mcV$sp(EclipseRepl.scala:252)
atscala.tools.eclipse.interpreter.EclipseRepl$$anonfun$scala$tools$eclipse$interpreter$EclipseRepl$$safely$1$$anonfun$apply$mcV$sp$1.apply(EclipseRepl.scala:252)
atscala.tools.eclipse.interpreter.EclipseRepl$$anonfun$scala$tools$eclipse$interpreter$EclipseRepl$$safely$1$$anonfun$apply$mcV$sp$1.apply(EclipseRepl.scala:252)
atscala.util.DynamicVariable.withValue(DynamicVariable.scala:57)
atscala.Console$.withErr(Console.scala:167)
atscala.tools.eclipse.interpreter.EclipseRepl$$anonfun$scala$tools$eclipse$interpreter$EclipseRepl$$safely$1.apply$mcV$sp(EclipseRepl.scala:251)
atscala.tools.eclipse.interpreter.EclipseRepl$$anonfun$scala$tools$eclipse$interpreter$EclipseRepl$$safely$1.apply(EclipseRepl.scala:251)
atscala.tools.eclipse.interpreter.EclipseRepl$$anonfun$scala$tools$eclipse$interpreter$EclipseRepl$$safely$1.apply(EclipseRepl.scala:251)
atscala.util.DynamicVariable.withValue(DynamicVariable.scala:57)
atscala.Console$.withOut(Console.scala:126)
atscala.tools.eclipse.interpreter.EclipseRepl.scala$tools$eclipse$interpreter$EclipseRepl$$safely(EclipseRepl.scala:251)
atscala.tools.eclipse.interpreter.EclipseRepl$$anonfun$act$1.applyOrElse(EclipseRepl.scala:266)
atscala.runtime.AbstractPartialFunction$mcVL$sp.apply$mcVL$sp(AbstractPartialFunction.scala:33)
atscala.runtime.AbstractPartialFunction$mcVL$sp.apply(AbstractPartialFunction.scala:33)
atscala.runtime.AbstractPartialFunction$mcVL$sp.apply(AbstractPartialFunction.scala:25)
atscala.actors.ReactorTask.run(ReactorTask.scala:31)
atscala.actors.Reactor$class.resumeReceiver(Reactor.scala:129)
atscala.tools.eclipse.interpreter.EclipseRepl.scala$actors$InternalReplyReactor$$super$resumeReceiver(EclipseRepl.scala:177)
atscala.actors.InternalReplyReactor$class.resumeReceiver(InternalReplyReactor.scala:59)
atscala.tools.eclipse.interpreter.EclipseRepl.resumeReceiver(EclipseRepl.scala:177)
atscala.actors.InternalActor$class.searchMailbox(InternalActor.scala:76)
atscala.tools.eclipse.interpreter.EclipseRepl.searchMailbox(EclipseRepl.scala:177)
atscala.actors.Reactor$$anonfun$startSearch$1$$anonfun$apply$mcV$sp$1.apply$mcV$sp(Reactor.scala:117)
atscala.actors.Reactor$$anonfun$startSearch$1$$anonfun$apply$mcV$sp$1.apply(Reactor.scala:114)
atscala.actors.Reactor$$anonfun$startSearch$1$$anonfun$apply$mcV$sp$1.apply(Reactor.scala:114)
atscala.actors.ReactorTask.run(ReactorTask.scala:33)
atscala.actors.ReactorTask.compute(ReactorTask.scala:63)
atscala.concurrent.forkjoin.RecursiveAction.exec(RecursiveAction.java:160)
atscala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
atscala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
atscala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
atscala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)

Thanks
Manas

The Geometryengine.simplify API could not return correct value for polylines (bug)

According with the description in the below link:
http://edndoc.esri.com/arcobjects/9.2/JAVA/584733d2-3a53-11dc-a403-4faa7246d1c1.htm#About

If the input polylines cross with each other, base on the description, the result should return four lines which separate by the intersection point. But the actual result is same as the input polylines.

For the summary, the execution result for the simplify API does not consistent with its description.

Intersection is returning an empty polyline but it should not be empty.

Given two polygons that intersect to a polyline and dimension mask = 2, the returned polyline should not be empty.

Input geometry:
{"rings":[[[-97.174860352323378,48.717174479818425],[-97.020624513410553,58.210155436624177],[-94.087641114245969,58.210155436624177],[-94.087641114245969,48.639781902013226],[-97.174860352323378,48.717174479818425]]]}

Intersector:
{"rings":[[[-94.08764111399995,52.68342763000004],[-94.08764111399995,56.835188018000053],[-90.285921520999977,62.345706350000057],[-94.08764111399995,52.68342763000004]]]}

Dimension mask = 2
Wkid = 4326

OperatorExportToGeoJson doesn't export the spatial reference.

To reproduce, run OperatorExportToGeoJson.local().execute with exportFlags = GeoJsonExportFlags.geoJsonExportDefaults, spatial reference wkid = 3857, and the following geometry:

{"rings":[[[1600,9082],[1600,8682],[1100,8682],[1100,9082],[1600,9082]]]}

The output looks like this:
{"type":"Polygon","coordinates":[[[1600.0,9082.0],[1600.0,8682.0],[1100.0,8682.0],[1100.0,9082.0],[1600.0,9082.0]]]}

It really would be better to have the spatial reference in the output especially since it is an input parameter.

OperatorSimplifyOGC is outputting a polyline that is not OGC simple.

Input polyline:
{"paths":[[[2,0],[4,3],[5,1],[3.25,1.875],[1,3]]],"spatialReference":{"wkid":4326}}
input

Output polyline:
{"paths":[[[2,0],[3.25,1.875]],[[3.25,1.875],[4,3],[5,1],[3.25,1.875]],[[3.25,1.875],[1,3]]],"spatialReference":{"wkid":4326}}

The output polyline has a closed ring and two more paths. Each path is in a different color.
testoutput

Recall that the boundary of a closed ring is empty. The output polyline is not OGC simple because it violates the following condition:
"A MultiCurve is simple if and only if all of its elements are simple and the only intersections between any two elements occur at Points that are on the boundaries of both elements."

The output polyline should be:
{"paths":[[[2,0],[3.25,1.875]],[[3.25,1.875],[4,3],[5,1]],[[5,1],[3.25,1.875]],[[3.25,1.875],[1,3]]],"spatialReference":{"wkid":4326}}
baseoutput

java.lang.ArrayIndexOutOfBoundsException in QuadTree

java.lang.ArrayIndexOutOfBoundsException
at com.esri.core.geometry.StridedIndexTypeCollection.grow_(StridedIndexTypeCollection.java:220)
at com.esri.core.geometry.StridedIndexTypeCollection.newElement(StridedIndexTypeCollection.java:98)
at com.esri.core.geometry.QuadTreeImpl.createChild_(QuadTreeImpl.java:737)
at com.esri.core.geometry.QuadTreeImpl.insert_(QuadTreeImpl.java:538)
at com.esri.core.geometry.QuadTreeImpl.insert(QuadTreeImpl.java:310)
at com.esri.core.geometry.QuadTree.insert(QuadTree.java:95)

Expose JsonCursor

Expose JsonCursor publicly and convert it to an interface rather than an abstract class

OperatorCut is returning two empty geometries if there are no valid cuts. A geometry cursor containing only a null pointer should be returned instead.

The cases in question are

  1. the cuttee and the cutter don't intersect at all
  2. the cuttee is a polygon and cutter doesn't pass all the way through it
  3. the cuttee is a polyline, the cutter touches the cuttee but b_consider_touch is false.

Currently, a pointer to a geometry cursor is returned. There are two empty geometries in the cursor, one for the left cut and one for the right cut. It would be a more obvious signal to the user that there were no valid cuts if a null pointer was returned instead.

Here are some simple cases to reproduce the issues listed above.

cutter1: {"paths":[[[1.5,0.5],[2.5,0.5]]]}

cutter2: {"paths":[[[0.5,0.5],[1.5,0.5]]]}

cutter3: {"paths":[[[0.2,0.4],[0.6,0.8]]]}

polygon (cuttee): {"rings":[[[0,0],[0,1],[1,1],[1,0],[0,0]]]}

polyline (cuttee): {"paths":[[[0.0,0.6],[0.4,0.2],[0.5,0.5]]]}

The OperatorSimplifyOGC does not work normally when one polyline cross itself.

The OperatorSimplifyOGC does not work normally when one polyline cross itself.
For example: one polyline ACDEF cross at point B, In the older version of OperatorSimplifyOGC instance, it returns three geometries:
1. AB
2. BF
3. BCDEB

But the latest version, the result like below

  1. AB
  2. BF
  3. BCD
  4. DEB

Is it a issue or a behavior change for OperatorSimplifyOGC ?

How to use QuadTree

Hi,
This is more of a usability question than an issue. I could not find a documentation as to how to use QuadTree.
My tree creation function looks something like below -

def getQTree(grid : Array[(Int, Geometry)]) = {
val quadTree = new QuadTree(new Envelope2D(-180, -90, 180, 90), 8)
val g = grid.zipWithIndex.map(kv => (kv._2, kv._1._2))
var hint = -1
grid.foreach { kv=>
var env = new Envelope2D
kv._2.queryEnvelope2D(env)
hint = quadTree.insert(kv._1, env, hint)
}
quadTree
}

In my above function grid is a quarter degree cells for the world for which I want to create an index.
Now that the tree is created how do I get back the list of elements for a given geometry?
Also how does the tolerance work in the functions "quadTree.getIterator(query, someTolerance)"

I could not find any documentation for the QuadTree except the mention of class name in the wiki.

Thanks
Manas

A bug in polyline vs polygon intersection

    String wkt1 = new String("polygon((0 0, 10 0, 10 10, 0 10, 0 0))");
    String wkt2 = new String("linestring(9 5, 10 5, 9 4, 8 3)");
    Geometry g1 = OperatorImportFromWkt.local().execute(0, Geometry.Type.Unknown, wkt1, null);
    Geometry g2 = OperatorImportFromWkt.local().execute(0, Geometry.Type.Unknown, wkt2, null);
    Geometry res = OperatorIntersection.local().execute(g1, g2, null, null);
    assertTrue(((Polyline)res).getPathCount() == 1);
    assertTrue(((Polyline)res).getPointCount() == 4);

Proximity2DResult does not have methods to set/get boolean signifying right side. Need getNearestCoordinate method which calculates left/right side

Proximity2DResult does not have methods to set/get boolean signifying right side.
We need these two methods:

  1. setRightSide()
  2. isRightSide()

Then we need to implement this method which calculates left/right side:

public abstract Proximity2DResult getNearestCoordinate(Geometry geom, Point inputPoint, boolean bTestPolygonInterior, boolean bCalculateLeftRightSide);

Travis-CI needs to be enabled for the Esri github account to display build status of geometry-api-java

Currently new builds are not being kicked off when checkins are made to this repository. Someone that manages this repo must login with github at http://travis-ci.org. Go to the accounts drop down under the username on the right, synchronize with github by pressing the "Sync Now" button, then toggle the geometry-api-java repository. The next time a checkin is made the build process will begin and the status image will be updated.

Make Envelope3D public

I'd like to use Envelope3D in some code built on geometry-api. Thanks.

-final class Envelope3D {
+public final class Envelope3D {

OperatorSimplify.isSimpleAsFeature hangs for certain polygon.

Here is the polygon:
{"rings":[[[-3,-3],[-3,4],[6,4],[6,-3],[-3,-3]],[[1,3],[0,2],[2,2],[1,3]],[[0,0],[2,0],[4,0],[4,2],[3,3],[2,2],[0,0]],[[2,0],[2,2],[4,2],[2,0]]],"spatialReference":{"wkid":4326}}

Here is the call stack:
OperatorSimplifyLocalHelper.processBunchForSelfIntersectionTest_(AttributeStreamOfInt32) line: 982

OperatorSimplifyLocalHelper.checkSelfIntersections_() line: 392
OperatorSimplifyLocalHelper.isSimplePlanarImpl_() line: 115
OperatorSimplifyLocalHelper.polygonIsSimpleAsFeature_() line: 1376

OperatorSimplifyLocalHelper.isSimpleAsFeature(Geometry, SpatialReference, boolean, NonSimpleResult, ProgressTracker) line: 1804
OperatorSimplifyLocal.isSimpleAsFeature(Geometry, SpatialReference, boolean, NonSimpleResult, ProgressTracker) line: 19
OperatorSimplifyLocal(OperatorSimplify).isSimpleAsFeature(Geometry, SpatialReference, ProgressTracker) line: 31

MultiPolygon Area

Filer of Esri/spatial-framework-for-hadoop#52 makes a case that the area of the following multi-polygon should be about 2 millon rather than a half million. Please advise.

        String wkt = "MULTIPOLYGON (((1001200 2432900, 1001420 2432691, 1001250 2432388, 1001498 2432325, 1001100 2432100, 1001500 2431900, 1002044 2431764, 1002059 2432120, 1002182 2432003, 1002400 2432300, 1002650 2432150, 1002610 2432323, 1002772 2432434, 1002410 2432821, 1002700 2433000, 1001824 2432866, 1001600 2433150, 1001200 2432900)), ((1000393 2433983, 1000914 2434018, 1000933 2433817, 1000568 2433834, 1000580 2433584, 1000700 2433750, 1000800 2433650, 1000700 2433450, 1000600 2433550, 1000200 2433350, 1000100 2433900, 1000393 2433983)), ((1001200 2432900, 1000878 2432891, 1000900 2433300, 1001659 2433509, 1001600 2433150, 1001200 2432900)), ((1002450 2431650, 1002300 2431650, 1002300 2431900, 1002500 2432100, 1002600 2431800, 1002450 2431800, 1002450 2431650)), ((999750 2433550, 999850 2433600, 999900 2433350, 999780 2433433, 999750 2433550)), ((1002950 2432050, 1003005 2431932, 1002850 2432250, 1002928 2432210, 1002950 2432050)), ((1002600 2431750, 1002642 2431882, 1002750 2431900, 1002750 2431750, 1002600 2431750)), ((1002950 2431750, 1003050 2431650, 1002968 2431609, 1002950 2431750)))";
        OGCGeometry ogcGeom = OGCGeometry.fromText(wkt);
        System.out.println(ogcGeom.getEsriGeometry().calculateArea2D());

Make Envelope2D serializable

public final class Envelope2D implements Serializable
{

private final static int XLESSXMIN = 1; // These are now static !!!
// private final int XGREATERXMAX = 2;
private final static int YLESSYMIN = 4;
// private final int YGREATERYMAX = 8;
private final static int XMASK = 3;
private final static int YMASK = 12;

….

wrong decimal separator for JSON geometry

GeometryEngine.geometryToJson function returns JSON with comma as decimal separator. In JSON it should be always dot. Sample testcase:

import java.util.Locale;

import org.junit.Test;
import org.testng.Assert;

import com.esri.core.geometry.GeometryEngine;
import com.esri.core.geometry.Point;

public class GeometryEngineTest {

    @Test
    public void testConvertFromJson() {
        Point p = new Point(494930d, 6086557d);
        // in LT default decimal separator is comma (",")
        Locale.setDefault(new Locale("lt"));
        String json = GeometryEngine.geometryToJson(3346, p);
        // got: {"x":494930,00000000000,"y":6086557,0000000000, ...
        // expected: {"x":494930.00000000000,"y":6086557.0000000000, ...
        Assert.assertFalse(json.matches(".*\\d,\\d.*"), "Expected that JSON contains dot (.) as decimal separator");
    }
}

Investigate and remove FIXME comments from source code.

Investigate and remove FIXME comments.

There are 72 FIXME comments in 24 files.

For example,
// FIXME check to see if boolean for inversion should be changed

We need to determine if the issue has been fixed. If not, fix it and remove the comment.

OperatorSimplify throws a geometry exception for certain polygon.

The JSON format of the polygon is given below. The geometry is in a custom spatial reference which is included in the JSON geometry.

{"rings":[[[-43164.979423605662,488179.87741599127],[-43162.026486371789,488166.91574285732],[-43004.788907639253,487410.13769049413],[-42812.048154902899,486174.65128537675],[-42696.127606671296,484929.58695529267],[-42657.472419611826,483679.76178247371],[-42696.228830156819,482430.01085302298],[-42812.243639957916,481185.16855471948],[-43005.064858928963,479950.04988388787],[-43273.94350261223,478729.43183346011],[-43617.836536160801,477528.03493405192],[-44035.410952833583,476350.50501901977],[-44525.048970555588,475201.39528372587],[-45084.854325832144,474085.14870781562],[-45712.659640125348,473006.08090798743],[-46406.03482973035,471968.36348691344],[-46425.811976577548,471940.71707339509],[-46433.972576910994,471929.3297734675],[-62675.420429180318,483678.48721446632],[-42817.776551224153,481194.98136497167],[-42819.328800634226,481182.40830792725],[-42821.96373967328,481161.15826004412],[-43014.787706761199,479926.04068923148],[-43283.669047177093,478705.42390925722],[-43627.564715833389,477504.02844580496],[-44045.141695985287,476326.50012671086],[-44534.782195827342,475177.39214120019],[-44792.66892842971,474641.60879237333],[-44800.115699057162,474626.70491060871],[-62684.41489865286,483651.00582693057],[-42716.210528562624,482346.49602406303],[-42716.682335347694,482339.15467794199],[-62684.88507687307,483643.66403874499],[-62767.717919546354,503751.51580076886],[-62764.014008223181,503751.52853704756],[-62681.18201042249,483643.67688381474],[-80876.83510586292,492027.52026335191],[-80874.35614877395,492032.95972578507],[-80554.281698949329,492702.31303920271],[-79960.430824338357,493801.0193261751],[-79299.696680685753,494860.46829738183],[-78574.634484369715,495876.55797817011],[-77788.048724357519,496845.35403814336],[-76942.982322040203,497763.10506300168],[-76719.253727577961,497987.80743537756],[-76698.220538468202,498008.60047129408],[-76021.750572695382,498646.97911261319],[-75069.749570795859,499452.19495653955],[-74069.704909828943,500196.35102434992],[-73025.486952494524,500876.56528661342],[-71941.137323725648,501490.20328861347],[-70820.853247391671,502034.88838644786],[-69668.971275798569,502508.51098199293],[-68489.950475432983,502909.23672038608],[-67288.355134573489,503235.51361774665],[-67174.145201611114,503262.36953845498],[-67171.944954887542,503262.88008392678],[-66066.647898798212,503486.58671815548],[-64833.928467383295,503660.46919093054],[-63592.779983138658,503756.99577322887],[-62348.007531111245,503775.79295418714],[-61104.430199789516,503716.78835783462],[-59866.862385849643,503580.21101759083],[-58640.095118103913,503366.59047862503],[-57428.877473688532,503076.75473121461],[-56237.898159130178,502711.82698368706],[-55071.767328259077,502273.22128770669],[-53934.998707967723,501762.63703326753],[-52831.992101561773,501182.05233525194],[-51767.016337919369,500533.71633773128],[-50744.192732870848,499820.14046644553],[-49767.479127145074,499044.08866400947],[-49254.411120343386,498594.51466072927],[-49252.20103574641,498592.51063656539],[-48838.452820660721,498206.57062628586],[-47965.102452896812,497314.81475259573],[-47148.605037592097,496370.27777495346],[-46392.118543136748,495376.61713561305],[-45698.568377402065,494337.68018913158],[-45070.636089903724,493257.48927016812],[-44510.749023124867,492140.22608716908],[-44021.070952637681,490990.21550305362],[-43603.493751754198,489811.90876623505],[-43259.630112397754,488609.86625745287],[-42990.80734973566,487388.73981965531],[-42798.062313862793,486153.25473970984],[-42682.137427497604,484908.19145197136],[-42643.477864261353,483658.36703473394],[-42682.22987767437,482408.61657129246],[-42701.114177128235,482134.43061037583],[-42701.875642632833,482124.37362030376],[-42799.002113859824,481153.71457381017],[-42991.819098056403,479918.59608658787],[-43260.693526999086,478697.97793531907],[-43604.582382299013,477496.58065120078],[-44022.152673505821,476319.05006930651],[-44511.786634603443,475169.93938780547],[-45071.588017860151,474053.6915902521],[-45699.38946014324,472974.62229831819],[-46392.760892735176,471936.90312070376],[-47149.018961733695,470944.54556192498],[-47965.237422299564,470001.38555249083],[-48448.695161342403,469494.70350416296],[-48452.382751358469,469490.971560148],[-62657.707264378601,483654.61772332503],[-54665.719091845051,502083.80680262751],[-54657.295585024396,502080.11392478686],[-53928.844149707889,501743.15844928124],[-52825.836892631211,501162.57589287992],[-51760.860360205697,500514.24200264487],[-50738.035871220614,499800.6681960104],[-49761.321269827837,499024.61840745294],[-48834.495602064781,498189.09834499552],[-47961.144490424849,497297.34381031746],[-47144.646263134222,496352.80812846153],[-46388.158891776839,495359.14873654867],[-45758.468032062599,494421.94203099364],[-45755.043648414998,494416.52296566655],[-45691.192976224593,494314.80926899653],[-45063.25880909853,493234.62019498122],[-44503.369771996797,492117.35873662407],[-44013.689648263506,490967.34975007514],[-43596.110319313368,489789.04447749484],[-43252.244485469688,488587.00329390611],[-42983.419470561741,487365.87803710328],[-42972.991664661247,487309.94432594202],[-42972.17378217911,487305.52272352757],[-42789.854833662459,486125.97704279161],[-42673.927339549955,484880.91478549322],[-42635.265132909088,483631.09122455044],[-42674.014477684403,482381.34144000814],[-42790.022203193948,481136.49981543631],[-42982.836347060329,479901.38134480809],[-43251.707952464683,478680.76302058279],[-43505.606426719183,477767.93755396048],[-43508.570489650672,477758.17548393167],[-62648.003224136155,483631.32376326638],[-43231.33672605834,488480.72759548575],[-43230.116529486761,488475.80447485013],[-42984.345302235772,487346.76613376406],[-42791.59818149409,486111.28258810454],[-42675.671155038319,484866.22069473099],[-42637.00940507315,483616.39752654487],[-42675.759193880382,482366.64816205011],[-42791.767349166061,481121.80698318483],[-42860.59009641414,480620.46551087347],[-42861.858163016179,480612.0157426559],[-62648.048225283586,483617.95045058767],[-44990.187392692693,493066.49011240952],[-44976.877250527286,493041.3938996697],[-44492.280070067362,492064.75617665827],[-44002.596871430775,490914.75011479313],[-43585.014337225839,489736.44756969565],[-43241.145180528423,488534.40890567354],[-42972.316738392248,487313.28595066199],[-42779.565883439718,486077.80397797277],[-42663.635061462031,484832.74340993504],[-42624.969469600481,483582.92131438432],[-42663.715385243195,482333.17276576743],[-42779.719651310399,481088.33214298956],[-42972.530319127443,479853.21443630243],[-43241.398445620885,478632.59663540358],[-43585.281037132481,477431.19927049219],[-44002.845127746725,476253.66817734571],[-44492.472975687007,475104.55655654363],[-45052.268357068213,473988.30739573168],[-45680.063932116049,472909.23632233299],[-46373.429654890409,471871.5149524326],[-47129.682193596644,470879.15479952638],[-47945.895324747136,469935.99180465454],[-48429.425239641103,469429.23193670367],[-48436.302094964543,469422.27237433015],[-48825.813197247218,469038.68794630334],[-49752.256123698331,468204.65331084083],[-50728.541197863633,467430.12614307459],[-51750.892556462488,466718.09982716857],[-52815.356489772625,466071.32611680689],[-53917.816713506618,465492.30453458754],[-55054.010264239951,464983.27274386073],[-56219.543957353228,464546.1979296222],[-56555.22986980345,464435.4466460814],[-56566.022422358699,464431.99171972449],[-62652.405758812703,483582.44118731614],[-44276.532184133277,475617.86252032802],[-44280.895478887644,475607.69391900656],[-44514.554799989994,475083.8708389324],[-45074.355982154193,473967.62526406598],[-45702.157150412531,472888.55813601718],[-46395.528237427206,471850.84105564922],[-47151.785890885127,470858.48551992665],[-47968.003867735235,469915.32745212881],[-48841.024361862321,469025.01241251343],[-49767.470221270647,468190.98154589685],[-50743.758007509539,467416.45831969409],[-51766.111846910841,466704.43610294675],[-52830.578020243003,466057.66663362557],[-53933.040234622575,465478.64941806835],[-55069.235518974754,464969.62210289156],[-56234.770682004208,464532.55185594189],[-57425.139269539955,464169.12778906926],[-58635.738956251007,463880.75445152324],[-59861.889305111639,463668.54641870549],[-61098.849826618287,463533.3239968351],[-62341.838268638683,463475.61005995044],[-63586.049066909305,463495.62803125079],[-64826.67188558737,463593.30101657502],[-66058.910176919919,463768.25209336972],[-67277.999689006334,464019.80575417756],[-68479.226850810635,464346.99049927673],[-69657.946964020433,464748.54256877664],[-70809.602132051645,465222.91080013022],[-71929.738857459757,465768.26259275415],[-73014.025240236326,466382.49095725012],[-74058.267710938308,467063.22262259037],[-75058.427234318951,467807.8271705822],[-76010.634921086836,468613.42716299166],[-76911.206987619546,469476.90922292363],[-77756.659005883499,470394.93602837011],[-78543.719388460886,471363.95917231089],[-79269.342056444351,472380.23284042958],[-79930.718241024864,473439.82825425908],[-80525.287372854233,474538.64882471639],[-81050.747016702633,475672.44595799863],[-81505.061812539119,476836.83545347303],[-81886.471387928468,478027.31443064014],[-82193.49721054679,479239.27872024721],[-82424.948353656,480468.04065275856],[-82579.926151533189,481708.84717567934],[-82657.827726101008,482956.8982299678],[-82658.348370346444,484207.36531462404],[-82581.482778517311,485455.41016771086],[-82427.525117544123,486696.20349154121],[-82197.067938623499,487924.94364947156],[-81890.999932405553,489136.87526177592],[-81510.502535733307,490327.30762835423],[-81057.045402366333,491491.6329066066],[-81037.005626400874,491538.55015632359],[-81032.645293279493,491548.72290451499],[-80528.03002820698,492635.49758194678],[-79934.186981933002,493734.20639058959],[-79273.460466423043,494793.65841944498],[-78548.405668540159,495809.75168256165],[-77761.827048560051,496778.55183620693],[-76916.767500117683,497696.30745075573],[-76016.496581365413,498559.46457574045],[-75064.497862817982,499364.68054094096],[-74064.455440876307,500108.83693931118],[-73020.239669349845,500789.05174073204],[-71935.892164416495,501402.69048895367],[-70815.61014136429,501947.37653770146],[-69663.730144130735,502421.00028563128],[-68741.553590912503,502741.39161692461],[-68730.756417575336,502744.84897761571],[-62641.610896588027,483585.89733036119],[-76852.11348066591,497754.50980981003],[-76845.236058229391,497761.47385471867],[-62634.733757676891,483592.8591332644],[-80289.764655471154,474145.64984264656],[-80303.083447201934,474170.73626665591],[-80516.558919139599,474584.28421788249],[-81042.021044295485,475718.08141691459],[-81496.338349224476,476882.47115250584],[-81877.750451594591,478072.95054350729],[-82184.778809082869,479284.91541932197],[-82416.232484892287,480513.67810836685],[-82571.212803223432,481754.4855554112],[-82649.11687594885,483002.53769799205],[-82649.63998607453,484253.00603101705],[-82572.776817980543,485501.05228779308],[-82436.79660108508,486624.08541444479],[-82435.53209077497,486632.53683884477],[-62646.78193660039,483626.4010467116],[-82062.472246925579,478777.05390341516],[-82063.69462532796,478781.97621606436],[-82184.736922339478,479298.28865551599],[-82416.19059033884,480527.05172118818],[-82571.170889075613,481767.85954469733],[-82649.074930405521,483015.91206214757],[-82649.597997361576,484266.38076700264],[-82572.734774395314,485514.42739113746],[-82418.779418843362,486755.2226300303],[-82188.324472554406,487983.96483959531],[-81882.258617119354,489195.89863208757],[-81791.119163295152,489505.4133986063],[-81788.158599896182,489515.17859493918],[-62645.040910627162,483641.08739609789],[-82317.46475529272,479976.54721274937],[-82318.284643819294,479980.96833749011],[-62645.859796150304,483645.5087596089],[-79533.426045860251,472876.38076209457],[-79536.852026048931,472881.79734616791],[-62649.284978218806,483650.92658402346],[-70638.130460353539,465228.80740002729],[-70646.551526501687,465232.49680207326],[-70810.55926872883,465305.23071139451],[-71930.696714283811,465850.58423942502],[-73014.983750877131,466464.81443719048],[-74059.226806831241,467145.54802708118],[-75059.386844864814,467890.15458400408],[-76011.594973856263,468695.75666252355],[-76912.167408561727,469559.24087826023],[-77757.619719540206,470477.26990145881],[-78544.680318185405,471446.29531710764],[-79270.303124625847,472462.57130267896],[-79931.679369318488,473522.16907130374],[-80526.248482417315,474620.99202530883],[-81051.708028436624,475754.79156216665],[-81506.022647337668,476919.18347239157],[-81887.43196693169,478109.66486653022],[-82194.457455400989,479321.63156632299],[-82425.90818677927,480550.39589317405],[-82580.885496385643,481791.20478553843],[-82658.786507460056,483039.25817533646],[-82659.306514585202,484289.72755259741],[-82582.440213886453,485537.77464650222],[-82428.481774455053,486778.57015061023],[-82198.023749932385,488007.31241968268],[-81891.954833696785,489219.24606560165],[-81511.456465600626,490409.68038010335],[-81057.998302690277,491574.00751269824],[-80533.332570789164,492707.72033295949],[-79939.487318218293,493806.42990753689],[-79278.758597245411,494865.88252366614],[-78553.701603085501,495881.97619263473],[-77767.120804392034,496850.77656863362],[-76922.059103173233,497768.53222065873],[-76868.226403247958,497823.25225389359],[-76864.538507631092,497826.98660336592],[-62654.019521545437,483658.35086967231],[-82608.086508454362,485192.28779247316],[-82607.329480436689,485202.34609723848],[-62653.260274574095,483668.40851691889],[-76050.334481714381,468748.55941970809],[-76052.544611357735,468750.56206926506],[-62655.47038171623,483670.41185357358],[-58141.070004763606,464086.74077130691],[-58143.269264469513,464086.23055429524],[-62657.670134771935,483669.90147239686],[-48622.299251645716,469336.30095962831],[-48643.330402145577,469315.5214274358],[-62678.702304621918,483649.11519058555],[-44487.533614788939,475267.14793188666],[-44490.014068897675,475261.71078020218],[-44539.006497479022,475155.14263579849],[-45098.815150342984,474038.89903141925],[-45726.623612370728,472959.83438901405],[-46420.001787947134,471922.12029927294],[-47176.266297343507,470929.76824703871],[-47992.490871061156,469986.61414156808],[-48865.517677606294,469096.30352725298],[-49791.969540769627,468262.27753127948],[-50768.262999142396,467487.75960173423],[-51790.622157438469,466775.74308672489],[-52855.093276226937,466128.97970176284],[-53957.560043916143,465549.96892930113],[-55093.759472279744,465040.9483907313],[-56259.298354487153,464603.88522745261],[-57449.670222500165,464240.46852374112],[-58660.272738834974,463952.1028002603],[-59886.425456065546,463739.90260291361],[-61123.387876072549,463604.6882076484],[-62366.377739917443,463546.98245754832],[-62598.390717748785,463544.81921099994],[-62602.092939882896,463544.80625723768],[-63614.310693992411,463566.99668627331],[-64854.933895035516,463664.67926350195],[-66087.172013031057,463839.63998914923],[-67306.260797164214,464091.20331880479],[-68507.486679580426,464418.39771577338],[-69686.204967226513,464819.95938329736],[-70837.857770830262,465294.33712220076],[-71957.991602279566,465839.69829565566],[-73042.274572879833,466453.93587852357],[-74086.513126437945,467134.6765646775],[-75086.668242840969,467879.28990158747],[-76038.871049756985,468684.89841758],[-76939.437782284527,469548.38870332227],[-77784.884032802438,470466.42340550548],[-78571.938235921261,471435.45408704469],[-79297.55433629718,472451.73490490654],[-79958.923590134087,473511.33705336874],[-80553.485454455134,474610.16391763394],[-81078.937521665357,475743.96687984624],[-81533.244460532704,476908.3617170463],[-81914.64592848123,478098.84552822768],[-82221.663423999518,479310.81412553048],[-82453.106052004776,480539.5798227762],[-82608.075179158055,481780.38955285237],[-82685.967960378126,483028.44324419484],[-82686.479722141041,484278.91238541785],[-82654.909976378418,484948.10429300932],[-82654.441427015234,484955.44652350264],[-82609.136808929645,485534.29919321142],[-82455.170287690722,486775.09360525507],[-82224.704254139724,488003.83425772452],[-81918.6274327547,489215.76576854725],[-81538.121294110213,490406.19743752759],[-81084.655525476643,491570.52142424171],[-80573.367833415861,492677.46549737843],[-80565.924771906662,492692.37610353885],[-62676.969982040828,483665.91307002481],[-82536.948128245567,486149.52178195724],[-82535.401272560062,486162.09701429837],[-82446.18787544065,486802.53408826597],[-82215.724359527172,488031.27597567486],[-81909.649999115791,489243.20887716871],[-81529.146255049229,490433.64208714158],[-81075.682805127261,491597.96775915503],[-80551.011895611096,492731.67876820214],[-79957.16159486433,493830.38618770894],[-79296.42797472488,494889.83631302399],[-78922.018260356621,495431.18000804755],[-78913.858868213414,495442.57366153679],[-62667.260432635871,483689.87769023713],[-82171.685155083032,479212.8380747122],[-82174.643887744591,479225.7978497665],[-82206.992026278051,479369.9155618879],[-82438.438943203684,480598.68203077425],[-82593.412354433662,481839.49281581817],[-82671.309397931662,483087.54784160218],[-82671.825383277566,484338.01859175554],[-82594.955021814487,485586.06679003587],[-82440.992498018939,486826.86312557128],[-82210.530381029894,488055.6059497174],[-81904.457379781015,489267.53987197723],[-81523.954949681269,490457.97418275569],[-81070.49276327902,491622.3010312824],[-80545.823061788178,492756.01328791428],[-79951.973908751737,493854.72202114784],[-79291.241371434618,494914.17352112045],[-78566.18065976724,495930.26580307935],[-77779.596256780511,496899.06452622061],[-76934.531078466884,497816.81826557335],[-76034.254704851817,498679.97307704575],[-75082.250727752791,499485.18629851926],[-74082.203264217882,500229.3395327343],[-73037.9826879631,500909.55076103593],[-71953.630634249581,501523.1855402764],[-70833.344336543494,502067.86723887874],[-69681.460355975913,502541.4862717553],[-68502.437767049487,502942.20829774061],[-67300.840865214166,503268.48134726746],[-66081.321463851433,503519.04185221938],[-64848.600849845585,503692.91955426591],[-63607.451468289051,503789.44127233705],[-62362.678407946019,503808.23351448594],[-61119.100759890971,503749.22392397124],[-59881.532922240665,503612.6415536881],[-58654.765924094201,503399.01596844295],[-57443.5488417163,503109.17517823918],[-56252.570379604607,502744.24241113249],[-55086.440688408664,502305.63173844933],[-53949.673490698813,501795.04256968421],[-52846.668584332692,501214.45303899283],[-51781.694791634502,500566.11230940872],[-50758.873420800017,499852.53182524181],[-49782.16230387237,499076.47554721829],[-48855.340473313168,498240.94920886314],[-47981.993536626156,497349.18863652926],[-47165.499805694941,496404.64717897942],[-46409.01723447354,495410.98229602398],[-45715.471215447476,494372.04135883448],[-45087.543281859456,493291.84671767248],[-44527.660759099039,492174.58009552665],[-44037.987404894244,491024.56636872963],[-43620.415074035409,489846.25679792167],[-43276.556439322652,488644.21177484316],[-43164.979423605662,488179.87741599127]]],"spatialReference":{"wkt":"PROJCS["Gnomonic",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Gnomonic"],PARAMETER["Longitude_Of_Center",-2.229656905396642],PARAMETER["Latitude_Of_Center",54.3140205297877],UNIT["Meter",1.0]]"}}

OperatorSimplifyOGC should split a ring that intersects itself into two rings.

If we have a polygon with one ring that looks like a bow tie, OperatorSimplifyOGC should break it up into two rings.

Input polygon:
{"rings":[[[0, 0], [0, 10], [5, 5], [10, 10], [10, 0], [5, 5], [0, 0]]],"spatialReference":{"wkid":4326}}

Output from OperatorSimplifyOGC:
{"rings":[[[0,0],[0,10],[5,5],[10,10],[10,0],[5,5],[0,0]]],"spatialReference":{"wkid":4326}}

Output should be:
{"rings":[[[0,0],[0,10],[5,5],[0,0]],[[10,0],[5,5],[10,10],[10,0]]],"spatialReference":{"wkid":4326}}

OperatorIntersection throws ArrayIndexOutOfBoundsException when using a dimension mask and the intersection of two polygons is empty.

OperatorIntersection throws ArrayIndexOutOfBoundsException when using a dimension mask and the intersection of two polygons is empty.

java.lang.ArrayIndexOutOfBoundsException: 4
at com.esri.core.geometry.OperatorIntersectionCursor.intersectEx(OperatorIntersectionCursor.java:169)
at com.esri.core.geometry.OperatorIntersectionCursor.next(OperatorIntersectionCursor.java:86)

Lines 166 through 169 of OperatorIntersectionCursor.java are
Geometry dst_geom = tryNativeImplementation_(input_geom);
if (dst_geom != null) {
Geometry[] res_vec = new Geometry[3];
res_vec[1 << dst_geom.getDimension()] = dst_geom; <--------------

but the dimension of dst_geom is 2.

Given below is a code snippet that can be used to reproduce the problem.

Polygon poly1 = new Polygon();
poly1.startPath(0,0);
poly1.lineTo(0,10);
poly1.lineTo(10,10);
poly1.lineTo(10,0);

Polygon poly2 = new Polygon();
poly2.startPath(10.5,4);
poly2.lineTo(10.5,8);
poly2.lineTo(14,10);

try {
  OperatorIntersection op = (OperatorIntersection) factory.getOperator(Operator.Type.Intersection);
  GeometryCursor result_cursor = op.execute(new SimpleGeometryCursor(poly1), new SimpleGeometryCursor(poly2), SpatialReference.create(4326), null, 1);
  Geometry geom = null;
  while((geom = result_cursor.next()) != null) {
    System.out.println(geom.getType());
  }
}
catch (Exception e) {   
  e.printStackTrace();
  System.exit(-1);
}

Envelope2D.intersect javadoc confusion

The method javadoc implies that intersect does exactly what isIntersecting does, when it actually changes the instance to be the intersection.

class Envelope2D {

   ...

  /**
   * Checks if this envelope intersects the other.
   * @return True if this envelope intersects the other.
  */
  public boolean intersect(Envelope2D other) {
  ...
  }

  ...

}

Acceleration without a spatial reference changes the result of relation operators

Results using crosses operator :

crosses("LINESTRING (2 0, 2 3)", "POLYGON ((1 1, 4 1, 4 4, 1 4, 1 1))")
WKID Accelerated crosses result
- yes false
- no true
4326 yes true
4326 no true

Repro source :

public class Test {

       public static void main(String [] args) throws Exception {
              crosses(null, true);
              crosses(null, false);
              crosses(SpatialReference.create(4326), true);
              crosses(SpatialReference.create(4326), false);
       }

       static void crosses(SpatialReference sr, boolean accelerate) {

              OperatorSimpleRelation opSimpleRelation = OperatorCrosses.local();

              OGCGeometry geom1 = OGCGeometry.fromText("LINESTRING (2 0, 2 3)");
              OGCGeometry geom2 = OGCGeometry.fromText("POLYGON ((1 1, 4 1, 4 4, 1 4, 1 1))");

              geom1.esriSR = sr;
              geom2.esriSR = sr;

              if (accelerate) {
                     opSimpleRelation.accelerateGeometry(geom1.getEsriGeometry(), geom1.esriSR, GeometryAccelerationDegree.enumMedium);
              }

              boolean ret = opSimpleRelation.execute(geom1.getEsriGeometry(), geom2.getEsriGeometry(), geom1.getEsriSpatialReference(), null);

              System.out.println("sr=" + (sr==null?"null":sr.getID()+"") + ",accel=" + accelerate + " - crosses=" + ret);
       }
}

The method tock() from the type GeometryCursor is not visible - when using Listening cursor

When I use the ListeningGeometryCursor with OperatorUnion using the commited version of the code, I get the error:
The method tock() from the type GeometryCursor is not visible .
Cause: tock is declared protected in GeometryCursor.

This is used in ST_Aggr_Union: https://github.com/Esri/spatial-framework-for-hadoop/blob/38c334709b78dd3c774b12bdaeee3637f14b0503/hive/src/com/esri/hadoop/hive/ST_Aggr_Union.java

If instead of GeometryCursor, I try to declare the executing cursor as type OperatorUnionCursor, that is also an error, because class OperatorUnionCursor is not declared public -
The type com.esri.core.geometry.OperatorUnionCursor is not visible.

OperatorClip throws ArrayIndexOutOfBoundsException for a specific non-simple polygon.

OperatorClip throws ArrayIndexOutOfBoundsException for a specific non-simple polygon.

Stack trace:
java.lang.ArrayIndexOutOfBoundsException: -1
at com.esri.core.geometry.AttributeStreamOfInt32.set(AttributeStreamOfInt32.java:116)
at com.esri.core.geometry.Clipper.fixPaths_(Clipper.java:1059)
at com.esri.core.geometry.Clipper.resolveBoundaryOverlaps_(Clipper.java:509)
at com.esri.core.geometry.Clipper.clipPolygon2_(Clipper.java:304)
at com.esri.core.geometry.Clipper.clipMultiPath2_(Clipper.java:50)
at com.esri.core.geometry.Clipper.clipMultiPath_(Clipper.java:1094)
at com.esri.core.geometry.Clipper.clip(Clipper.java:1214)
at com.esri.core.geometry.OperatorClipCursor.next(OperatorClipCursor.java:44)
at com.esri.core.geometry.OperatorClipLocal.execute(OperatorClipLocal.java:34)

Given below is code to reproduce the problem.

Polygon poly1 = makeNonSimplePolygon();

Envelope2D env = new Envelope2D();
env.setCoords(24.269517325186033, 19.999998900000001, 57.305574253225409, 61.801370114954793);

try {
  OperatorClip op = (OperatorClip) factory.getOperator(Operator.Type.Clip);
  Geometry output_geom = op.execute(poly1, env, SpatialReference.create(4326), null);
  System.out.println("Type: " + output_geom.getType());
  output_geom.queryEnvelope2D(env);
  System.out.println("Envelope: xmin = " + Double.toString(env.xmin) + 
          ", ymin = " + Double.toString(env.ymin) + 
          ", xmax = " + Double.toString(env.xmax) + 
          ", ymax = " + Double.toString(env.ymax));
}
catch (Exception e) {
  e.printStackTrace();
  System.exit(-1);
}

private static Polygon makeNonSimplePolygon()

Polygon poly1 = new Polygon();
poly1.startPath(21.476191371901479,41.267022001907215);
poly1.lineTo(59.669186665158051,36.62700518555863);
poly1.lineTo(20.498578117352313,30.363180148246094);
poly1.lineTo(18.342565836615044,46.303295352085627);
poly1.lineTo(17.869569458621626,23.886816966894159);
poly1.lineTo(19.835465558090434,20);
poly1.lineTo(18.83911285048551,43.515995498114791);
poly1.lineTo(20.864485260298004,20.235921201027757);
poly1.lineTo(18.976127544787012,20);
poly1.lineTo(34.290201277718218,61.801369014954794);
poly1.lineTo(20.734727419368866,20);
poly1.lineTo(18.545865698148113,20);
poly1.lineTo(19.730260558565515,20);
poly1.lineTo(19.924806216827005,23.780315893949187);
poly1.lineTo(21.675168105421452,36.699924873001258);
poly1.lineTo(22.500527828912158,43.703424859922983);
poly1.lineTo(42.009527116514818,36.995486982256089);
poly1.lineTo(24.469729873835782,58.365871758247039);
poly1.lineTo(24.573736036545878,36.268390409195824);
poly1.lineTo(22.726502169802746,20);
poly1.lineTo(23.925834885228145,20);
poly1.lineTo(25.495346880936729,20);
poly1.lineTo(23.320941499288317,20);
poly1.lineTo(24.05655665646276,28.659578774758632);
poly1.lineTo(23.205940789341135,38.491506888710504);
poly1.lineTo(21.472847203385509,53.057228182018044);
poly1.lineTo(25.04257681654104,20);
poly1.lineTo(25.880572351149542,25.16102863979474);
poly1.lineTo(26.756283333879658,20);
poly1.lineTo(21.476191371901479,41.267022001907215);

return poly1;

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.