/// <exception cref="com.fasterxml.jackson.core.JsonParseException"/>
        /// <exception cref="System.IO.IOException"/>
        internal virtual bool TestCR181369()
        {
            // CR181369
            bool   bAnswer = true;
            string jsonStringPointAndWKT = "{\"x\":10.0,\"y\":20.0,\"spatialReference\":{\"wkt\" : \"PROJCS[\\\"NAD83_UTM_zone_15N\\\",GEOGCS[\\\"GCS_North_American_1983\\\",DATUM[\\\"D_North_American_1983\\\",SPHEROID[\\\"GRS_1980\\\",6378137.0,298.257222101]],PRIMEM[\\\"Greenwich\\\",0.0],UNIT[\\\"Degree\\\",0.0174532925199433]],PROJECTION[\\\"Transverse_Mercator\\\"],PARAMETER[\\\"false_easting\\\",500000.0],PARAMETER[\\\"false_northing\\\",0.0],PARAMETER[\\\"central_meridian\\\",-93.0],PARAMETER[\\\"scale_factor\\\",0.9996],PARAMETER[\\\"latitude_of_origin\\\",0.0],UNIT[\\\"Meter\\\",1.0]]\"} }";

            com.fasterxml.jackson.core.JsonParser jsonParserPointAndWKT = factory.CreateParser(jsonStringPointAndWKT);
            com.epl.geometry.MapGeometry          mapGeom2 = com.epl.geometry.GeometryEngine.JsonToGeometry(jsonParserPointAndWKT);
            string jsonStringPointAndWKT2 = com.epl.geometry.GeometryEngine.GeometryToJson(mapGeom2.GetSpatialReference(), mapGeom2.GetGeometry());

            com.fasterxml.jackson.core.JsonParser jsonParserPointAndWKT2 = factory.CreateParser(jsonStringPointAndWKT2);
            com.epl.geometry.MapGeometry          mapGeom3 = com.epl.geometry.GeometryEngine.JsonToGeometry(jsonParserPointAndWKT2);
            NUnit.Framework.Assert.IsTrue(((com.epl.geometry.Point)mapGeom2.GetGeometry()).GetX() == ((com.epl.geometry.Point)mapGeom3.GetGeometry()).GetX());
            NUnit.Framework.Assert.IsTrue(((com.epl.geometry.Point)mapGeom2.GetGeometry()).GetY() == ((com.epl.geometry.Point)mapGeom3.GetGeometry()).GetY());
            string s1 = mapGeom2.GetSpatialReference().GetText();
            string s2 = mapGeom3.GetSpatialReference().GetText();

            NUnit.Framework.Assert.IsTrue(s1.Equals(s2));
            int id2 = mapGeom2.GetSpatialReference().GetID();
            int id3 = mapGeom3.GetSpatialReference().GetID();

            NUnit.Framework.Assert.IsTrue(id2 == id3);
            if (!CheckResultSpatialRef(mapGeom3, mapGeom2.GetSpatialReference().GetID(), 0))
            {
                bAnswer = false;
            }
            return(bAnswer);
        }
示例#2
0
 public virtual void TestPolygon()
 {
     com.epl.geometry.Polygon polygon = new com.epl.geometry.Polygon();
     polygon.StartPath(-97.06138, 32.837);
     polygon.LineTo(-97.06133, 32.836);
     polygon.LineTo(-97.06124, 32.834);
     polygon.LineTo(-97.06127, 32.832);
     polygon.StartPath(-97.06326, 32.759);
     polygon.LineTo(-97.06298, 32.755);
     {
         com.fasterxml.jackson.core.JsonParser polygonPathsWgs84Parser = factory.CreateJsonParser(com.epl.geometry.GeometryEngine.GeometryToJson(spatialReferenceWGS84, polygon));
         com.epl.geometry.MapGeometry          mPolygonWGS84MP         = com.epl.geometry.GeometryEngine.JsonToGeometry(polygonPathsWgs84Parser);
         NUnit.Framework.Assert.IsTrue(polygon.GetPointCount() + 1 == ((com.epl.geometry.Polygon)mPolygonWGS84MP.GetGeometry()).GetPointCount());
         NUnit.Framework.Assert.IsTrue(polygon.GetPoint(0).GetX() == ((com.epl.geometry.Polygon)mPolygonWGS84MP.GetGeometry()).GetPoint(0).GetX());
         NUnit.Framework.Assert.IsTrue(polygon.GetPoint(0).GetY() == ((com.epl.geometry.Polygon)mPolygonWGS84MP.GetGeometry()).GetPoint(0).GetY());
         NUnit.Framework.Assert.IsTrue(polygon.GetPathCount() == ((com.epl.geometry.Polygon)mPolygonWGS84MP.GetGeometry()).GetPathCount());
         NUnit.Framework.Assert.IsTrue(polygon.GetSegmentCount() + 1 == ((com.epl.geometry.Polygon)mPolygonWGS84MP.GetGeometry()).GetSegmentCount());
         NUnit.Framework.Assert.IsTrue(polygon.GetSegmentCount(0) == ((com.epl.geometry.Polygon)mPolygonWGS84MP.GetGeometry()).GetSegmentCount(0));
         NUnit.Framework.Assert.IsTrue(polygon.GetSegmentCount(1) + 1 == ((com.epl.geometry.Polygon)mPolygonWGS84MP.GetGeometry()).GetSegmentCount(1));
         int lastIndex = polygon.GetPointCount() - 1;
         NUnit.Framework.Assert.IsTrue(polygon.GetPoint(lastIndex).GetX() == ((com.epl.geometry.Polygon)mPolygonWGS84MP.GetGeometry()).GetPoint(lastIndex).GetX());
         NUnit.Framework.Assert.IsTrue(polygon.GetPoint(lastIndex).GetY() == ((com.epl.geometry.Polygon)mPolygonWGS84MP.GetGeometry()).GetPoint(lastIndex).GetY());
         NUnit.Framework.Assert.IsTrue(spatialReferenceWGS84.GetID() == mPolygonWGS84MP.GetSpatialReference().GetID());
         com.epl.geometry.Polygon emptyPolygon = new com.epl.geometry.Polygon();
         string emptyPolygonString             = com.epl.geometry.GeometryEngine.GeometryToJson(spatialReferenceWGS84, emptyPolygon);
         polygonPathsWgs84Parser = factory.CreateJsonParser(emptyPolygonString);
         mPolygonWGS84MP         = com.epl.geometry.GeometryEngine.JsonToGeometry(polygonPathsWgs84Parser);
         NUnit.Framework.Assert.IsTrue(mPolygonWGS84MP.GetGeometry().IsEmpty());
         NUnit.Framework.Assert.IsTrue(spatialReferenceWGS84.GetID() == mPolygonWGS84MP.GetSpatialReference().GetID());
     }
 }
示例#3
0
 public virtual void TestMultiPoint()
 {
     com.epl.geometry.MultiPoint multiPoint1 = new com.epl.geometry.MultiPoint();
     multiPoint1.Add(-97.06138, 32.837);
     multiPoint1.Add(-97.06133, 32.836);
     multiPoint1.Add(-97.06124, 32.834);
     multiPoint1.Add(-97.06127, 32.832);
     {
         com.fasterxml.jackson.core.JsonParser mPointWgs84Parser = factory.CreateJsonParser(com.epl.geometry.GeometryEngine.GeometryToJson(spatialReferenceWGS84, multiPoint1));
         com.epl.geometry.MapGeometry          mPointWgs84MP     = com.epl.geometry.GeometryEngine.JsonToGeometry(mPointWgs84Parser);
         NUnit.Framework.Assert.IsTrue(multiPoint1.GetPointCount() == ((com.epl.geometry.MultiPoint)mPointWgs84MP.GetGeometry()).GetPointCount());
         NUnit.Framework.Assert.IsTrue(multiPoint1.GetPoint(0).GetX() == ((com.epl.geometry.MultiPoint)mPointWgs84MP.GetGeometry()).GetPoint(0).GetX());
         NUnit.Framework.Assert.IsTrue(multiPoint1.GetPoint(0).GetY() == ((com.epl.geometry.MultiPoint)mPointWgs84MP.GetGeometry()).GetPoint(0).GetY());
         int lastIndex = multiPoint1.GetPointCount() - 1;
         NUnit.Framework.Assert.IsTrue(multiPoint1.GetPoint(lastIndex).GetX() == ((com.epl.geometry.MultiPoint)mPointWgs84MP.GetGeometry()).GetPoint(lastIndex).GetX());
         NUnit.Framework.Assert.IsTrue(multiPoint1.GetPoint(lastIndex).GetY() == ((com.epl.geometry.MultiPoint)mPointWgs84MP.GetGeometry()).GetPoint(lastIndex).GetY());
         NUnit.Framework.Assert.IsTrue(spatialReferenceWGS84.GetID() == mPointWgs84MP.GetSpatialReference().GetID());
         com.epl.geometry.MultiPoint mPointEmpty = new com.epl.geometry.MultiPoint();
         string mPointEmptyString = com.epl.geometry.GeometryEngine.GeometryToJson(spatialReferenceWGS84, mPointEmpty);
         mPointWgs84Parser = factory.CreateJsonParser(mPointEmptyString);
         mPointWgs84MP     = com.epl.geometry.GeometryEngine.JsonToGeometry(mPointWgs84Parser);
         NUnit.Framework.Assert.IsTrue(mPointWgs84MP.GetGeometry().IsEmpty());
         NUnit.Framework.Assert.IsTrue(spatialReferenceWGS84.GetID() == mPointWgs84MP.GetSpatialReference().GetID());
     }
 }
