- Home
- Forum
- ASP.NET MVC
- Display Bing Map in the background of GeoJSON polygons
Display Bing Map in the background of GeoJSON polygons
I'm try to display Bing map in the background of the GeoJSON polygons, I managed to draw the polygons alone and also I managed to render Bing map alone, but when I try to combine them using sublayer property it's not work, below is my code.
| @(Html.EJ().Map("container") .Layers(lr => { lr.LayerType(Syncfusion.JavaScript.DataVisualization.Models.LayerType.Bing) .Key("mykey") .SubLayers(ssl => { ssl.ShapeData(mapData1) .ShapeSettings(ss => { ss.Fill("Blue") .StrokeThickness(0.5) .Stroke("Green"); }) .Add(); }) .Add(); }) |
|
Asp:
@(Html.EJ().Map("container")
.Layers(lr =>
{
lr.LayerType(LayerType.Bing).Key("AthrQ-lRLgDOIIN2rl6EaKZ5SIyvf1PvAidvJfIRjoVUVi9_XoVC9LYtWQOOJxP7")
.SubLayers(sl =>
{
sl.ShapeData(mapData)
.ShapeSettings(ss =>
{
ss.Fill("Blue")
.StrokeThickness(0.5)
.Stroke("Green");
}).Add();
}).Add();
})
)
|
Thanks for your kind help, it's highly appreciated, at my end I recompiled the project and run it it's working now, I thing it was may be internet connection problem because I was getting an error in the javascript debugger but now I'm not.
another thing is that can I zoom to window of selected shapes, also can I select shapes with code ??
many thanks for your kind support.
BR
|
ASP.NET MVC:
@(Html.EJ().Map("map")
//...
.ZoomSettings(zm =>
{
zm.EnableZoomOnSelection(true);
})
//...
// select shape using the navigateTo and selectShape methods
function buttonClick() {
var combo = $("#countriesCombo");
var index = combo[0].selectedIndex;
var lat = latLongPoints[index].latitude;
var lon = latLongPoints[index].longitude;
var level = 4;
$("#map").ejMap("navigateTo", lat, lon, level);
$("#map").ejMap("selectShape", latLongPoints[index].name, null, false);
}
|
I'm really thankful for your kind support, you are wonderful team, thanks again.
What if I need to add more than two layers, actually I want to add Bing map in the background and over that I want to add open street map, and finally I need to add my polugons.
Also can I create a layer and add shapes to this layer during the running ??
finally is there any documentation for your product because I did not found all methods of map control in the documentation page.
BR
Sorry I forget another point, that points and polygons are shifted, I think it's because of the projection, I have polygons like below.
| { "type": "FeatureCollection", "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } }, "features": [ { "type": "Feature", "properties": { "name": "cell1"}, "geometry": { "type": "Polygon", "coordinates": [ [ [ 44.37704086303711, 35.42696613377983 ], [ 44.37952995300293, 35.43074278209167 ], [ 44.38193321228027, 35.430043416136144 ], [ 44.38201904296875, 35.42780540426507 ], [ 44.37704086303711, 35.42696613377983 ] ] ] } }, { "type": "Feature", "properties": { "name": "cell2"}, "geometry": { "type": "Polygon", "coordinates": [ [ [ 44.37695503234863, 35.42703607332096 ], [ 44.381675720214844, 35.42549738938698 ], [ 44.3818473815918, 35.42360896438525 ], [ 44.379873275756836, 35.42311936549123 ], [ 44.37695503234863, 35.42703607332096 ] ] ] } } ] } |
thanks in advance.
HiAnas,
Thanks
for your update.
We
have analyzed query. We have prepared a sample with respect to your
requirement. In this we have added bing map to the background and then over
that OSM and over that your polygons. Kindly find the code snippet below,
|
[CS] @(Html.EJ().Map("container")
.Layers(lr =>
{
lr.LayerType(LayerType.Bing)
.ShapeData(worldData)
.SubLayers(sl =>
{
sl.LayerType(LayerType.OSM).Add();
sl.LayerType(LayerType.Geometry)
.ShapeData(polygon)
.ShapeSettings(ss =>
{
ss.Fill("Blue")
.StrokeThickness(5)
.Stroke("Green");
})
.Add();}).Add();
}) )} |
Screenshot:

For your reference we
have attached the sample. Find the sample from below link,
Sample
Location:http://www.syncfusion.com/downloads/support/forum/126236/ze/map_3layers-1792295616
As of now, we are facing
an issue while adding layers dynamically. So we have logged issue report for
this andfor better follow up, we
have created branch incidentunder
your account.
Please follow incident#165151for more details regarding
this.
Kindly
revert us if you have any concern.
Thanks,
Dharani.
Thanks for your kind support, but please refer to a documentation because the online documentation page does not offer full details about the map control.
now I'm facing another problem which I posted in new thread "Shape selection not working properly in Map Control", your kind support is highly appreciated.
BR
Thanks for your response, Actually I was looking for the methods (below) which I did not find in the ASP.NET MVC documentation and did not know it's there in the JS help page, thank you again.
|
[CSHTML]
@(Html.EJ().Map("container")
//. . . .
.Layers(lr =>
{
lr.SubLayers(sl =>
{
//. . . .
.ShapeSettings(ss =>
{
//Fill shape with opacity
ss.Fill("rgba(0, 0, 255, 0.4)")
//. . . .
}).Add();
//. . . .
}).Add();
//. . . .
})
)}
|
|
[CSHTML]
@(Html.EJ().Map("container")
.ClientSideEvents(events=>events.OnRenderComplete("renderComplete"))
. . . .
. . . .
)}
<script type="text/javascript">
var first = true;
function renderComplete(sender) {
//Zoom from the location corresponing to latitude and longitude co-ordinates 10 and -100
sender.model.centerPosition = [10, -100];
if (first) {
//Refresh the map
//container is the id used for creating the map in sample
$('#container').ejMap('refresh');
first = false;
}
}
</script> |
- 12 Replies
- 4 Participants
-
AA Anas Alwindawee
- Oct 3, 2016 01:29 PM UTC
- Apr 14, 2017 10:02 AM UTC