ThinkGeo.com    |     Documentation    |     Premium Support

WMS render OSM *.shp files

Hi! 


I try to create simple WMS service with ThinkGEO WMS Server Suite. I have some *.shp files:



        
  • boundary-polygon.shp

  •     
  • building-point.shp

  •     
  • building-polygon.shp

  •     
  • highway-line.shp

  •     
  • landuse-polygon.shp

  •     
  • nature_reserve-polygon.shp

  •     
  • poi-point.shp

  •     
  • poi-polygon.shp

  •     
  • railway-line.shp

  •     
  • railway-station-point.shp

  •     
  • settlement-point.shp

  •     
  • settlement-polygon.shp

  •     
  • vegetation-polygon.shp

  •     
  • water-line.shp

  •     
  • water-polygon.shp


How to render(draw) this shape layers on WMS service using styles?


I try use default styles foreach layer,but it's so uglyness((( 


How to render more beautiful?


sample code(simple display map sample):


  DirectoryInfo dir = new DirectoryInfo(@"C:\Perm");





            

            //// Get the directory to the sample data

            //string worldLayerFilePath = Directory.GetParent(Directory.GetParent(AppDomain.CurrentDomain.BaseDirectory).FullName).FullName + Path.DirectorySeparatorChar + "SampleData" + Path.DirectorySeparatorChar + "Countries02.shp";



            //// Create the world layer from a shapefile and add a style to it

            //ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(worldLayerFilePath);

            //worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country1;

            //worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;



            //// Create a MapConfiguration and add the layer to it

            MapConfiguration mapConfiguration = new MapConfiguration();    

       



           // mapConfiguration.Layers.Add("WorldLayer", worldLayer);

            FileInfo[] files = dir.GetFiles("*.shp");



            foreach (FileInfo f in files)

            {

                string worldLayerFilePath = f.FullName.ToString();



                // Create the world layer from a shapefile and add a style to it

                ShapeFileFeatureSource.BuildIndexFile(worldLayerFilePath);

                ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(worldLayerFilePath);

                string name = f.Name.ToString();

                if (name == "water-polygon.shp")

                {

                    worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Water1;

                    worldLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.River1;

                    



                }

                if (name == "building-polygon.shp")

                {

                    worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Military1;

                   





                }

                if (name == "building-point.shp")

                {

                    worldLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.City7;







                }

                else

                {



                    worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.County1;

                   

                }

                worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

                // Create a MapConfiguration and add the layer to it



                mapConfiguration.Layers.Add(f.Name, worldLayer);

            }



            mapConfiguration = mapConfiguration;

            return mapConfiguration;



Hi Alexander,  
  
 Thanks for your question! It looks like you are on the right track for creating your own WMS service for the Open Street Map Data. The Map Suite API has all the tools you need to create maps that are pleasing to the eye, but you will simply need to experiment to setup what looks best to you.