Esempio n. 1
0
        public void VectorTile_ToJSON()
        {
            VectorTile v = new VectorTile(9, 112, 195);

            byte[] bytes = File.ReadAllBytes(@".\data\9.112.195.pbf");
            v.SetData(bytes);
            IEnumerable <VectorTileLayer> vtJSON = v.ToJSON();
            string json = JsonConvert.SerializeObject(
                vtJSON,
                new JsonSerializerSettings {
                NullValueHandling = NullValueHandling.Ignore
            });
            string expected = @"[{""Features"":[{""Properties"":{""AREA"":915896,""FIPS"":""US"",""ISO2"":""US"",""ISO3"":""USA"",""LAT"":39.622,""LON"":-98.606,""NAME"":""United States"",""POP2005"":299846449,""REGION"":19,""SUBREGION"":21,""UN"":840},""Geometry"":[9,8192,0,58,0,0,0,8192,0,8191,0,8192,0,0,8191,0,0,8191,15],""Type"":3,""Id"":207}],""Version"":1,""Extent"":4096,""Name"":""world""}]";

            Assert.AreEqual(expected, json);
        }
Esempio n. 2
0
 public void VectorTile_ToJSON()
 {
     VectorTile v = new VectorTile(9, 112, 195);
     byte[] bytes = File.ReadAllBytes(@".\data\9.112.195.pbf");
     v.SetData(bytes);
     IEnumerable<VectorTileLayer> vtJSON = v.ToJSON();
     string json = JsonConvert.SerializeObject(
         vtJSON,
         new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
     string expected = @"[{""Features"":[{""Properties"":{""AREA"":915896,""FIPS"":""US"",""ISO2"":""US"",""ISO3"":""USA"",""LAT"":39.622,""LON"":-98.606,""NAME"":""United States"",""POP2005"":299846449,""REGION"":19,""SUBREGION"":21,""UN"":840},""Geometry"":[9,8192,0,58,0,0,0,8192,0,8191,0,8192,0,0,8191,0,0,8191,15],""Type"":3,""Id"":207}],""Version"":1,""Extent"":4096,""Name"":""world""}]";
     Assert.AreEqual(expected, json);
 }