示例#4
0
        public virtual void TestGeometryToJSONOldID()
        {
            // CR
            com.epl.geometry.Polygon geom = new com.epl.geometry.Polygon();
            geom.StartPath(new com.epl.geometry.Point(-113, 34));
            geom.LineTo(new com.epl.geometry.Point(-105, 34));
            geom.LineTo(new com.epl.geometry.Point(-108, 40));
            string outputPolygon = com.epl.geometry.GeometryEngine.GeometryToJson(com.epl.geometry.SpatialReference.Create(3857), geom);
            // Test
            // WKID
            // ==
            // -1
            string correctPolygon = "{\"rings\":[[[-113,34],[-105,34],[-108,40],[-113,34]]],\"spatialReference\":{\"wkid\":102100,\"latestWkid\":3857}}";

            NUnit.Framework.Assert.IsTrue(outputPolygon.Equals(correctPolygon));
            com.fasterxml.jackson.core.JsonFactory jf = new com.fasterxml.jackson.core.JsonFactory();
            com.fasterxml.jackson.core.JsonParser  jp = jf.CreateJsonParser(outputPolygon);
            jp.NextToken();
            com.epl.geometry.MapGeometry mg = com.epl.geometry.GeometryEngine.JsonToGeometry(jp);
            int srId    = mg.GetSpatialReference().GetID();
            int srOldId = mg.GetSpatialReference().GetOldID();

            NUnit.Framework.Assert.IsTrue(mg.GetSpatialReference().GetID() == 3857);
            NUnit.Framework.Assert.IsTrue(mg.GetSpatialReference().GetLatestID() == 3857);
            NUnit.Framework.Assert.IsTrue(mg.GetSpatialReference().GetOldID() == 102100);
        }
        internal virtual bool CheckResultSpatialRef(com.epl.geometry.MapGeometry mapGeometry, int expectWki1, int expectWki2)
        {
            com.epl.geometry.SpatialReference sr = mapGeometry.GetSpatialReference();
            string Wkt  = sr.GetText();
            int    wki1 = sr.GetLatestID();

            if (!(wki1 == expectWki1 || wki1 == expectWki2))
            {
                return(false);
            }
            if (!(Wkt != null && Wkt.Length > 0))
            {
                return(false);
            }
            com.epl.geometry.SpatialReference sr2 = com.epl.geometry.SpatialReference.Create(Wkt);
            int wki2 = sr2.GetID();

            if (expectWki2 > 0)
            {
                if (!(wki2 == expectWki1 || wki2 == expectWki2))
                {
                    return(false);
                }
            }
            else
            {
                if (!(wki2 == expectWki1))
                {
                    return(false);
                }
            }
            return(true);
        }
示例#6
0
        /// <summary>The output of this method can be only used for debugging.</summary>
        /// <remarks>The output of this method can be only used for debugging. It is subject to change without notice.</remarks>
//		public override string ToString()
//		{
//			string snippet = com.epl.geometry.OperatorExportToJson.Local().Execute(GetSpatialReference(), GetGeometry());
//			if (snippet.Length > 200)
//			{
//				return snippet.Substring(0, 197 - 0) + "... (" + snippet.Length + " characters)";
//			}
//			else
//			{
//				return snippet;
//			}
//		}

        public override bool Equals(object other)
        {
            if (other == null)
            {
                return(false);
            }
            if (other == this)
            {
                return(true);
            }
            if (other.GetType() != GetType())
            {
                return(false);
            }
            com.epl.geometry.MapGeometry      omg = (com.epl.geometry.MapGeometry)other;
            com.epl.geometry.SpatialReference sr  = GetSpatialReference();
            com.epl.geometry.Geometry         g   = GetGeometry();
            com.epl.geometry.SpatialReference osr = omg.GetSpatialReference();
            com.epl.geometry.Geometry         og  = omg.GetGeometry();
            if (sr != osr)
            {
                if (sr == null || !sr.Equals(osr))
                {
                    return(false);
                }
            }
            if (g != og)
            {
                if (g == null || !g.Equals(og))
                {
                    return(false);
                }
            }
            return(true);
        }
        /// <exception cref="com.fasterxml.jackson.core.JsonParseException"/>
        /// <exception cref="System.IO.IOException"/>
        internal virtual bool TestMultiPoint()
        {
            bool bAnswer = true;

            com.epl.geometry.MultiPoint multiPoint1 = new com.epl.geometry.MultiPoint();
            multiPoint1.Add(-97.06138, 32.837);
            multiPoint1.Add(-97.06133, 32.836);
            multiPoint1.Add(-97.06124, 32.834);
            multiPoint1.Add(-97.06127, 32.832);
            {
                string s = com.epl.geometry.GeometryEngine.GeometryToJson(spatialReferenceWGS84, multiPoint1);
                com.fasterxml.jackson.core.JsonParser mPointWgs84Parser = factory.CreateParser(s);
                com.epl.geometry.MapGeometry          mPointWgs84MP     = com.epl.geometry.GeometryEngine.JsonToGeometry(mPointWgs84Parser);
                NUnit.Framework.Assert.IsTrue(multiPoint1.GetPointCount() == ((com.epl.geometry.MultiPoint)mPointWgs84MP.GetGeometry()).GetPointCount());
                NUnit.Framework.Assert.IsTrue(multiPoint1.GetPoint(0).GetX() == ((com.epl.geometry.MultiPoint)mPointWgs84MP.GetGeometry()).GetPoint(0).GetX());
                NUnit.Framework.Assert.IsTrue(multiPoint1.GetPoint(0).GetY() == ((com.epl.geometry.MultiPoint)mPointWgs84MP.GetGeometry()).GetPoint(0).GetY());
                int lastIndex = multiPoint1.GetPointCount() - 1;
                NUnit.Framework.Assert.IsTrue(multiPoint1.GetPoint(lastIndex).GetX() == ((com.epl.geometry.MultiPoint)mPointWgs84MP.GetGeometry()).GetPoint(lastIndex).GetX());
                NUnit.Framework.Assert.IsTrue(multiPoint1.GetPoint(lastIndex).GetY() == ((com.epl.geometry.MultiPoint)mPointWgs84MP.GetGeometry()).GetPoint(lastIndex).GetY());
                NUnit.Framework.Assert.IsTrue(spatialReferenceWGS84.GetID() == mPointWgs84MP.GetSpatialReference().GetID());
                if (!CheckResultSpatialRef(mPointWgs84MP, 4326, 0))
                {
                    bAnswer = false;
                }
            }
            {
                com.epl.geometry.MultiPoint p = new com.epl.geometry.MultiPoint();
                p.AddAttribute(com.epl.geometry.VertexDescription.Semantics.Z);
                p.AddAttribute(com.epl.geometry.VertexDescription.Semantics.M);
                string s = com.epl.geometry.GeometryEngine.GeometryToJson(spatialReferenceWebMerc1, p);
                NUnit.Framework.Assert.IsTrue(s.Equals("{\"hasZ\":true,\"hasM\":true,\"points\":[],\"spatialReference\":{\"wkid\":102100,\"latestWkid\":3857}}"));
                p.Add(10.0, 20.0, 30.0);
                p.Add(20.0, 40.0, 60.0);
                s = com.epl.geometry.GeometryEngine.GeometryToJson(spatialReferenceWebMerc1, p);
                NUnit.Framework.Assert.IsTrue(s.Equals("{\"hasZ\":true,\"hasM\":true,\"points\":[[10,20,30,null],[20,40,60,null]],\"spatialReference\":{\"wkid\":102100,\"latestWkid\":3857}}"));
            }
            {
                string points = "{\"hasM\" : false, \"hasZ\" : true, \"uncle remus\" : null, \"points\" : [ [0,0,1], [0.0,10.0,1], [10.0,10.0,1], [10.0,0.0,1, 6666] ],\"spatialReference\" : {\"wkid\" : 4326}}";
                com.epl.geometry.MapGeometry mp         = com.epl.geometry.GeometryEngine.JsonToGeometry(factory.CreateParser(points));
                com.epl.geometry.MultiPoint  multipoint = (com.epl.geometry.MultiPoint)mp.GetGeometry();
                NUnit.Framework.Assert.IsTrue(multipoint.GetPointCount() == 4);
                com.epl.geometry.Point2D point2d;
                point2d = multipoint.GetXY(0);
                NUnit.Framework.Assert.IsTrue(point2d.x == 0.0 && point2d.y == 0.0);
                point2d = multipoint.GetXY(1);
                NUnit.Framework.Assert.IsTrue(point2d.x == 0.0 && point2d.y == 10.0);
                point2d = multipoint.GetXY(2);
                NUnit.Framework.Assert.IsTrue(point2d.x == 10.0 && point2d.y == 10.0);
                point2d = multipoint.GetXY(3);
                NUnit.Framework.Assert.IsTrue(point2d.x == 10.0 && point2d.y == 0.0);
                NUnit.Framework.Assert.IsTrue(multipoint.HasAttribute(com.epl.geometry.VertexDescription.Semantics.Z));
                NUnit.Framework.Assert.IsTrue(!multipoint.HasAttribute(com.epl.geometry.VertexDescription.Semantics.M));
                double z = multipoint.GetAttributeAsDbl(com.epl.geometry.VertexDescription.Semantics.Z, 0, 0);
                NUnit.Framework.Assert.IsTrue(z == 1);
                com.epl.geometry.SpatialReference spatial_reference = mp.GetSpatialReference();
                NUnit.Framework.Assert.IsTrue(spatial_reference.GetID() == 4326);
            }
            return(bAnswer);
        }
