C# Windows Phone地图:来自GeoServer的图层

C# Windows Phone地图:来自GeoServer的图层,c#,windows-phone-8,maps,windows-phone-8.1,geoserver,C#,Windows Phone 8,Maps,Windows Phone 8.1,Geoserver,在Windows Phone上从GeoServer绘制地图图层的最简单方法是什么 从GeoServer的输出格式(GeoJSON、KML、GeoRSS、Shapefile、CSV…)中,您认为哪一种更容易操作并转换为Windows Phone的地图层元素,如多边形 关于这些主题,您推荐哪些API或教程?我选择了GeoJSON格式: string _buldingUrl = "http://localhost:8080/geoserver/Utad/ows?service=WFS&vers

在Windows Phone上从GeoServer绘制地图图层的最简单方法是什么

从GeoServer的输出格式(GeoJSON、KML、GeoRSS、Shapefile、CSV…)中,您认为哪一种更容易操作并转换为Windows Phone的地图层元素,如多边形


关于这些主题,您推荐哪些API或教程?

我选择了GeoJSON格式:

string _buldingUrl = "http://localhost:8080/geoserver/Utad/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=Utad:build&maxFeatures=50&outputFormat=application/json";
当我们将层选择为GeoJSON时,该字符串是标准输出。我们需要注意
&maxFeatures=50
参数,并将其设置为所需的值

然后我得到了处理Json结果的方法,并使用map控件作为参数

async public void DrawRoomsonMap(Map Mapa)
        {
           ... //Response Reading

            //used the: https://github.com/GeoJSON-Net/GeoJSON.Net
            var reader = new GeoJsonReader();

            //read the json map features to a list with the help of GeoJsnoReader
            var features2 = (Geo.IO.GeoJson.FeatureCollection)reader.Read(jsonText);
            var list = features2.Features.ToList();

            //clear map elements
            Mapa.MapElements.Clear();

            //my own implementation for getting elements with a specific property, in this case a lever of some value 
            foreach (var item in list.Where(x=> x.Properties["level"].ToString() == _currentLevel.ToString()))
            {
                //converted the geometry property of each item to a Wkt string, and extracted the polygons to and array
                var b = item.Geometry.ToWktString();
                b = b.Replace("MULTIPOLYGON", "").Replace("(((", "").Replace(")))", "").TrimStart(' ');
                var c = b.Split(',');

                //Created a MapPolygon object and GeoCoordinates collection
                MapPolygon polygon = new MapPolygon();
                GeoCoordinateCollection coordenadas = new GeoCoordinateCollection();

                //added the coordinates to the polygon
                foreach (var coor in c)
                {
                    var x = coor.TrimStart(' ');
                    var lat = x.Split(' ')[0].Replace(".",",");
                    var lon = x.Split(' ')[1].Replace(".", ",");

                    double latitude = double.Parse(lat);
                    double longitude = double.Parse(lon);

                    coordenadas.Add(new GeoCoordinate(longitude, latitude));
                }

                //polygon properties and added to the map control.
                polygon.Path = coordenadas;
                polygon.FillColor = fixColor(item.Properties["bpart"].ToString());
                polygon.StrokeColor = Colors.White;
                polygon.StrokeThickness = 3;                
                Mapa.MapElements.Add(polygon);
            }
        }

点和线的处理过程很容易从这里开始。

您是否找到了任何解决方案,希望与大家分享?谢谢,我稍后会发布详细信息。那将非常受欢迎。谢谢,我还没有注意到这里的c#标记,但这也很有用。非常感谢。