Where is MapData reference?

Trying to go through the examples for the map and I'm stuck.  https://help.syncfusion.com/aspnetmvc/maps/getting-started

In the instructions we have the code:

public object GetUSMap()
        {
            string data = System.IO.File.ReadAllText(Server.MapPath("~/App_Data/USA.json"));
            JavaScriptSerializer ser = new JavaScriptSerializer();
            ser.MaxJsonLength = int.MaxValue;
            return new MapData(data);
        }

in the controller.  But MapData comes up with a not found reference. I've searched through the Syncfusion DLLs in the Object Browser looking for that reference and I'm not finding it.  How can I resolve that missing reference?

Thanks

5 Replies

DD Dharanidharan Dharmasivam Syncfusion Team October 19, 2018 10:35 AM UTC

Hi Dirk, 
 
Greetings from Syncfusion, 
 
We have analyzed your query and we have prepared a sample with same code snippet and the sample is working fine at our end. The reported error may occur due to missing of namespace Syncfusion.JavaScript.DataVisualization.Maps  in the controller pager or dlls listed below might not be referred properly. So, kindly ensure the namespace and the dlls are referred properly. 
 
  • Syncfusion.Ej
  • Synfusion.EJ.MVC
 
For your reference, we have attached the sample with the same code snippet in the below location.  
 
Screenshot: 
 
 
If you still face any issues kindly revert us by modifying the attachment or provide your sample with replication steps. This will helpful in analyzing further and provide you the solution sooner. 
 
Thanks, 
Dharani. 
 



DK Dirk Kaiser October 20, 2018 07:34 AM UTC

Hi Dharani,

Thanks for the code snippet.  I now see what the issues are.  The tutorial and the snippet you sent me are using ASP.NET MVC EJ1 and I've been trying to use EJ2 which is what is causing all my namespace issues.

The mapping demos for EJ2 are pretty good and I can use those to build my application around.  However, what is missing from those demos are using a mapping provider like Bing and OpenStreetMap as the background and putting a GeoJSON on top of that.  Could you generate that type of demo?

Thanks, Dirk


DK Dirk Kaiser October 22, 2018 11:24 AM UTC

Thanks Dharani!  These are great.  Appreciate the quick response!

- Dirk


DK Dirk Kaiser October 22, 2018 11:26 AM UTC

BTW - you left your Bing API key in the example....might want to remove that.


DD Dharanidharan Dharmasivam Syncfusion Team October 22, 2018 12:54 PM UTC

Hi Dirk, 
 
Thanks for the information. 
 
Based on your requirement, we have prepared sample with bing map and open street map sample in EJ2 MVC platform. In that sample, we have added bing map and open street map as background and added the Geo JSON on the top the layer by using the sublayer type in the layers collection.  
Please find the below code snippet to achieve this requirement, 
 
OSM map: 
 
@Html.EJS().Maps("maps").Layers(m => 
{ 
    m.LayerType(ShapeLayerType.OSM).UrlTemplate("http://mt1.google.com/vt/lyrs=y&x=tileX&y=tileY&z=level").Add(); 
// Add sub layer to put the Geo Json on top the OSM maps    
    m.Type(Syncfusion.EJ2.Maps.Type.SubLayer). 
    ShapeSettings(ss => ss.Fill("transparent").Border(dr => dr.Color("white").Width(1))).ShapeData(ViewBag.worldMap).Add(); 
} 
).Render() 
 
 
Bing Map: 
 
@Html.EJS().Maps("maps") 
.Layers(m => 
{ 
    m.LayerType(ShapeLayerType.Bing) 
//add your bing map key 
.Key("").Add(); 
// Add sub layer to put the Geo Json on top the OSM maps 
    m.Type(Syncfusion.EJ2.Maps.Type.SubLayer). 
               ShapeSettings(ss => ss.Fill("transparent") 
               .Border(dr => dr.Color("white").Width(1))) 
               .ShapeData(ViewBag.worldMap).Add(); 
} 
).Render() 
 
 
 
Note: If you are using bing map add the key and for bing map key generation kindly follow the below link, 
 
 
Screenshot: 
 
OSM Map: 
 
 
Bing Map: 
 
 
Sample for your reference can be found from below link, 
 
And, also based on your requirement, we will add the demo for bing and open street map sample in our sample browser for Essential Studio Volume 4 release which is expected to be release in the middle of December 2018. 
 
Thanks, 
Dharani. 


Loader.
Up arrow icon