示例#8
0
        public virtual void TestOldCRS()
        {
            string inputStr = "{\"type\":\"Polygon\",\"coordinates\":[[[-180,-90],[180,-90],[180,90],[-180,90],[-180,-90]]], \"crs\":\"EPSG:4267\"}";

            com.epl.geometry.MapGeometry mg = com.epl.geometry.OperatorImportFromGeoJson.Local().Execute(com.epl.geometry.GeoJsonImportFlags.geoJsonImportDefaults, com.epl.geometry.Geometry.Type.Unknown, inputStr, null);
            string result = com.epl.geometry.GeometryEngine.GeometryToGeoJson(mg.GetSpatialReference(), mg.GetGeometry());

            NUnit.Framework.Assert.AreEqual("{\"type\":\"Polygon\",\"coordinates\":[[[-180,-90],[180,-90],[180,90],[-180,90],[-180,-90]]],\"crs\":{\"type\":\"name\",\"properties\":{\"name\":\"EPSG:4267\"}}}", result);
        }
示例#9
0
        public virtual void Test3DPoint()
        {
            string jsonString3DPt = "{\"x\" : -118.15, \"y\" : 33.80, \"z\" : 10.0, \"spatialReference\" : {\"wkid\" : 4326}}";

            com.fasterxml.jackson.core.JsonParser jsonParser3DPt = factory.CreateParser(jsonString3DPt);
            com.epl.geometry.MapGeometry          point3DMP      = com.epl.geometry.GeometryEngine.JsonToGeometry(jsonParser3DPt);
            NUnit.Framework.Assert.IsTrue(-118.15 == ((com.epl.geometry.Point)point3DMP.GetGeometry()).GetX());
            NUnit.Framework.Assert.IsTrue(33.80 == ((com.epl.geometry.Point)point3DMP.GetGeometry()).GetY());
            NUnit.Framework.Assert.IsTrue(spatialReferenceWGS84.GetID() == point3DMP.GetSpatialReference().GetID());
        }
示例#10
0
        public virtual void TestOnlyWKI()
        {
            string jsonStringSR = "{\"wkid\" : 4326}";

            com.fasterxml.jackson.core.JsonParser jsonParserSR = factory.CreateJsonParser(jsonStringSR);
            jsonParserSR.NextToken();
            com.epl.geometry.MapGeometry mapGeom = com.epl.geometry.GeometryEngine.JsonToGeometry(jsonParserSR);
            com.epl.geometry.Utils.ShowProjectedGeometryInfo(mapGeom);
            com.epl.geometry.SpatialReference sr = mapGeom.GetSpatialReference();
            NUnit.Framework.Assert.IsTrue(sr == null);
        }
示例#11
0
        public virtual void TestPolygonWithEmptyWKT_NoWKI()
        {
            string jsonStringPg = "{ \"rings\" :[  [ [-97.06138,32.837], [-97.06133,32.836], " + "[-97.06124,32.834], [-97.06127,32.832], [-97.06138,32.837] ],  " + "[ [-97.06326,32.759], [-97.06298,32.755], [-97.06153,32.749], [-97.06326,32.759] ]], " + "\"spatialReference\" : {\"wkt\" : \"\"}}";

            com.fasterxml.jackson.core.JsonParser jsonParserPg = factory.CreateParser(jsonStringPg);
            jsonParserPg.NextToken();
            com.epl.geometry.MapGeometry mapGeom = com.epl.geometry.GeometryEngine.JsonToGeometry(jsonParserPg);
            com.epl.geometry.Utils.ShowProjectedGeometryInfo(mapGeom);
            com.epl.geometry.SpatialReference sr = mapGeom.GetSpatialReference();
            NUnit.Framework.Assert.IsTrue(sr == null);
        }
示例#12
0
 public virtual void Test3DPoint3()
 {
     {
         com.epl.geometry.Point point1 = new com.epl.geometry.Point(10.0, 20.0);
         com.fasterxml.jackson.core.JsonParser pointWgs84Parser = factory.CreateJsonParser(com.epl.geometry.GeometryEngine.GeometryToJson(spatialReferenceWGS84, point1));
         com.epl.geometry.MapGeometry          pointWgs84MP     = com.epl.geometry.GeometryEngine.JsonToGeometry(pointWgs84Parser);
         NUnit.Framework.Assert.IsTrue(point1.GetX() == ((com.epl.geometry.Point)pointWgs84MP.GetGeometry()).GetX());
         NUnit.Framework.Assert.IsTrue(point1.GetY() == ((com.epl.geometry.Point)pointWgs84MP.GetGeometry()).GetY());
         NUnit.Framework.Assert.IsTrue(spatialReferenceWGS84.GetID() == pointWgs84MP.GetSpatialReference().GetID());
     }
 }
示例#13
0
 public virtual void TestEnvelope()
 {
     com.epl.geometry.Envelope envelope = new com.epl.geometry.Envelope();
     envelope.SetCoords(-109.55, 25.76, -86.39, 49.94);
     {
         com.fasterxml.jackson.core.JsonParser envelopeWGS84Parser = factory.CreateJsonParser(com.epl.geometry.GeometryEngine.GeometryToJson(spatialReferenceWGS84, envelope));
         com.epl.geometry.MapGeometry          envelopeWGS84MP     = com.epl.geometry.GeometryEngine.JsonToGeometry(envelopeWGS84Parser);
         NUnit.Framework.Assert.IsTrue(envelope.IsEmpty() == envelopeWGS84MP.GetGeometry().IsEmpty());
         NUnit.Framework.Assert.IsTrue(envelope.GetXMax() == ((com.epl.geometry.Envelope)envelopeWGS84MP.GetGeometry()).GetXMax());
         NUnit.Framework.Assert.IsTrue(envelope.GetYMax() == ((com.epl.geometry.Envelope)envelopeWGS84MP.GetGeometry()).GetYMax());
         NUnit.Framework.Assert.IsTrue(envelope.GetXMin() == ((com.epl.geometry.Envelope)envelopeWGS84MP.GetGeometry()).GetXMin());
         NUnit.Framework.Assert.IsTrue(envelope.GetYMin() == ((com.epl.geometry.Envelope)envelopeWGS84MP.GetGeometry()).GetYMin());
         NUnit.Framework.Assert.IsTrue(spatialReferenceWGS84.GetID() == envelopeWGS84MP.GetSpatialReference().GetID());
         com.epl.geometry.Envelope emptyEnvelope = new com.epl.geometry.Envelope();
         string emptyEnvString = com.epl.geometry.GeometryEngine.GeometryToJson(spatialReferenceWGS84, emptyEnvelope);
         envelopeWGS84Parser = factory.CreateJsonParser(emptyEnvString);
         envelopeWGS84MP     = com.epl.geometry.GeometryEngine.JsonToGeometry(envelopeWGS84Parser);
         NUnit.Framework.Assert.IsTrue(envelopeWGS84MP.GetGeometry().IsEmpty());
         NUnit.Framework.Assert.IsTrue(spatialReferenceWGS84.GetID() == envelopeWGS84MP.GetSpatialReference().GetID());
     }
 }
示例#14
0
 public virtual void Test3DPoint1()
 {
     com.epl.geometry.Point point1     = new com.epl.geometry.Point(10.0, 20.0);
     com.epl.geometry.Point pointEmpty = new com.epl.geometry.Point();
     {
         com.fasterxml.jackson.core.JsonParser pointWebMerc1Parser = factory.CreateJsonParser(com.epl.geometry.GeometryEngine.GeometryToJson(spatialReferenceWebMerc1, point1));
         com.epl.geometry.MapGeometry          pointWebMerc1MP     = com.epl.geometry.GeometryEngine.JsonToGeometry(pointWebMerc1Parser);
         NUnit.Framework.Assert.IsTrue(point1.GetX() == ((com.epl.geometry.Point)pointWebMerc1MP.GetGeometry()).GetX());
         NUnit.Framework.Assert.IsTrue(point1.GetY() == ((com.epl.geometry.Point)pointWebMerc1MP.GetGeometry()).GetY());
         int srIdOri   = spatialReferenceWebMerc1.GetID();
         int srIdAfter = pointWebMerc1MP.GetSpatialReference().GetID();
         NUnit.Framework.Assert.IsTrue(srIdOri == srIdAfter || srIdAfter == 3857);
         pointWebMerc1Parser = factory.CreateJsonParser(com.epl.geometry.GeometryEngine.GeometryToJson(null, point1));
         pointWebMerc1MP     = com.epl.geometry.GeometryEngine.JsonToGeometry(pointWebMerc1Parser);
         NUnit.Framework.Assert.IsTrue(null == pointWebMerc1MP.GetSpatialReference());
         string pointEmptyString = com.epl.geometry.GeometryEngine.GeometryToJson(spatialReferenceWebMerc1, pointEmpty);
         pointWebMerc1Parser = factory.CreateJsonParser(pointEmptyString);
         pointWebMerc1MP     = com.epl.geometry.GeometryEngine.JsonToGeometry(pointWebMerc1Parser);
         NUnit.Framework.Assert.IsTrue(pointWebMerc1MP.GetGeometry().IsEmpty());
         int srIdOri2   = spatialReferenceWebMerc1.GetID();
         int srIdAfter2 = pointWebMerc1MP.GetSpatialReference().GetID();
         NUnit.Framework.Assert.IsTrue(srIdOri2 == srIdAfter2 || srIdAfter2 == 3857);
     }
 }
