Can you confirm you have setup the geometryFactory with the correct dimensions?
If the GeometryFactory and Coordinates do not match I would like the coordinates to cause a problem, or be converted to the format used for internal storage, during creation ... rather than cause a problem later. -- Jody Garnett On Tue, 12 Feb 2019 at 21:05, Hugh Saalmans <hugh.saalm...@iag.com.au> wrote: > Is LinestringM a valid geometry type in Geotools 21-RC or is my code > missing something? > > > > I can create a LinestringM object from an array of CoordinateXYM objects. > But calling a function on the geom (e.g. line.getLength()) causes the > following error. (I’m using Java 11). > > > > Exception in thread "MyAppClient-StreamThread-1" > java.lang.IllegalArgumentException: Invalid ordinate index: 3 > > at > org.locationtech.jts.geom.Coordinate.setM(Coordinate.java:190) > > at > org.locationtech.jts.geom.impl.CoordinateArraySequence.getCoordinate(CoordinateArraySequence.java:234) > > at > org.locationtech.jts.algorithm.Length.ofLine(Length.java:41) > > at > org.locationtech.jts.geom.LineString.getLength(LineString.java:163) > > at > au.com.iag.transformation.local.setup.SJSummaryAggregation.lambda$main$1(SJSummaryAggregation.java:136) > > at > org.apache.kafka.streams.kstream.internals.KStreamAggregate$KStreamAggregateProcessor.process(KStreamAggregate.java:91) > > at > org.apache.kafka.streams.processor.internals.ProcessorNode.process(ProcessorNode.java:115) > > at > org.apache.kafka.streams.processor.internals.ProcessorContextImpl.forward(ProcessorContextImpl.java:146) > > at > org.apache.kafka.streams.processor.internals.ProcessorContextImpl.forward(ProcessorContextImpl.java:129) > > at > org.apache.kafka.streams.processor.internals.ProcessorContextImpl.forward(ProcessorContextImpl.java:93) > > at > org.apache.kafka.streams.processor.internals.SourceNode.process(SourceNode.java:84) > > at > org.apache.kafka.streams.processor.internals.StreamTask.process(StreamTask.java:351) > > at > org.apache.kafka.streams.processor.internals.AssignedStreamsTasks.process(AssignedStreamsTasks.java:104) > > at > org.apache.kafka.streams.processor.internals.TaskManager.process(TaskManager.java:413) > > at > org.apache.kafka.streams.processor.internals.StreamThread.runOnce(StreamThread.java:862) > > at > org.apache.kafka.streams.processor.internals.StreamThread.runLoop(StreamThread.java:777) > > at > org.apache.kafka.streams.processor.internals.StreamThread.run(StreamThread.java:747) > > > > Here’s my code: > > > > CoordinateXYM[] coords = new > CoordinateXYM[num_points]; > > int i = 0; > > > > for (Waypoint waypoint : waypoints) { > > CoordinateXYM coord = new > CoordinateXYM(waypoint.getLon(), waypoint.getLat(), waypoint.getUnixTime()); > > coords[i] = coord; > > i++; > > } > > > > LineString line = > geometryFactory.createLineString(coords); > > > > System.out.println(line.getLength()); > > > > > > > > –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– > > *HUGH SAALMANS* > > mobility.ai > > CUSTOMER LABS > > > > *Phone*: +61 (0)2 9292 3351 *Ext*: 23351 > > *Email*: hugh.saalm...@iag.com.au > > *Address*: Tower 2, Darling Park, Sydney NSW 2000 > > > > > > *We help make your world a safer place* > > > > –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– > > > > _____________________________________________________________________ > > The information transmitted in this message and its attachments (if any) > is intended > only for the person or entity to which it is addressed. > The message may contain confidential and/or privileged material. Any > review, > retransmission, dissemination or other use of, or taking of any action in > reliance > upon this information, by persons or entities other than the intended > recipient is > prohibited. > > If you have received this in error, please contact the sender and delete > this e-mail > and associated material from any computer. > > The intended recipient of this e-mail may only use, reproduce, disclose or > distribute > the information contained in this e-mail and any attached files, with the > permission > of the sender. > > This message has been scanned for viruses. > _____________________________________________________________________ > _______________________________________________ > GeoTools-GT2-Users mailing list > GeoTools-GT2-Users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users >
_______________________________________________ GeoTools-GT2-Users mailing list GeoTools-GT2-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users