Impossible to display maps : 0x0 / invisible

I'm trying to display a map on a personal project to train myself on C# ASP.net MVC.

I tried to use ejs-maps tag from Syncfusion.EJ2 :

@using Syncfusion.EJ2
<ejs-maps id="maps">
<e-maps-layers>
     <e-maps-layer layerType="OSM" load="window.onMapLoad" urlTemplate="https://tile.openstreetmap.org/3/4/2.png">
        </e-maps-layer>
</e-maps-layers>
</ejs-maps>


It didn't work so I tried to use Blazor Maps :

@using Syncfusion.Blazor.Maps
<SfMaps>
<MapsLayers>
     <MapsLayer UrlTemplate="https://tile.openstreetmap.org/3/4/2.png" TValue="string></MapsLayer>
    </MapsLayers>
</SfMaps>

However, the result is the same... No map.

It is present in the inspector but the size is 0x0. I tried to change it but it was already empty and invisible...



Finally, I tried to follow the tutorial : https://ej2.syncfusion.com/aspnetmvc/documentation/maps/getting-started/

and I had :

@Html.EJS().Maps("container").Layers(layer => { layer.ShapeData(ViewBag.shapeData).Add(); }).Render();


Here, my problem was this error, which I couldn't understand because I have all needed packages :

Error CS1061 'IHtmlHelper<VisitInventory>' does not contain a definition for 'EJS' and no accessible extension method 'EJS' accepting a first argument of type 'IHtmlHelper<VisitInventory>' could be found (are you missing a using directive or an assembly reference?) VisitListMVC {Path}



If anyone has an idea to help me. I'm pretty sure that the problem is linked to packages or local server, but I'm not sure and I drained all my ideas...


Thanks.


5 Replies 1 reply marked as answer

IR Indumathi Ravi Syncfusion Team February 9, 2022 07:28 PM UTC

Hi Champion, 
Thank you for contacting Syncfusion Support. 
Please find the details for your queries from the below table. 
Queries 
Details 
It didn't work so I tried to use Blazor Maps : 
@using Syncfusion.Blazor.Maps 
<SfMaps> 
    <MapsLayers> 
        <MapsLayer UrlTemplate="https://tile.openstreetmap.org/3/4/2.png" TValue="string"></MapsLayer> 
    </MapsLayers> 
</SfMaps> 
However, the result is the same... No map. 
It is present in the inspector but the size is 0x0. I tried to change it but it was already empty and invisible... 
We are unable to reproduce the reported issue in the Blazor Maps component when rendering OpenStreetMap. The control is rendering properly with the appropriate size. 
In the provided code snippet, the URL of the OpenStreetMap provided in the "UrlTemplate" property is not proper. Please find the UG documentation link to know more about the OpenStreeMap rendering in Blazor Maps below. 
If you are still facing the reported issue, please provide a sample or videos to replicate the issue. It will be helpful for us to analyze and assist you further. 
and I had : 
Here, my problem was this error, which I couldn't understand because I have all needed packages : 
Error CS1061 'IHtmlHelper<VisitInventory>' does not contain a definition for 'EJS' and no accessible extension method 'EJS' accepting a first argument of type 'IHtmlHelper<VisitInventory>' could be found (are you missing a using directive or an assembly reference?) VisitListMVC {Path} 
We are unable to reproduce the reported issue while creating a ASP.NET MVC application with the ASP.NET MVC Maps component using the getting started UG document. We suspect that the configurations mentioned in the UG document are missing, or that additional configurations (via template) have been added to your newly created application. Hence you are facing the reported issue. The ASP.NET MVC Maps is also rendering with proper size when we tested in our ASP.NET MVC application. 
We have created a simple sample for your reference and it can be download from the below link. 
If you are still facing the reported issue, please provide a sample or videos to replicate the issue. It will be helpful for us to analyze and assist you further. 
 
Please let us know if you need further assistance. 
Regards, 
Indumathi R. 



CH CHAMPION February 11, 2022 01:09 PM UTC

Thanks for your reply.


I don't understand my problem if you can't reproduced it !


I try your sample and it was correct.

The only thing I can noticed is that I used C# 9.0 and you used C# 7.3 isn't it ?


Here is my repository GitLab if it can help you to understand my problem : 

https://gitlab.com/MelvinC/visitlistmvc


Regards, 

CHAMPION Melvin.



IR Indumathi Ravi Syncfusion Team February 14, 2022 12:11 PM UTC

Hi Champion, 

Thank you for the update. 

When we analyzed the provided sample application, we came to know that you have referred both “Syncfusion.EJ2.AspNet.Core” and “Syncfusion.EJ2.MVC5” packages in your application. Since you are working in an ASP.NET Core MVC application, “Syncfusion.EJ2.AspNet.Core” package must only be referred in it. Please remove the “Syncfusion.EJ2.MVC5” package to resolve the reported issue. Please find the screen shot below for your reference. 

 

We have modified the provided sample to demonstrate the same and it can be downloaded from the below link. 
 
Note: We have modified the “urlTemplate” property in the above application as we updated in our response posted on February 10, 2022. 

Please let us know if you need any further assistance. 

Regards, 
Indumathi R

Marked as answer

CH CHAMPION February 15, 2022 05:48 PM UTC

Hi R. Indumathi,

Thanks for your answer, which is so helpful. I did the changes and it's running !


Thanks for your time and your serious investment.


Regards,

CHAMPION Melvin.



IR Indumathi Ravi Syncfusion Team February 16, 2022 05:15 AM UTC

Hi Champion, 
  
Thank you for the update. 
  
Please let us know if you need any further assistance. 
  
Regards, 
Indumathi R. 


Loader.
Up arrow icon