示例#15
0
 public virtual void TestMP2onCR175871()
 {
     com.epl.geometry.Polygon pg = new com.epl.geometry.Polygon();
     pg.StartPath(-50, 10);
     pg.LineTo(-50, 12);
     pg.LineTo(-45, 12);
     pg.LineTo(-45, 10);
     com.epl.geometry.Polygon pg1 = new com.epl.geometry.Polygon();
     pg1.StartPath(-45, 10);
     pg1.LineTo(-40, 10);
     pg1.LineTo(-40, 8);
     pg.Add(pg1, false);
     com.epl.geometry.SpatialReference spatialReference = com.epl.geometry.SpatialReference.Create(4326);
     try
     {
         string jSonStr = com.epl.geometry.GeometryEngine.GeometryToJson(spatialReference, pg);
         com.fasterxml.jackson.core.JsonFactory jf = new com.fasterxml.jackson.core.JsonFactory();
         com.fasterxml.jackson.core.JsonParser  jp = jf.CreateJsonParser(jSonStr);
         jp.NextToken();
         com.epl.geometry.MapGeometry mg = com.epl.geometry.GeometryEngine.JsonToGeometry(jp);
         com.epl.geometry.Geometry    gm = mg.GetGeometry();
         NUnit.Framework.Assert.AreEqual(com.epl.geometry.Geometry.Type.Polygon, gm.GetType());
         NUnit.Framework.Assert.IsTrue(mg.GetSpatialReference().GetID() == 4326);
         com.epl.geometry.Polygon pgNew = (com.epl.geometry.Polygon)gm;
         NUnit.Framework.Assert.AreEqual(pgNew.GetPathCount(), pg.GetPathCount());
         NUnit.Framework.Assert.AreEqual(pgNew.GetPointCount(), pg.GetPointCount());
         NUnit.Framework.Assert.AreEqual(pgNew.GetSegmentCount(), pg.GetSegmentCount());
         NUnit.Framework.Assert.AreEqual(pgNew.GetPoint(0).GetX(), pg.GetPoint(0).GetX(), 0.000000001);
         NUnit.Framework.Assert.AreEqual(pgNew.GetPoint(1).GetX(), pg.GetPoint(1).GetX(), 0.000000001);
         NUnit.Framework.Assert.AreEqual(pgNew.GetPoint(2).GetX(), pg.GetPoint(2).GetX(), 0.000000001);
         NUnit.Framework.Assert.AreEqual(pgNew.GetPoint(3).GetX(), pg.GetPoint(3).GetX(), 0.000000001);
         NUnit.Framework.Assert.AreEqual(pgNew.GetPoint(0).GetY(), pg.GetPoint(0).GetY(), 0.000000001);
         NUnit.Framework.Assert.AreEqual(pgNew.GetPoint(1).GetY(), pg.GetPoint(1).GetY(), 0.000000001);
         NUnit.Framework.Assert.AreEqual(pgNew.GetPoint(2).GetY(), pg.GetPoint(2).GetY(), 0.000000001);
         NUnit.Framework.Assert.AreEqual(pgNew.GetPoint(3).GetY(), pg.GetPoint(3).GetY(), 0.000000001);
     }
     catch (System.Exception ex)
     {
         string err = ex.Message;
         System.Console.Out.Write(err);
         throw;
     }
 }
示例#16
0
 public static com.epl.geometry.ogc.OGCGeometry FromJson(string @string)
 {
     com.epl.geometry.MapGeometry mapGeom = com.epl.geometry.GeometryEngine.JsonToGeometry(com.epl.geometry.JsonParserReader.CreateFromString(@string));
     return(com.epl.geometry.ogc.OGCGeometry.CreateFromEsriGeometry(mapGeom.GetGeometry(), mapGeom.GetSpatialReference()));
 }
        /// <exception cref="com.fasterxml.jackson.core.JsonParseException"/>
        /// <exception cref="System.IO.IOException"/>
        internal virtual bool TestPoint()
        {
            bool bAnswer = true;

            com.epl.geometry.Point point1     = new com.epl.geometry.Point(10.0, 20.0);
            com.epl.geometry.Point pointEmpty = new com.epl.geometry.Point();
            {
                com.fasterxml.jackson.core.JsonParser pointWebMerc1Parser = factory.CreateParser(com.epl.geometry.GeometryEngine.GeometryToJson(spatialReferenceWebMerc1, point1));
                com.epl.geometry.MapGeometry          pointWebMerc1MP     = com.epl.geometry.GeometryEngine.JsonToGeometry(pointWebMerc1Parser);
                NUnit.Framework.Assert.IsTrue(point1.GetX() == ((com.epl.geometry.Point)pointWebMerc1MP.GetGeometry()).GetX());
                NUnit.Framework.Assert.IsTrue(point1.GetY() == ((com.epl.geometry.Point)pointWebMerc1MP.GetGeometry()).GetY());
                NUnit.Framework.Assert.IsTrue(spatialReferenceWebMerc1.GetID() == pointWebMerc1MP.GetSpatialReference().GetID() || pointWebMerc1MP.GetSpatialReference().GetID() == 3857);
                if (!CheckResultSpatialRef(pointWebMerc1MP, 102100, 3857))
                {
                    bAnswer = false;
                }
                pointWebMerc1Parser = factory.CreateParser(com.epl.geometry.GeometryEngine.GeometryToJson(null, point1));
                pointWebMerc1MP     = com.epl.geometry.GeometryEngine.JsonToGeometry(pointWebMerc1Parser);
                NUnit.Framework.Assert.IsTrue(null == pointWebMerc1MP.GetSpatialReference());
                if (pointWebMerc1MP.GetSpatialReference() != null)
                {
                    if (!CheckResultSpatialRef(pointWebMerc1MP, 102100, 3857))
                    {
                        bAnswer = false;
                    }
                }
                string pointEmptyString = com.epl.geometry.GeometryEngine.GeometryToJson(spatialReferenceWebMerc1, pointEmpty);
                pointWebMerc1Parser = factory.CreateParser(pointEmptyString);
            }
            com.fasterxml.jackson.core.JsonParser pointWebMerc2Parser = factory.CreateParser(com.epl.geometry.GeometryEngine.GeometryToJson(spatialReferenceWebMerc2, point1));
            com.epl.geometry.MapGeometry          pointWebMerc2MP     = com.epl.geometry.GeometryEngine.JsonToGeometry(pointWebMerc2Parser);
            NUnit.Framework.Assert.IsTrue(point1.GetX() == ((com.epl.geometry.Point)pointWebMerc2MP.GetGeometry()).GetX());
            NUnit.Framework.Assert.IsTrue(point1.GetY() == ((com.epl.geometry.Point)pointWebMerc2MP.GetGeometry()).GetY());
            NUnit.Framework.Assert.IsTrue(spatialReferenceWebMerc2.GetLatestID() == pointWebMerc2MP.GetSpatialReference().GetLatestID());
            if (!CheckResultSpatialRef(pointWebMerc2MP, spatialReferenceWebMerc2.GetLatestID(), 0))
            {
                bAnswer = false;
            }
            {
                com.fasterxml.jackson.core.JsonParser pointWgs84Parser = factory.CreateParser(com.epl.geometry.GeometryEngine.GeometryToJson(spatialReferenceWGS84, point1));
                com.epl.geometry.MapGeometry          pointWgs84MP     = com.epl.geometry.GeometryEngine.JsonToGeometry(pointWgs84Parser);
                NUnit.Framework.Assert.IsTrue(point1.GetX() == ((com.epl.geometry.Point)pointWgs84MP.GetGeometry()).GetX());
                NUnit.Framework.Assert.IsTrue(point1.GetY() == ((com.epl.geometry.Point)pointWgs84MP.GetGeometry()).GetY());
                NUnit.Framework.Assert.IsTrue(spatialReferenceWGS84.GetID() == pointWgs84MP.GetSpatialReference().GetID());
                if (!CheckResultSpatialRef(pointWgs84MP, 4326, 0))
                {
                    bAnswer = false;
                }
            }
            {
                com.epl.geometry.Point p = new com.epl.geometry.Point();
                string s = com.epl.geometry.GeometryEngine.GeometryToJson(spatialReferenceWebMerc1, p);
                NUnit.Framework.Assert.IsTrue(s.Equals("{\"x\":null,\"y\":null,\"spatialReference\":{\"wkid\":102100,\"latestWkid\":3857}}"));
                p.AddAttribute(com.epl.geometry.VertexDescription.Semantics.Z);
                p.AddAttribute(com.epl.geometry.VertexDescription.Semantics.M);
                s = com.epl.geometry.GeometryEngine.GeometryToJson(spatialReferenceWebMerc1, p);
                NUnit.Framework.Assert.IsTrue(s.Equals("{\"x\":null,\"y\":null,\"z\":null,\"m\":null,\"spatialReference\":{\"wkid\":102100,\"latestWkid\":3857}}"));
            }
            {
                com.epl.geometry.Point p = new com.epl.geometry.Point(10.0, 20.0, 30.0);
                p.AddAttribute(com.epl.geometry.VertexDescription.Semantics.M);
                string s = com.epl.geometry.GeometryEngine.GeometryToJson(spatialReferenceWebMerc1, p);
                NUnit.Framework.Assert.IsTrue(s.Equals("{\"x\":10,\"y\":20,\"z\":30,\"m\":null,\"spatialReference\":{\"wkid\":102100,\"latestWkid\":3857}}"));
            }
            {
                // import
                string s = "{\"x\":0.0,\"y\":1.0,\"z\":5.0,\"m\":11.0,\"spatialReference\":{\"wkid\":102100,\"latestWkid\":3857}}";
                com.fasterxml.jackson.core.JsonParser parser = factory.CreateParser(s);
                com.epl.geometry.MapGeometry          map_pt = com.epl.geometry.GeometryEngine.JsonToGeometry(parser);
                com.epl.geometry.Point pt = (com.epl.geometry.Point)map_pt.GetGeometry();
                NUnit.Framework.Assert.IsTrue(pt.GetX() == 0.0);
                NUnit.Framework.Assert.IsTrue(pt.GetY() == 1.0);
                NUnit.Framework.Assert.IsTrue(pt.GetZ() == 5.0);
                NUnit.Framework.Assert.IsTrue(pt.GetM() == 11.0);
            }
            {
                string s = "{\"x\" : 5.0, \"y\" : null, \"spatialReference\" : {\"wkid\" : 4326}} ";
                com.fasterxml.jackson.core.JsonParser parser = factory.CreateParser(s);
                com.epl.geometry.MapGeometry          map_pt = com.epl.geometry.GeometryEngine.JsonToGeometry(parser);
                com.epl.geometry.Point pt = (com.epl.geometry.Point)map_pt.GetGeometry();
                NUnit.Framework.Assert.IsTrue(pt.IsEmpty());
                com.epl.geometry.SpatialReference spatial_reference = map_pt.GetSpatialReference();
                NUnit.Framework.Assert.IsTrue(spatial_reference.GetID() == 4326);
            }
            return(bAnswer);
        }
