-
Notifications
You must be signed in to change notification settings - Fork 14
Set Styling when creating a map in the view #7
Copy link
Copy link
Open
Description
I've used this code to generate a map in the view that I then populate with a bunch of icons/positions (as example 5 in the docs). It works good but I won't get any of the settings that I would like to have, which I've set on the data type in back office. Styling most of all as I use Hotel instead of the standard styling.
Can I achieve this somehow?
@Html.Terratype(new Options {
Provider = new Terratype.Providers.GoogleMapsV3(),
MapSetId = 2,
Zoom = 2,
Position = new Terratype.CoordinateSystems.Wgs84("15,0")
})
foreach (var partner in mapModel.Partners)
{
var name = partner.GetPropertyValue("partnerName");
var url = partner.GetPropertyValue("websiteURL").ToString();
var location = partner.GetPropertyValue<Terratype.Models.Model>("location");
@Html.Terratype(
new Options
{
MapSetId = 2
}, location,
@<text>
<h4>@name</h4>
@if (!string.IsNullOrEmpty(url))
{
<a href="@url" target="_blank">@url.Replace("http://", "").Replace("https://", "")</a>
}
</text>
)
}
I used this code before with a good result accept for when I later wanted to center the map, then the interactivity went crazy..
foreach (var partner in mapModel.Partners)
{
var name = partner.GetPropertyValue("partnerName");
var url = partner.GetPropertyValue("websiteURL").ToString();
var location = partner.GetPropertyValue<Terratype.Models.Model>("location");
@Html.Terratype(
new Options {
MapSetId = 2,
Zoom = 3
}, location,
@<text>
<h4>@name</h4>
@if (!string.IsNullOrEmpty(url))
{
<a href="@url" target="_blank">@url.Replace("http://","").Replace("https://","")</a>
}
</text>
)
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels