halestudio / hale

(Spatial) data harmonisation with hale»studio (formerly HUMBOLDT Alignment Editor)
146 stars 44 forks source link

Unexpected behaviour when Features with Curves are transformed #743

Closed lgoltz closed 5 years ago

lgoltz commented 5 years ago

We created a mapping from XPlanGML 4.1 to 5.1. The GML version of both schemas is the same (3.2). The alignement of the geometry properties are configured as in the following example:

    <cell relation="eu.esdihumboldt.hale.align.rename" id="C117e4a20-0815-4d73-b598-55cc152b78a6" priority="normal">
        <source>
            <property>
                <type name="BP_FlaechenobjektType" ns="http://www.xplanung.de/xplangml/4/1"/>
                <child name="position" ns="http://www.xplanung.de/xplangml/4/1"/>
            </property>
        </source>
        <target>
            <property>
                <type name="BP_FlaechenobjektType" ns="http://www.xplanung.de/xplangml/5/1"/>
                <child name="position" ns="http://www.xplanung.de/xplangml/5/1"/>
            </property>
        </target>
        <parameter value="true" name="copyGeometries"/>
        <parameter value="true" name="ignoreNamespaces"/>
        <parameter value="true" name="structuralRename"/>
    </cell>

Transforming a xml instance with the following geometry results in an NPE.

      <xplan:position>
        <gml:Curve srsName="EPSG:25832" gml:id="GML_f56dcade-b441-4669-b025-b3b8ebf5879d">
          <gml:segments>
            <gml:ArcString interpolation="circularArc3Points">
              <gml:posList srsDimension="2" count="5">567651.450 5940713.650 567658.904 5940716.406 567666.313 5940719.279 567672.799 5940721.906 567679.248 5940724.624 </gml:posList>
            </gml:ArcString>
            <gml:LineStringSegment interpolation="linear">
              <gml:posList srsDimension="2" count="2">567679.248 5940724.624 567684.025 5940723.146 </gml:posList>
            </gml:LineStringSegment>
            <gml:ArcString interpolation="circularArc3Points">
              <gml:posList srsDimension="2" count="5">567684.025 5940723.146 567690.666 5940712.507 567697.260 5940701.838 567704.872 5940689.393 567712.419 5940676.909 </gml:posList>
            </gml:ArcString>
            <gml:LineStringSegment interpolation="linear">
              <gml:posList srsDimension="2" count="6">567712.419 5940676.909 567707.438 5940674.457 567705.140 5940678.340 567693.482 5940672.601 567691.779 5940668.141 567671.914 5940658.363 </gml:posList>
            </gml:LineStringSegment>
          </gml:segments>
        </gml:Curve>
      </xplan:position>
11.06.2019 13:02:47 ERROR e.e.h.i.g.r.i.i.StreamGmlHelper.parseInstance(290) - Error creating geometry
java.lang.IllegalArgumentException: Points of LinearRing do not form a closed linestring
    at com.vividsolutions.jts.geom.LinearRing.validateConstruction(LinearRing.java:111) ~[com.vividsolutions.jts_1.13.0.i20150413.jar:na]
    at com.vividsolutions.jts.geom.LinearRing.<init>(LinearRing.java:106) ~[com.vividsolutions.jts_1.13.0.i20150413.jar:na]
    at com.vividsolutions.jts.geom.GeometryFactory.createLinearRing(GeometryFactory.java:341) ~[com.vividsolutions.jts_1.13.0.i20150413.jar:na]
    at com.vividsolutions.jts.geom.GeometryFactory.createLinearRing(GeometryFactory.java:328) ~[com.vividsolutions.jts_1.13.0.i20150413.jar:na]
    at eu.esdihumboldt.hale.io.gml.geometry.handler.RingHandler.createGeometry(RingHandler.java:97) ~[na:na]
    at eu.esdihumboldt.hale.io.gml.geometry.handler.RingHandler.createGeometry(RingHandler.java:108) ~[na:na]
    at eu.esdihumboldt.hale.io.gml.geometry.handler.RingHandler.createGeometry(RingHandler.java:65) ~[na:na]
    at eu.esdihumboldt.hale.io.gml.geometry.constraint.GeometryFactory.createGeometry(GeometryFactory.java:81) ~[eu.esdihumboldt.hale.io.gml.geometry_3.5.0.release.jar:na]
    at eu.esdihumboldt.hale.io.gml.reader.internal.instance.StreamGmlHelper.parseInstance(StreamGmlHelper.java:279) [eu.esdihumboldt.hale.io.gml_3.5.0.release.jar:na]
    at eu.esdihumboldt.hale.io.gml.reader.internal.instance.StreamGmlHelper.parseProperties(StreamGmlHelper.java:475) [eu.esdihumboldt.hale.io.gml_3.5.0.release.jar:na]
    at eu.esdihumboldt.hale.io.gml.reader.internal.instance.StreamGmlHelper.parseInstance(StreamGmlHelper.java:215) [eu.esdihumboldt.hale.io.gml_3.5.0.release.jar:na]
    at eu.esdihumboldt.hale.io.gml.reader.internal.instance.StreamGmlHelper.parseProperties(StreamGmlHelper.java:475) [eu.esdihumboldt.hale.io.gml_3.5.0.release.jar:na]
    at eu.esdihumboldt.hale.io.gml.reader.internal.instance.StreamGmlHelper.parseInstance(StreamGmlHelper.java:215) [eu.esdihumboldt.hale.io.gml_3.5.0.release.jar:na]
    at eu.esdihumboldt.hale.io.gml.reader.internal.instance.StreamGmlHelper.parseProperties(StreamGmlHelper.java:475) [eu.esdihumboldt.hale.io.gml_3.5.0.release.jar:na]
    at eu.esdihumboldt.hale.io.gml.reader.internal.instance.StreamGmlHelper.parseInstance(StreamGmlHelper.java:215) [eu.esdihumboldt.hale.io.gml_3.5.0.release.jar:na]
    at eu.esdihumboldt.hale.io.gml.reader.internal.instance.StreamGmlHelper.parseProperties(StreamGmlHelper.java:475) [eu.esdihumboldt.hale.io.gml_3.5.0.release.jar:na]
    at eu.esdihumboldt.hale.io.gml.reader.internal.instance.StreamGmlHelper.parseInstance(StreamGmlHelper.java:215) [eu.esdihumboldt.hale.io.gml_3.5.0.release.jar:na]
    at eu.esdihumboldt.hale.io.gml.reader.internal.instance.StreamGmlHelper.parseInstance(StreamGmlHelper.java:107) [eu.esdihumboldt.hale.io.gml_3.5.0.release.jar:na]
    at eu.esdihumboldt.hale.io.gml.reader.internal.GmlInstanceCollection$GmlInstanceIterator.next(GmlInstanceCollection.java:571) [eu.esdihumboldt.hale.io.gml_3.5.0.release.jar:na]
    at eu.esdihumboldt.hale.io.gml.reader.internal.GmlInstanceCollection$GmlInstanceIterator.next(GmlInstanceCollection.java:1) [eu.esdihumboldt.hale.io.gml_3.5.0.release.jar:na]
    at eu.esdihumboldt.hale.common.instance.model.impl.MultiInstanceCollection$MultiInstanceCollectionResourceIterator.next(MultiInstanceCollection.java:192) [eu.esdihumboldt.hale.common.instance_3.5.0.release.jar:na]
    at eu.esdihumboldt.hale.common.instance.model.impl.MultiInstanceCollection$MultiInstanceCollectionResourceIterator.next(MultiInstanceCollection.java:1) [eu.esdihumboldt.hale.common.instance_3.5.0.release.jar:na]
    at eu.esdihumboldt.hale.common.instance.orient.storage.StoreInstancesJob.lambda$0(StoreInstancesJob.java:219) [eu.esdihumboldt.hale.common.instance.orient_3.5.0.release.jar:na]
    at eu.esdihumboldt.hale.common.core.report.SimpleLogContext.withLog(SimpleLogContext.java:112) ~[eu.esdihumboldt.hale.common.core_3.5.0.release.jar:na]
    at eu.esdihumboldt.hale.common.instance.orient.storage.StoreInstancesJob.run(StoreInstancesJob.java:204) [eu.esdihumboldt.hale.common.instance.orient_3.5.0.release.jar:na]
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:60) ~[org.eclipse.core.jobs_3.10.0.v20180427-1454.jar:na]
11.06.2019 13:02:47 ERROR e.e.h.i.g.r.i.i.StreamGmlHelper.parseInstance(290) - Error creating geometry
java.lang.NullPointerException: null
    at eu.esdihumboldt.hale.io.gml.geometry.handler.PolygonHandler.createGeometry(PolygonHandler.java:160) ~[na:na]
    at eu.esdihumboldt.hale.io.gml.geometry.constraint.GeometryFactory.createGeometry(GeometryFactory.java:81) ~[eu.esdihumboldt.hale.io.gml.geometry_3.5.0.release.jar:na]
    at eu.esdihumboldt.hale.io.gml.reader.internal.instance.StreamGmlHelper.parseInstance(StreamGmlHelper.java:279) [eu.esdihumboldt.hale.io.gml_3.5.0.release.jar:na]
    at eu.esdihumboldt.hale.io.gml.reader.internal.instance.StreamGmlHelper.parseProperties(StreamGmlHelper.java:475) [eu.esdihumboldt.hale.io.gml_3.5.0.release.jar:na]
    at eu.esdihumboldt.hale.io.gml.reader.internal.instance.StreamGmlHelper.parseInstance(StreamGmlHelper.java:215) [eu.esdihumboldt.hale.io.gml_3.5.0.release.jar:na]
    at eu.esdihumboldt.hale.io.gml.reader.internal.instance.StreamGmlHelper.parseProperties(StreamGmlHelper.java:475) [eu.esdihumboldt.hale.io.gml_3.5.0.release.jar:na]
    at eu.esdihumboldt.hale.io.gml.reader.internal.instance.StreamGmlHelper.parseInstance(StreamGmlHelper.java:215) [eu.esdihumboldt.hale.io.gml_3.5.0.release.jar:na]
    at eu.esdihumboldt.hale.io.gml.reader.internal.instance.StreamGmlHelper.parseInstance(StreamGmlHelper.java:107) [eu.esdihumboldt.hale.io.gml_3.5.0.release.jar:na]
    at eu.esdihumboldt.hale.io.gml.reader.internal.GmlInstanceCollection$GmlInstanceIterator.next(GmlInstanceCollection.java:571) [eu.esdihumboldt.hale.io.gml_3.5.0.release.jar:na]
    at eu.esdihumboldt.hale.io.gml.reader.internal.GmlInstanceCollection$GmlInstanceIterator.next(GmlInstanceCollection.java:1) [eu.esdihumboldt.hale.io.gml_3.5.0.release.jar:na]
    at eu.esdihumboldt.hale.common.instance.model.impl.MultiInstanceCollection$MultiInstanceCollectionResourceIterator.next(MultiInstanceCollection.java:192) [eu.esdihumboldt.hale.common.instance_3.5.0.release.jar:na]
    at eu.esdihumboldt.hale.common.instance.model.impl.MultiInstanceCollection$MultiInstanceCollectionResourceIterator.next(MultiInstanceCollection.java:1) [eu.esdihumboldt.hale.common.instance_3.5.0.release.jar:na]
    at eu.esdihumboldt.hale.common.instance.orient.storage.StoreInstancesJob.lambda$0(StoreInstancesJob.java:219) [eu.esdihumboldt.hale.common.instance.orient_3.5.0.release.jar:na]
    at eu.esdihumboldt.hale.common.core.report.SimpleLogContext.withLog(SimpleLogContext.java:112) ~[eu.esdihumboldt.hale.common.core_3.5.0.release.jar:na]
    at eu.esdihumboldt.hale.common.instance.orient.storage.StoreInstancesJob.run(StoreInstancesJob.java:204) [eu.esdihumboldt.hale.common.instance.orient_3.5.0.release.jar:na]
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:60) ~[org.eclipse.core.jobs_3.10.0.v20180427-1454.jar:na]

In the target document the curve element is empty:

<gml:Curve gml:id="_0e94b1c0-cbbc-435b-964c-65917acf60e5" srsName="EPSG:25832" srsDimension="2"></gml:Curve>

The following geoemtry doesn't result in NPE but the tranformed geoemtry is an approximated !LineString:

    <xplan:position>
        <gml:Curve gml:id="GML_fdd86d12-2634-41c4-ad25-a8f0d7047852" srsName="EPSG:25832">
          <gml:segments>
            <gml:LineStringSegment interpolation="linear">
              <gml:posList>567569.927 5940879.050 567557.796 5940870.234 567578.862 5940842.268 567585.296 5940833.031 567593.055 5940821.507 567596.147 5940817.366 567604.390 5940805.524 567617.722 5940785.385 567632.948 5940761.696 567649.973 5940734.625</gml:posList>
            </gml:LineStringSegment>
            <gml:ArcString interpolation="circularArc3Points" numArc="1">
              <gml:posList>567649.973 5940734.625 567657.099 5940737.355 567664.181 5940740.199</gml:posList>
            </gml:ArcString>
            <gml:LineStringSegment interpolation="linear">
              <gml:posList>567664.181 5940740.199 567645.602 5940769.741 567630.281 5940793.578 567616.796 5940813.947 567608.311 5940826.136 567605.289 5940830.185 567597.668 5940841.504 567591.007 5940851.067 567569.927 5940879.050</gml:posList>
            </gml:LineStringSegment>
          </gml:segments>
        </gml:Curve>
      </xplan:position>