示例#18
0
        public virtual void TestSpatialRef()
        {
            // String jsonStringPt =
            // "{\"x\":-20037508.342787,\"y\":20037508.342787},\"spatialReference\":{\"wkid\":102100}}";
            string jsonStringPt = "{\"x\":10.0,\"y\":20.0,\"spatialReference\":{\"wkid\": 102100}}";
            // 102100
            string jsonStringPt2 = "{\"x\":10.0,\"y\":20.0,\"spatialReference\":{\"wkid\":4326}}";
            string jsonStringMpt = "{ \"points\" : [ [-97.06138,32.837], [-97.06133,32.836], [-97.06124,32.834], [-97.06127,32.832] ], \"spatialReference\" : {\"wkid\" : 4326}}";
            // 4326
            string jsonStringMpt3D = "{\"hasZs\" : true,\"points\" : [ [-97.06138,32.837,35.0], [-97.06133,32.836,35.1], [-97.06124,32.834,35.2], [-97.06127,32.832,35.3] ],\"spatialReference\" : {\"wkid\" : 4326}}";
            string jsonStringPl    = "{\"paths\" : [  [ [-97.06138,32.837], [-97.06133,32.836], [-97.06124,32.834], [-97.06127,32.832] ],  [ [-97.06326,32.759], [-97.06298,32.755] ]],\"spatialReference\" : {\"wkid\" : 4326}}";
            string jsonStringPl3D  = "{\"hasMs\" : true,\"paths\" : [[ [-97.06138,32.837,5], [-97.06133,32.836,6], [-97.06124,32.834,7], [-97.06127,32.832,8] ],[ [-97.06326,32.759], [-97.06298,32.755] ]],\"spatialReference\" : {\"wkid\" : 4326}}";
            string jsonStringPg    = "{ \"rings\" :[  [ [-97.06138,32.837], [-97.06133,32.836], [-97.06124,32.834], [-97.06127,32.832], [-97.06138,32.837] ],  [ [-97.06326,32.759], [-97.06298,32.755], [-97.06153,32.749], [-97.06326,32.759] ]], \"spatialReference\" : {\"wkt\" : \"\"}}";
            string jsonStringPg3D  = "{\"hasZs\" : true,\"hasMs\" : true,\"rings\" : [ [ [-97.06138, 32.837, 35.1, 4], [-97.06133, 32.836, 35.2, 4.1], [-97.06124, 32.834, 35.3, 4.2], [-97.06127, 32.832, 35.2, 44.3], [-97.06138, 32.837, 35.1, 4] ],[ [-97.06326, 32.759, 35.4], [-97.06298, 32.755, 35.5], [-97.06153, 32.749, 35.6], [-97.06326, 32.759, 35.4] ]],\"spatialReference\" : {\"wkid\" : 4326}}";
            string jsonStringPg2   = "{ \"spatialReference\" : {\"wkid\" : 4326}, \"rings\" : [[[-118.35,32.81],[-118.42,32.806],[-118.511,32.892],[-118.35,32.81]]]}";
            string jsonStringPg3   = "{ \"spatialReference\": {\"layerName\":\"GAS_POINTS\",\"name\":null,\"sdesrid\":102100,\"wkid\":102100,\"wkt\":null}}";
            string jsonString2SpatialReferences  = "{ \"spatialReference\": {\"layerName\":\"GAS_POINTS\",\"name\":null,\"sdesrid\":102100,\"wkid\":102100,\"wkt\":\"GEOGCS[\\\"GCS_WGS_1984\\\",DATUM[\\\"D_WGS_1984\\\",SPHEROID[\\\"WGS_1984\\\",6378137,298.257223563]],PRIMEM[\\\"Greenwich\\\",0],UNIT[\\\"Degree\\\",0.017453292519943295]]\"}}";
            string jsonString2SpatialReferences2 = "{ \"spatialReference\": {\"layerName\":\"GAS_POINTS\",\"name\":null,\"sdesrid\":10,\"wkid\":10,\"wkt\":\"GEOGCS[\\\"GCS_WGS_1984\\\",DATUM[\\\"D_WGS_1984\\\",SPHEROID[\\\"WGS_1984\\\",6378137,298.257223563]],PRIMEM[\\\"Greenwich\\\",0],UNIT[\\\"Degree\\\",0.017453292519943295]]\"}}";
            string jsonStringSR          = "{\"wkid\" : 4326}";
            string jsonStringEnv         = "{\"xmin\" : -109.55, \"ymin\" : 25.76, \"xmax\" : -86.39, \"ymax\" : 49.94,\"spatialReference\" : {\"wkid\" : 4326}}";
            string jsonStringHongKon     = "{\"xmin\" : -122.55, \"ymin\" : 37.65, \"xmax\" : -122.28, \"ymax\" : 37.84,\"spatialReference\" : {\"wkid\" : 4326}}";
            string jsonStringWKT         = " {\"wkt\" : \"GEOGCS[\\\"GCS_WGS_1984\\\",DATUM[\\\"D_WGS_1984\\\",SPHEROID[\\\"WGS_1984\\\",6378137,298.257223563]],PRIMEM[\\\"Greenwich\\\",0],UNIT[\\\"Degree\\\",0.017453292519943295]]\"}";
            string jsonStringInvalidWKID = "{\"x\":10.0,\"y\":20.0},\"spatialReference\":{\"wkid\":35253523}}";
            string jsonStringOregon      = "{\"xmin\":7531831.219849482,\"ymin\":585702.9799639136,\"xmax\":7750143.589982405,\"ymax\":733289.6299999952,\"spatialReference\":{\"wkid\":102726}}";

            com.fasterxml.jackson.core.JsonParser jsonParserPt          = factory.CreateJsonParser(jsonStringPt);
            com.fasterxml.jackson.core.JsonParser jsonParserMpt         = factory.CreateJsonParser(jsonStringMpt);
            com.fasterxml.jackson.core.JsonParser jsonParserMpt3D       = factory.CreateJsonParser(jsonStringMpt3D);
            com.fasterxml.jackson.core.JsonParser jsonParserPl          = factory.CreateJsonParser(jsonStringPl);
            com.fasterxml.jackson.core.JsonParser jsonParserPl3D        = factory.CreateJsonParser(jsonStringPl3D);
            com.fasterxml.jackson.core.JsonParser jsonParserPg          = factory.CreateJsonParser(jsonStringPg);
            com.fasterxml.jackson.core.JsonParser jsonParserPg3D        = factory.CreateJsonParser(jsonStringPg3D);
            com.fasterxml.jackson.core.JsonParser jsonParserPg2         = factory.CreateJsonParser(jsonStringPg2);
            com.fasterxml.jackson.core.JsonParser jsonParserSR          = factory.CreateJsonParser(jsonStringSR);
            com.fasterxml.jackson.core.JsonParser jsonParserEnv         = factory.CreateJsonParser(jsonStringEnv);
            com.fasterxml.jackson.core.JsonParser jsonParserPg3         = factory.CreateJsonParser(jsonStringPg3);
            com.fasterxml.jackson.core.JsonParser jsonParserCrazy1      = factory.CreateJsonParser(jsonString2SpatialReferences);
            com.fasterxml.jackson.core.JsonParser jsonParserCrazy2      = factory.CreateJsonParser(jsonString2SpatialReferences2);
            com.fasterxml.jackson.core.JsonParser jsonParserInvalidWKID = factory.CreateJsonParser(jsonStringInvalidWKID);
            com.fasterxml.jackson.core.JsonParser jsonParseHongKon      = factory.CreateJsonParser(jsonStringHongKon);
            com.fasterxml.jackson.core.JsonParser jsonParseOregon       = factory.CreateJsonParser(jsonStringOregon);
            com.epl.geometry.MapGeometry          mapGeom = com.epl.geometry.GeometryEngine.JsonToGeometry(jsonParserPt);
            // showProjectedGeometryInfo(mapGeom);
            NUnit.Framework.Assert.IsTrue(mapGeom.GetSpatialReference().GetID() == 102100);
            com.epl.geometry.MapGeometry mapGeomOregon = com.epl.geometry.GeometryEngine.JsonToGeometry(jsonParseOregon);
            NUnit.Framework.Assert.IsTrue(mapGeomOregon.GetSpatialReference().GetID() == 102726);
            mapGeom = com.epl.geometry.GeometryEngine.JsonToGeometry(jsonParserMpt);
            NUnit.Framework.Assert.IsTrue(mapGeom.GetSpatialReference().GetID() == 4326);
            mapGeom = com.epl.geometry.GeometryEngine.JsonToGeometry(jsonParserMpt3D);
            NUnit.Framework.Assert.IsTrue(mapGeom.GetSpatialReference().GetID() == 4326);
            {
                NUnit.Framework.Assert.IsTrue(((com.epl.geometry.MultiPoint)mapGeom.GetGeometry()).GetPoint(0).GetX() == -97.06138);
                NUnit.Framework.Assert.IsTrue(((com.epl.geometry.MultiPoint)mapGeom.GetGeometry()).GetPoint(0).GetY() == 32.837);
                NUnit.Framework.Assert.IsTrue(((com.epl.geometry.MultiPoint)mapGeom.GetGeometry()).GetPoint(3).GetX() == -97.06127);
                NUnit.Framework.Assert.IsTrue(((com.epl.geometry.MultiPoint)mapGeom.GetGeometry()).GetPoint(3).GetY() == 32.832);
            }
            // showProjectedGeometryInfo(mapGeom);
            mapGeom = com.epl.geometry.GeometryEngine.JsonToGeometry(jsonParserPl);
            NUnit.Framework.Assert.IsTrue(mapGeom.GetSpatialReference().GetID() == 4326);
            // showProjectedGeometryInfo(mapGeom);
            mapGeom = com.epl.geometry.GeometryEngine.JsonToGeometry(jsonParserPl3D);
            {
                // [[ [-97.06138,32.837,5], [-97.06133,32.836,6],
                // [-97.06124,32.834,7], [-97.06127,32.832,8] ],
                // [ [-97.06326,32.759], [-97.06298,32.755] ]]";
                NUnit.Framework.Assert.IsTrue(((com.epl.geometry.Polyline)mapGeom.GetGeometry()).GetPoint(0).GetX() == -97.06138);
                NUnit.Framework.Assert.IsTrue(((com.epl.geometry.Polyline)mapGeom.GetGeometry()).GetPoint(0).GetY() == 32.837);
                int lastIndex = ((com.epl.geometry.Polyline)mapGeom.GetGeometry()).GetPointCount() - 1;
                NUnit.Framework.Assert.IsTrue(((com.epl.geometry.Polyline)mapGeom.GetGeometry()).GetPoint(lastIndex).GetX() == -97.06298);
                // -97.06153,
                // 32.749
                NUnit.Framework.Assert.IsTrue(((com.epl.geometry.Polyline)mapGeom.GetGeometry()).GetPoint(lastIndex).GetY() == 32.755);
                int lastIndexFirstLine = ((com.epl.geometry.Polyline)mapGeom.GetGeometry()).GetPathEnd(0) - 1;
                NUnit.Framework.Assert.IsTrue(((com.epl.geometry.Polyline)mapGeom.GetGeometry()).GetPoint(lastIndexFirstLine).GetX() == -97.06127);
                // -97.06153,
                // 32.749
                NUnit.Framework.Assert.IsTrue(((com.epl.geometry.Polyline)mapGeom.GetGeometry()).GetPoint(lastIndexFirstLine).GetY() == 32.832);
            }
            mapGeom = com.epl.geometry.GeometryEngine.JsonToGeometry(jsonParserPg);
            NUnit.Framework.Assert.IsTrue(mapGeom.GetSpatialReference() == null);
            mapGeom = com.epl.geometry.GeometryEngine.JsonToGeometry(jsonParserPg3D);
            {
                NUnit.Framework.Assert.IsTrue(((com.epl.geometry.Polygon)mapGeom.GetGeometry()).GetPoint(0).GetX() == -97.06138);
                NUnit.Framework.Assert.IsTrue(((com.epl.geometry.Polygon)mapGeom.GetGeometry()).GetPoint(0).GetY() == 32.837);
                int lastIndex = ((com.epl.geometry.Polygon)mapGeom.GetGeometry()).GetPointCount() - 1;
                NUnit.Framework.Assert.IsTrue(((com.epl.geometry.Polygon)mapGeom.GetGeometry()).GetPoint(lastIndex).GetX() == -97.06153);
                // -97.06153,
                // 32.749
                NUnit.Framework.Assert.IsTrue(((com.epl.geometry.Polygon)mapGeom.GetGeometry()).GetPoint(lastIndex).GetY() == 32.749);
            }
            mapGeom = com.epl.geometry.GeometryEngine.JsonToGeometry(jsonParserPg2);
            NUnit.Framework.Assert.IsTrue(mapGeom.GetSpatialReference().GetID() == 4326);
            // showProjectedGeometryInfo(mapGeom);
            mapGeom = com.epl.geometry.GeometryEngine.JsonToGeometry(jsonParserPg3);
            NUnit.Framework.Assert.IsTrue(mapGeom.GetSpatialReference().GetID() == 102100);
            // showProjectedGeometryInfo(mapGeom);
            // mapGeom = GeometryEngine.jsonToGeometry(jsonParserCrazy1);
            // Assert.assertTrue(mapGeom.getSpatialReference().getText().equals(""));
            // showProjectedGeometryInfo(mapGeom);
            mapGeom = com.epl.geometry.GeometryEngine.JsonToGeometry(jsonParserEnv);
            NUnit.Framework.Assert.IsTrue(mapGeom.GetSpatialReference().GetID() == 4326);
            // showProjectedGeometryInfo(mapGeom);
            try
            {
                com.epl.geometry.GeometryEngine.JsonToGeometry(jsonParserInvalidWKID);
            }
            catch (System.Exception)
            {
                NUnit.Framework.Assert.IsTrue("Should not throw for invalid wkid", false);
            }
        }
        /// <exception cref="com.fasterxml.jackson.core.JsonParseException"/>
        /// <exception cref="System.IO.IOException"/>
        internal virtual bool TestEnvelope()
        {
            bool bAnswer = true;

            com.epl.geometry.Envelope envelope = new com.epl.geometry.Envelope();
            envelope.SetCoords(-109.55, 25.76, -86.39, 49.94);
            {
                com.fasterxml.jackson.core.JsonParser envelopeWGS84Parser = factory.CreateParser(com.epl.geometry.GeometryEngine.GeometryToJson(spatialReferenceWGS84, envelope));
                com.epl.geometry.MapGeometry          envelopeWGS84MP     = com.epl.geometry.GeometryEngine.JsonToGeometry(envelopeWGS84Parser);
                NUnit.Framework.Assert.IsTrue(envelope.IsEmpty() == envelopeWGS84MP.GetGeometry().IsEmpty());
                NUnit.Framework.Assert.IsTrue(envelope.GetXMax() == ((com.epl.geometry.Envelope)envelopeWGS84MP.GetGeometry()).GetXMax());
                NUnit.Framework.Assert.IsTrue(envelope.GetYMax() == ((com.epl.geometry.Envelope)envelopeWGS84MP.GetGeometry()).GetYMax());
                NUnit.Framework.Assert.IsTrue(envelope.GetXMin() == ((com.epl.geometry.Envelope)envelopeWGS84MP.GetGeometry()).GetXMin());
                NUnit.Framework.Assert.IsTrue(envelope.GetYMin() == ((com.epl.geometry.Envelope)envelopeWGS84MP.GetGeometry()).GetYMin());
                NUnit.Framework.Assert.IsTrue(spatialReferenceWGS84.GetID() == envelopeWGS84MP.GetSpatialReference().GetID());
                if (!CheckResultSpatialRef(envelopeWGS84MP, 4326, 0))
                {
                    bAnswer = false;
                }
            }
            {
                // export
                com.epl.geometry.Envelope e = new com.epl.geometry.Envelope();
                e.AddAttribute(com.epl.geometry.VertexDescription.Semantics.Z);
                e.AddAttribute(com.epl.geometry.VertexDescription.Semantics.M);
                string s = com.epl.geometry.GeometryEngine.GeometryToJson(spatialReferenceWebMerc1, e);
                NUnit.Framework.Assert.IsTrue(s.Equals("{\"xmin\":null,\"ymin\":null,\"xmax\":null,\"ymax\":null,\"zmin\":null,\"zmax\":null,\"mmin\":null,\"mmax\":null,\"spatialReference\":{\"wkid\":102100,\"latestWkid\":3857}}"));
                e.SetCoords(0, 1, 2, 3);
                com.epl.geometry.Envelope1D z = new com.epl.geometry.Envelope1D();
                com.epl.geometry.Envelope1D m = new com.epl.geometry.Envelope1D();
                z.SetCoords(5, 7);
                m.SetCoords(11, 13);
                e.SetInterval(com.epl.geometry.VertexDescription.Semantics.Z, 0, z);
                e.SetInterval(com.epl.geometry.VertexDescription.Semantics.M, 0, m);
                s = com.epl.geometry.GeometryEngine.GeometryToJson(spatialReferenceWebMerc1, e);
                NUnit.Framework.Assert.IsTrue(s.Equals("{\"xmin\":0,\"ymin\":1,\"xmax\":2,\"ymax\":3,\"zmin\":5,\"zmax\":7,\"mmin\":11,\"mmax\":13,\"spatialReference\":{\"wkid\":102100,\"latestWkid\":3857}}"));
            }
            {
                // import
                string s = "{\"xmin\":0.0,\"ymin\":1.0,\"xmax\":2.0,\"ymax\":3.0,\"zmin\":5.0,\"zmax\":7.0,\"mmin\":11.0,\"mmax\":13.0,\"spatialReference\":{\"wkid\":102100,\"latestWkid\":3857}}";
                com.fasterxml.jackson.core.JsonParser parser  = factory.CreateParser(s);
                com.epl.geometry.MapGeometry          map_env = com.epl.geometry.GeometryEngine.JsonToGeometry(parser);
                com.epl.geometry.Envelope             env     = (com.epl.geometry.Envelope)map_env.GetGeometry();
                com.epl.geometry.Envelope1D           z       = env.QueryInterval(com.epl.geometry.VertexDescription.Semantics.Z, 0);
                com.epl.geometry.Envelope1D           m       = env.QueryInterval(com.epl.geometry.VertexDescription.Semantics.M, 0);
                NUnit.Framework.Assert.IsTrue(z.vmin == 5.0);
                NUnit.Framework.Assert.IsTrue(z.vmax == 7.0);
                NUnit.Framework.Assert.IsTrue(m.vmin == 11.0);
                NUnit.Framework.Assert.IsTrue(m.vmax == 13.0);
            }
            {
                string s = "{ \"zmin\" : 33, \"xmin\" : -109.55, \"zmax\" : 53, \"ymin\" : 25.76, \"xmax\" : -86.39, \"ymax\" : 49.94, \"mmax\" : 13}";
                com.fasterxml.jackson.core.JsonParser parser  = factory.CreateParser(s);
                com.epl.geometry.MapGeometry          map_env = com.epl.geometry.GeometryEngine.JsonToGeometry(parser);
                com.epl.geometry.Envelope             env     = (com.epl.geometry.Envelope)map_env.GetGeometry();
                com.epl.geometry.Envelope2D           e       = new com.epl.geometry.Envelope2D();
                env.QueryEnvelope2D(e);
                NUnit.Framework.Assert.IsTrue(e.xmin == -109.55 && e.ymin == 25.76 && e.xmax == -86.39 && e.ymax == 49.94);
                com.epl.geometry.Envelope1D e1D;
                NUnit.Framework.Assert.IsTrue(env.HasAttribute(com.epl.geometry.VertexDescription.Semantics.Z));
                e1D = env.QueryInterval(com.epl.geometry.VertexDescription.Semantics.Z, 0);
                NUnit.Framework.Assert.IsTrue(e1D.vmin == 33 && e1D.vmax == 53);
                NUnit.Framework.Assert.IsTrue(!env.HasAttribute(com.epl.geometry.VertexDescription.Semantics.M));
            }
            return(bAnswer);
        }
        /// <exception cref="com.fasterxml.jackson.core.JsonParseException"/>
        /// <exception cref="System.IO.IOException"/>
        internal virtual bool TestPolygon()
        {
            bool bAnswer = true;

            com.epl.geometry.Polygon polygon = new com.epl.geometry.Polygon();
            polygon.StartPath(-97.06138, 32.837);
            polygon.LineTo(-97.06133, 32.836);
            polygon.LineTo(-97.06124, 32.834);
            polygon.LineTo(-97.06127, 32.832);
            polygon.StartPath(-97.06326, 32.759);
            polygon.LineTo(-97.06298, 32.755);
            {
                com.fasterxml.jackson.core.JsonParser polygonPathsWgs84Parser = factory.CreateParser(com.epl.geometry.GeometryEngine.GeometryToJson(spatialReferenceWGS84, polygon));
                com.epl.geometry.MapGeometry          mPolygonWGS84MP         = com.epl.geometry.GeometryEngine.JsonToGeometry(polygonPathsWgs84Parser);
                NUnit.Framework.Assert.IsTrue(polygon.GetPointCount() + 1 == ((com.epl.geometry.Polygon)mPolygonWGS84MP.GetGeometry()).GetPointCount());
                NUnit.Framework.Assert.IsTrue(polygon.GetPoint(0).GetX() == ((com.epl.geometry.Polygon)mPolygonWGS84MP.GetGeometry()).GetPoint(0).GetX());
                NUnit.Framework.Assert.IsTrue(polygon.GetPoint(0).GetY() == ((com.epl.geometry.Polygon)mPolygonWGS84MP.GetGeometry()).GetPoint(0).GetY());
                NUnit.Framework.Assert.IsTrue(polygon.GetPathCount() == ((com.epl.geometry.Polygon)mPolygonWGS84MP.GetGeometry()).GetPathCount());
                NUnit.Framework.Assert.IsTrue(polygon.GetSegmentCount() + 1 == ((com.epl.geometry.Polygon)mPolygonWGS84MP.GetGeometry()).GetSegmentCount());
                NUnit.Framework.Assert.IsTrue(polygon.GetSegmentCount(0) == ((com.epl.geometry.Polygon)mPolygonWGS84MP.GetGeometry()).GetSegmentCount(0));
                NUnit.Framework.Assert.IsTrue(polygon.GetSegmentCount(1) + 1 == ((com.epl.geometry.Polygon)mPolygonWGS84MP.GetGeometry()).GetSegmentCount(1));
                int lastIndex = polygon.GetPointCount() - 1;
                NUnit.Framework.Assert.IsTrue(polygon.GetPoint(lastIndex).GetX() == ((com.epl.geometry.Polygon)mPolygonWGS84MP.GetGeometry()).GetPoint(lastIndex).GetX());
                NUnit.Framework.Assert.IsTrue(polygon.GetPoint(lastIndex).GetY() == ((com.epl.geometry.Polygon)mPolygonWGS84MP.GetGeometry()).GetPoint(lastIndex).GetY());
                NUnit.Framework.Assert.IsTrue(spatialReferenceWGS84.GetID() == mPolygonWGS84MP.GetSpatialReference().GetID());
                if (!CheckResultSpatialRef(mPolygonWGS84MP, 4326, 0))
                {
                    bAnswer = false;
                }
            }
            {
                com.epl.geometry.Polygon p = new com.epl.geometry.Polygon();
                p.AddAttribute(com.epl.geometry.VertexDescription.Semantics.Z);
                p.AddAttribute(com.epl.geometry.VertexDescription.Semantics.M);
                string s = com.epl.geometry.GeometryEngine.GeometryToJson(spatialReferenceWebMerc1, p);
                NUnit.Framework.Assert.IsTrue(s.Equals("{\"hasZ\":true,\"hasM\":true,\"rings\":[],\"spatialReference\":{\"wkid\":102100,\"latestWkid\":3857}}"));
                p.StartPath(0, 0);
                p.LineTo(0, 1);
                p.LineTo(4, 4);
                p.StartPath(2, 2);
                p.LineTo(3, 3);
                p.LineTo(7, 8);
                p.SetAttribute(com.epl.geometry.VertexDescription.Semantics.Z, 0, 0, 3);
                p.SetAttribute(com.epl.geometry.VertexDescription.Semantics.M, 1, 0, 7);
                p.SetAttribute(com.epl.geometry.VertexDescription.Semantics.M, 2, 0, 5);
                p.SetAttribute(com.epl.geometry.VertexDescription.Semantics.M, 5, 0, 5);
                s = com.epl.geometry.GeometryEngine.GeometryToJson(spatialReferenceWebMerc1, p);
                NUnit.Framework.Assert.IsTrue(s.Equals("{\"hasZ\":true,\"hasM\":true,\"rings\":[[[0,0,3,null],[0,1,0,7],[4,4,0,5],[0,0,3,null]],[[2,2,0,null],[3,3,0,null],[7,8,0,5],[2,2,0,null]]],\"spatialReference\":{\"wkid\":102100,\"latestWkid\":3857}}"));
            }
            {
                // Test Import Polygon from Polygon
                string rings = "{\"hasZ\": true, \"rings\" : [ [ [0,0, 5], [0.0, 10.0, 5], [10.0,10.0, 5, 66666], [10.0,0.0, 5] ], [ [12, 12] ],  [ [13 , 17], [13 , 17] ], [ [1.0, 1.0, 5, 66666], [9.0,1.0, 5], [9.0,9.0, 5], [1.0,9.0, 5], [1.0, 1.0, 5] ] ] }";
                com.epl.geometry.MapGeometry mapGeometry = com.epl.geometry.GeometryEngine.JsonToGeometry(factory.CreateParser(rings));
                com.epl.geometry.Polygon     p           = (com.epl.geometry.Polygon)mapGeometry.GetGeometry();
                double area   = p.CalculateArea2D();
                double length = p.CalculateLength2D();
                NUnit.Framework.Assert.IsTrue(p.GetPathCount() == 4);
                int count = p.GetPointCount();
                NUnit.Framework.Assert.IsTrue(count == 15);
                NUnit.Framework.Assert.IsTrue(p.HasAttribute(com.epl.geometry.VertexDescription.Semantics.Z));
                NUnit.Framework.Assert.IsTrue(!p.HasAttribute(com.epl.geometry.VertexDescription.Semantics.M));
            }
            return(bAnswer);
        }
        /// <exception cref="com.fasterxml.jackson.core.JsonParseException"/>
        /// <exception cref="System.IO.IOException"/>
        internal virtual bool TestPolyline()
        {
            bool bAnswer = true;

            com.epl.geometry.Polyline polyline = new com.epl.geometry.Polyline();
            polyline.StartPath(-97.06138, 32.837);
            polyline.LineTo(-97.06133, 32.836);
            polyline.LineTo(-97.06124, 32.834);
            polyline.LineTo(-97.06127, 32.832);
            polyline.StartPath(-97.06326, 32.759);
            polyline.LineTo(-97.06298, 32.755);
            {
                com.fasterxml.jackson.core.JsonParser polylinePathsWgs84Parser = factory.CreateParser(com.epl.geometry.GeometryEngine.GeometryToJson(spatialReferenceWGS84, polyline));
                com.epl.geometry.MapGeometry          mPolylineWGS84MP         = com.epl.geometry.GeometryEngine.JsonToGeometry(polylinePathsWgs84Parser);
                NUnit.Framework.Assert.IsTrue(polyline.GetPointCount() == ((com.epl.geometry.Polyline)mPolylineWGS84MP.GetGeometry()).GetPointCount());
                NUnit.Framework.Assert.IsTrue(polyline.GetPoint(0).GetX() == ((com.epl.geometry.Polyline)mPolylineWGS84MP.GetGeometry()).GetPoint(0).GetX());
                NUnit.Framework.Assert.IsTrue(polyline.GetPoint(0).GetY() == ((com.epl.geometry.Polyline)mPolylineWGS84MP.GetGeometry()).GetPoint(0).GetY());
                NUnit.Framework.Assert.IsTrue(polyline.GetPathCount() == ((com.epl.geometry.Polyline)mPolylineWGS84MP.GetGeometry()).GetPathCount());
                NUnit.Framework.Assert.IsTrue(polyline.GetSegmentCount() == ((com.epl.geometry.Polyline)mPolylineWGS84MP.GetGeometry()).GetSegmentCount());
                NUnit.Framework.Assert.IsTrue(polyline.GetSegmentCount(0) == ((com.epl.geometry.Polyline)mPolylineWGS84MP.GetGeometry()).GetSegmentCount(0));
                NUnit.Framework.Assert.IsTrue(polyline.GetSegmentCount(1) == ((com.epl.geometry.Polyline)mPolylineWGS84MP.GetGeometry()).GetSegmentCount(1));
                int lastIndex = polyline.GetPointCount() - 1;
                NUnit.Framework.Assert.IsTrue(polyline.GetPoint(lastIndex).GetX() == ((com.epl.geometry.Polyline)mPolylineWGS84MP.GetGeometry()).GetPoint(lastIndex).GetX());
                NUnit.Framework.Assert.IsTrue(polyline.GetPoint(lastIndex).GetY() == ((com.epl.geometry.Polyline)mPolylineWGS84MP.GetGeometry()).GetPoint(lastIndex).GetY());
                NUnit.Framework.Assert.IsTrue(spatialReferenceWGS84.GetID() == mPolylineWGS84MP.GetSpatialReference().GetID());
                if (!CheckResultSpatialRef(mPolylineWGS84MP, 4326, 0))
                {
                    bAnswer = false;
                }
            }
            {
                com.epl.geometry.Polyline p = new com.epl.geometry.Polyline();
                p.AddAttribute(com.epl.geometry.VertexDescription.Semantics.Z);
                p.AddAttribute(com.epl.geometry.VertexDescription.Semantics.M);
                string s = com.epl.geometry.GeometryEngine.GeometryToJson(spatialReferenceWebMerc1, p);
                NUnit.Framework.Assert.IsTrue(s.Equals("{\"hasZ\":true,\"hasM\":true,\"paths\":[],\"spatialReference\":{\"wkid\":102100,\"latestWkid\":3857}}"));
                p.StartPath(0, 0);
                p.LineTo(0, 1);
                p.StartPath(2, 2);
                p.LineTo(3, 3);
                p.SetAttribute(com.epl.geometry.VertexDescription.Semantics.Z, 0, 0, 3);
                p.SetAttribute(com.epl.geometry.VertexDescription.Semantics.M, 1, 0, 5);
                s = com.epl.geometry.GeometryEngine.GeometryToJson(spatialReferenceWebMerc1, p);
                NUnit.Framework.Assert.IsTrue(s.Equals("{\"hasZ\":true,\"hasM\":true,\"paths\":[[[0,0,3,null],[0,1,0,5]],[[2,2,0,null],[3,3,0,null]]],\"spatialReference\":{\"wkid\":102100,\"latestWkid\":3857}}"));
            }
            {
                string paths = "{\"hasZ\" : true, \"paths\" : [ [ [0.0, 0.0,3], [0, 10.0,3], [10.0, 10.0,3, 6666], [10.0, 0.0,3, 6666] ], [ [1.0, 1,3], [1.0, 9.0,3], [9.0, 9.0,3], [1.0, 9.0,3] ] ], \"spatialReference\" : {\"wkid\" : 4326}, \"hasM\" : false}";
                com.epl.geometry.MapGeometry mapGeometry = com.epl.geometry.GeometryEngine.JsonToGeometry(factory.CreateParser(paths));
                com.epl.geometry.Polyline    p           = (com.epl.geometry.Polyline)mapGeometry.GetGeometry();
                NUnit.Framework.Assert.IsTrue(p.GetPathCount() == 2);
                int count = p.GetPathCount();
                NUnit.Framework.Assert.IsTrue(p.GetPointCount() == 8);
                NUnit.Framework.Assert.IsTrue(p.HasAttribute(com.epl.geometry.VertexDescription.Semantics.Z));
                NUnit.Framework.Assert.IsTrue(!p.HasAttribute(com.epl.geometry.VertexDescription.Semantics.M));
                double z = p.GetAttributeAsDbl(com.epl.geometry.VertexDescription.Semantics.Z, 0, 0);
                NUnit.Framework.Assert.IsTrue(z == 3);
                double length = p.CalculateLength2D();
                NUnit.Framework.Assert.IsTrue(System.Math.Abs(length - 54.0) <= 0.001);
                com.epl.geometry.SpatialReference spatial_reference = mapGeometry.GetSpatialReference();
                NUnit.Framework.Assert.IsTrue(spatial_reference.GetID() == 4326);
            }
            return(bAnswer);
        }
示例#22
0
 private static void ShowProjectedGeometryInfo(com.epl.geometry.MapGeometry mapGeom)
 {
     System.Console.Out.WriteLine("\n");
     com.epl.geometry.MapGeometry geom = mapGeom;
     // while ((geom = geomCursor.next()) != null) {
     if (geom.GetGeometry() is com.epl.geometry.Point)
     {
         com.epl.geometry.Point pnt = (com.epl.geometry.Point)geom.GetGeometry();
         System.Console.Out.WriteLine("Point(" + pnt.GetX() + " , " + pnt.GetY() + ")");
         if (geom.GetSpatialReference() == null)
         {
             System.Console.Out.WriteLine("No spatial reference");
         }
         else
         {
             System.Console.Out.WriteLine("wkid: " + geom.GetSpatialReference().GetID());
         }
     }
     else
     {
         if (geom.GetGeometry() is com.epl.geometry.MultiPoint)
         {
             com.epl.geometry.MultiPoint mp = (com.epl.geometry.MultiPoint)geom.GetGeometry();
             System.Console.Out.WriteLine("Multipoint has " + mp.GetPointCount() + " points.");
             System.Console.Out.WriteLine("wkid: " + geom.GetSpatialReference().GetID());
         }
         else
         {
             if (geom.GetGeometry() is com.epl.geometry.Polygon)
             {
                 com.epl.geometry.Polygon mp = (com.epl.geometry.Polygon)geom.GetGeometry();
                 System.Console.Out.WriteLine("Polygon has " + mp.GetPointCount() + " points and " + mp.GetPathCount() + " parts.");
                 if (mp.GetPathCount() > 1)
                 {
                     System.Console.Out.WriteLine("Part start of 2nd segment : " + mp.GetPathStart(1));
                     System.Console.Out.WriteLine("Part end of 2nd segment   : " + mp.GetPathEnd(1));
                     System.Console.Out.WriteLine("Part size of 2nd segment  : " + mp.GetPathSize(1));
                     int start = mp.GetPathStart(1);
                     int end   = mp.GetPathEnd(1);
                     for (int i = start; i < end; i++)
                     {
                         com.epl.geometry.Point pp = mp.GetPoint(i);
                         System.Console.Out.WriteLine("Point(" + i + ") = (" + pp.GetX() + ", " + pp.GetY() + ")");
                     }
                 }
                 System.Console.Out.WriteLine("wkid: " + geom.GetSpatialReference().GetID());
             }
             else
             {
                 if (geom.GetGeometry() is com.epl.geometry.Polyline)
                 {
                     com.epl.geometry.Polyline mp = (com.epl.geometry.Polyline)geom.GetGeometry();
                     System.Console.Out.WriteLine("Polyline has " + mp.GetPointCount() + " points and " + mp.GetPathCount() + " parts.");
                     System.Console.Out.WriteLine("Part start of 2nd segment : " + mp.GetPathStart(1));
                     System.Console.Out.WriteLine("Part end of 2nd segment   : " + mp.GetPathEnd(1));
                     System.Console.Out.WriteLine("Part size of 2nd segment  : " + mp.GetPathSize(1));
                     int start = mp.GetPathStart(1);
                     int end   = mp.GetPathEnd(1);
                     for (int i = start; i < end; i++)
                     {
                         com.epl.geometry.Point pp = mp.GetPoint(i);
                         System.Console.Out.WriteLine("Point(" + i + ") = (" + pp.GetX() + ", " + pp.GetY() + ")");
                     }
                     System.Console.Out.WriteLine("wkid: " + geom.GetSpatialReference().GetID());
                 }
             }
         }
     }
 }