Its posible view floor plan drawings with maps control?

Hi

I need to show floor plan drawings in svg format, its posible get this work with maps control?

Thanks in advance!


5 Replies

IR Indumathi Ravi Syncfusion Team June 13, 2022 12:10 PM UTC

Hi Jose,


Thank you for contacting Syncfusion support.


We can render floor plans as custom shapes in the Maps component. To achieve this, a JSON file with GeoJSON format must be created. This file will contain your own coordinates with predefined shapes such as  “Polygon”, “MultiPolygon” and so on. Please find the basic structure of the GeoJSON format below.


{

  "type": "FeatureCollection",

  "features": [

 

    {

      "type": "Feature",

      "properties": {

        "Name": "Bureau_FT",

        "admin": "sbe",

        "stroke": "brown",

        "stroke-width": 2,

        "nameMemo": "Bureau_FT",

        "SpaceId": "20001"

      },

      "geometry": {

        "type": "Polygon",

        "coordinates": [

          [

            [ 19.283750364095, 23.8647877753913 ],

            [ 21.483750364095, 23.8647877753913 ],

           [ 21.483750364095, 22.8647877753913 ],

            [ 19.283750364095, 22.8647877753913 ]

          ]

        ]

      }

    },

]

}


Similar to the above structure, we must construct the map with your own data to render custom shapes in the Maps component. We have created a sample application to demonstrate the same and it can be downloaded from the below link.


https://www.syncfusion.com/downloads/support/directtrac/general/ze/BlazorApp2-681393255

Please let us know if you need any further assistance.


Regards,

Indumathi R.



JL jose luis barajas June 13, 2022 04:30 PM UTC

Hi  Indumathi 

Thanks for your great support

I just have many questions:

1) Its possible draw arcs, circles, curves?

2) Its possible fill a geometry/region, please check my attachments

3) Its possible draw text, please check my attachments


Thanks in advance!



Attachment: questions_703251d1.rar


IR Indumathi Ravi Syncfusion Team June 14, 2022 04:33 PM UTC

Hi Jose,


Thank you for the update.


Please find the details for your queries from the below table.

Queries

Details

Its possible draw arcs, circles, curves?

We can render arcs, circles and curves in the JSON file by creating coordinate points with pre-defined shapes like Polygon, Multipolygon, and so on in the GeoJSON data of the map.

Its possible fill a geometry/region, please check my attachments

We can fill colors to each shape using “ColorValuePath” property and data source of the layer. The “ShapeDataPath” and “ShapePropertyPath” properties are used to connect the data source with the shape data of the Maps. The “ShapeDataPath” takes the field name from the data source as value whereas “ShapePropertyPath” property takes the field name from the shape data of the map as value. When the values of both the properties match, we can apply colors based on color values by binding the field name to the “ColorValuePath” property in the “MapsShapeSettings”. Please find the code snippet for the same below.

 

Code Snippet:

<SfMaps Background="black" ID="Maps">

    <MapsLayers>

                    <MapsLayer LayerType="ShapeLayerType.Geometry" Visible="true" ShapeDataPath="@ShapeDataPath" 

        ShapePropertyPath="@ShapePropertyPath"

        DataSource="Labels" ShapeData='new {dataOptions= "svgmap.json"}' TValue="string">

         <MapsShapeSettings ValuePath="SpaceId" ColorValuePath="Color">

         </MapsShapeSettings>

        </MapsLayer>

    </MapsLayers>

</SfMaps>

Its possible draw text, please check my attachments

We can render text in the shape of the Maps by binding the field name from the data source to the “ValuePath” property in the “MapsDataLabelSettings”. Please find the code snippet for the same below.

 

Code Snippet:

@using Syncfusion.Blazor.Maps;

 

<SfMaps Background="black" ID="Maps">

    <MapsLayers>

            <MapsLayer LayerType="ShapeLayerType.Geometry" Visible="true" ShapeDataPath="@ShapeDataPath" ShapePropertyPath="@ShapePropertyPath"

        DataSource="Labels" ShapeData='new {dataOptions= "svgmap.json"}' TValue="string">

        //..

       //..

         <MapsDataLabelSettings Visible="true" LabelPath="Name"></MapsDataLabelSettings>

        </MapsLayer>

    </MapsLayers>

</SfMaps>

 

@code{

     public class LabelText

    {

        public string Name { get; set; }

        public string Color { get; set; }

    };

    public List<LabelText> Labels = new List<LabelText> {

        new LabelText {

            Name= "One", Color = "#fdad17"

        },

        //..

    };

    public string[] ShapePropertyPath = { "Name" };

    public string ShapeDataPath = "Name";

}

We have created a sample to demonstrate the same and it can be downloaded from the below link.

 

https://www.syncfusion.com/downloads/support/directtrac/general/ze/BlazorApp2-1275054229


Please let us know if the above solution meets your requirement


Regards,

Indumathi R.



JL jose luis barajas June 14, 2022 07:29 PM UTC

Hi  Indumathi 

Excellent example. 

Without abusing your great support, my floor maps are in svg, what starting point do you recommend to migrate from svg to the json format that the map library requires?


Thanks in advance!



IR Indumathi Ravi Syncfusion Team June 15, 2022 03:27 PM UTC

Hi Jose,


Thank you for the update.


We do not handle conversion of an SVG document to a JSON file with GeoJSON format. However, you can look for online vendors to convert the SVG to JSON file or manually create the JSON file.


Please let us know if you need any further assistance.


Regards,

Indumathi R.


Loader.
Up arrow icon