<xplan:position>
        <gml:Curve gml:id="_7baa1707-d1ca-4527-894e-633bd9593762" srsName="EPSG:25832" srsDimension="2">
          <gml:segments>
            <gml:LineStringSegment>
              <gml:posList>567569.927 5940879.05 567557.796 5940870.234 567578.862 5940842.268 567585.296 5940833.031 567593.055 5940821.507 567596.147 5940817.366 567604.39 5940805.524 567617.722 5940785.385 567632.948 5940761.696 567649.973 5940734.625 567650.0288425934 5940734.645886386 567650.0846825736 5940734.6667797575 567650.1405199396 5940734.687680114 567650.1963546907 5940734.7085874565 567650.252186826 5940734.729501782 567650.3080163443 5940734.750423092 567650.3638432452 5940734.771351387 567650.4196675275 5940734.792286665 567650.4754891905 5940734.813228926 567650.5313082334 5940734.83417817 567650.587124655 5940734.855134397 567650.6429384546 5940734.876097606 567650.6987496315 5940734.897067796 567650.7545581845 5940734.9180449685 567650.8103641131 5940734.939029123 567650.8661674161 5940734.960020257 567650.9219680928 5940734.981018373 567650.9777661422 5940735.002023468 567651.0335615636 5940735.023035544 567651.0893543559 5940735.044054599 567651.1451445185 5940735.065080633 567651.2009320504 5940735.086113647 567651.2567169506 5940735.107153639 567651.3124992184 5940735.128200609 567651.3682788528 5940735.149254558 567651.424055853 5940735.170315484 567651.4798302182 5940735.191383387 567651.5356019475 5940735.212458267 567651.5913710399 5940735.233540124 567651.6471374945 5940735.254628957 567651.7029013106 5940735.275724767 567651.7586624873 5940735.296827552 567651.8144210237 5940735.317937313 567651.8701769189 5940735.339054048 567651.925930172 5940735.360177758 567651.9816807822 5940735.381308442 567652.0374287486 5940735.4024461005 567652.0931740702 5940735.423590733 567652.1489167465 5940735.444742339 567652.2046567762 5940735.465900917 567652.2603941587 5940735.487066468 567652.3161288929 5940735.508238992 567652.3718609782 5940735.529418488 567652.4275904135 5940735.550604955 567652.483317198 5940735.5717983935 567652.5390413309 5940735.592998804 567652.5947628113 5940735.614206184 567652.6504816383 5940735.635420535 567652.7061978109 5940735.656641856 567652.7619113285 5940735.677870146 567652.81762219 5940735.699105406 567652.8733303946 5940735.720347635 567652.9290359416 5940735.741596833 567652.9847388298 5940735.762852999 567653.0404390586 5940735.784116134 567653.096136627 5940735.805386236 567653.1518315341 5940735.826663305 567653.2075237791 5940735.847947341 567653.2632133611 5940735.869238345 567653.3189002794 5940735.890536314 567653.3745845328 5940735.91184125 567653.4302661207 5940735.933153151 567653.485945042 5940735.9544720175 567653.5416212961 5940735.97579785 567653.5972948818 5940735.997130645 567653.6529657986 5940736.0184704065 567653.7086340453 5940736.039817131 567653.7642996213 5940736.06117082 567653.8199625255 5940736.082531472 567653.8756227572 5940736.103899087 567653.9312803154 5940736.1252736645 567653.9869351994 5940736.146655205 567654.0425874081 5940736.1680437075 567654.0982369407 5940736.189439171 567654.1538837964 5940736.210841596 567654.2095279744 5940736.232250983 567654.2651694737 5940736.253667329 567654.3208082934 5940736.275090638 567654.3764444328 5940736.296520905 567654.4320778907 5940736.317958131 567654.4877086666 5940736.339402318 567654.5433367596 5940736.360853464 567654.5989621684 5940736.382311569 567654.6545848927 5940736.403776631 567654.7102049313 5940736.425248652 567654.7658222833 5940736.44672763 567654.821436948 5940736.468213566 567654.8770489246 5940736.489706458 567654.9326582119 5940736.511206307 567654.9882648092 5940736.532713113 567655.0438687158 5940736.554226874 567655.0994699305 5940736.575747592 567655.1550684527 5940736.597275265 567655.2106642814 5940736.618809893 567655.2662574159 5940736.640351475 567655.321847855 5940736.661900012 567655.3774355982 5940736.683455503 567655.4330206442 5940736.705017947 567655.4886029926 5940736.726587344 567655.5441826422 5940736.7481636945 567655.5997595924 5940736.769746998 567655.655333842 5940736.7913372535 567655.7109053904 5940736.812934461 567655.7664742367 5940736.83453862 567655.8220403799 5940736.85614973 567655.8776038191 5940736.877767792 567655.9331645537 5940736.899392804 567655.9887225826 5940736.921024766 567656.0442779049 5940736.942663678 567656.0998305199 5940736.96430954 567656.1553804267 5940736.985962351 567656.2109276243 5940737.007622111 567656.2664721119 5940737.029288819 567656.3220138886 5940737.050962476 567656.3775529537 5940737.072643081 567656.4330893061 5940737.094330633 567656.4886229452 5940737.116025132 567656.5441538697 5940737.137726579 567656.5996820792 5940737.159434971 567656.6552075726 5940737.18115031 567656.7107303491 5940737.202872595 567656.7662504077 5940737.224601826 567656.8217677476 5940737.2463380005 567656.877282368 5940737.268081121 567656.9327942679 5940737.289831187 567656.9883034467 5940737.311588195 567657.0438099032 5940737.3333521485 567657.099 5940737.355 567657.1548146463 5940737.376900884 567657.2103129312 5940737.398685666 567657.2658084905 5940737.420477391 567657.3213013231 5940737.442276058 567657.3767914285 5940737.464081666 567657.4322788058 5940737.485894216 567657.4877634537 5940737.507713707 567657.5432453718 5940737.529540139 567657.5987245591 5940737.551373512 567657.6542010145 5940737.573213824 567657.7096747375 5940737.595061076 567657.7651457271 5940737.616915268 567657.8206139823 5940737.638776398 567657.8760795023 5940737.660644467 567657.9315422863 5940737.682519475 567657.9870023334 5940737.70440142 567658.0424596426 5940737.726290303 567658.0979142132 5940737.7481861245 567658.1533660444 5940737.770088881 567658.2088151351 5940737.791998575 567658.2642614846 5940737.813915206 567658.3197050919 5940737.835838772 567658.3751459563 5940737.857769275 567658.4305840768 5940737.879706712 567658.4860194526 5940737.901651084 567658.5414520828 5940737.923602391 567658.5968819665 5940737.945560632 567658.6523091029 5940737.967525807 567658.7077334911 5940737.989497916 567658.7631551303 5940738.011476957 567658.8185740195 5940738.033462932 567658.873990158 5940738.055455839 567658.9294035448 5940738.077455678 567658.9848141789 5940738.09946245 567659.0402220598 5940738.121476152 567659.0956271864 5940738.143496786 567659.1510295578 5940738.1655243505 567659.2064291732 5940738.187558846 567659.2618260318 5940738.209600271 567659.3172201327 5940738.231648626 567659.372611475 5940738.25370391 567659.4280000577 5940738.275766123 567659.4833858801 5940738.297835265 567659.5387689414 5940738.319911336 567659.5941492406 5940738.341994334 567659.6495267769 5940738.364084261 567659.7049015493 5940738.386181114 567659.760273557 5940738.408284894 567659.8156427994 5940738.430395601 567659.8710092752 5940738.452513236 567659.9263729838 5940738.474637794 567659.9817339242 5940738.49676928 567660.0370920957 5940738.51890769 567660.0924474973 5940738.541053026 567660.1478001282 5940738.563205285 567660.2031499875 5940738.585364469 567660.2584970742 5940738.607530577 567660.3138413877 5940738.629703609 567660.3691829271 5940738.651883564 567660.4245216913 5940738.674070441 567660.4798576796 5940738.696264242 567660.535190891 5940738.718464963 567660.5905213249 5940738.740672608 567660.6458489802 5940738.762887173 567660.7011738562 5940738.785108659 567660.7564959518 5940738.807337067 567660.8118152664 5940738.8295723945 567660.8671317989 5940738.851814643 567660.9224455486 5940738.87406381 567660.9777565146 5940738.896319897 567661.033064696 5940738.918582903 567661.088370092 5940738.940852827 567661.1436727016 5940738.96312967 567661.198972524 5940738.985413431 567661.2542695585 5940739.00770411 567661.309563804 5940739.0300017055 567661.3648552597 5940739.052306218 567661.4201439248 5940739.074617648 567661.4754297984 5940739.096935993 567661.5307128795 5940739.119261255 567661.5859931675 5940739.141593431 567661.6412706614 5940739.163932523 567661.6965453603 5940739.18627853 567661.7518172633 5940739.208631451 567661.8070863696 5940739.230991287 567661.8623526784 5940739.253358036 567661.9176161888 5940739.275731699 567661.9728768999 5940739.298112275 567662.0281348107 5940739.320499763 567662.0833899206 5940739.342894164 567662.1386422287 5940739.365295477 567662.1938917339 5940739.387703702 567662.2491384356 5940739.410118838 567662.3043823327 5940739.432540884 567662.3596234245 5940739.454969842 567662.4148617102 5940739.47740571 567662.4700971886 5940739.499848488 567662.5253298592 5940739.522298175 567662.580559721 5940739.5447547715 567662.6357867732 5940739.567218277 567662.6910110147 5940739.589688691 567662.7462324449 5940739.612166013 567662.8014510629 5940739.634650243 567662.8566668676 5940739.65714138 567662.9118798585 5940739.679639425 567662.9670900345 5940739.702144376 567663.0222973947 5940739.724656234 567663.0775019384 5940739.747174998 567663.1327036646 5940739.769700667 567663.1879025726 5940739.792233242 567663.2430986613 5940739.814772721 567663.29829193 5940739.837319106 567663.3534823778 5940739.859872394 567663.4086700039 5940739.882432587 567663.4638548073 5940739.904999684 567663.5190367872 5940739.927573683 567663.5742159429 5940739.950154586 567663.6293922731 5940739.97274239 567663.6845657774 5940739.995337097 567663.7397364548 5940740.017938706 567663.7949043043 5940740.040547216 567663.8500693252 5940740.063162628 567663.9052315166 5940740.08578494 567663.9603908774 5940740.108414153 567664.0155474072 5940740.131050265 567664.0707011047 5940740.153693277 567664.1258519692 5940740.17634319 567664.181 5940740.199 567645.602 5940769.741 567630.281 5940793.578 567616.796 5940813.947 567608.311 5940826.136 567605.289 5940830.185 567597.668 5940841.504 567591.007 5940851.067 567569.927 5940879.05</gml:posList>
            </gml:LineStringSegment>
          </gml:segments>
        </gml:Curve>
      </xplan:position>

The transformed geometry looks fine in HALE Studio. Our goal is to adapt the geometry as it is from the source.

We are using HALE Studio 3.5.0.

stempler commented 5 years ago

You need to turn copying the parsed (JTS) geometry objects off in the function parameters. If hale finds geometry objects it will prefer them for geometry encoding. Otherwise it will just use the structure as-is.

If you don't use the geometry objects you can also ignore the errors you have parsing them.

lgoltz commented 5 years ago

Works fine! Thanks a lot for the prompt reply.