![]() |
VOOZH | about |
dotnet add package MeshWeaver.GoogleMaps --version 2.5.0
NuGet\Install-Package MeshWeaver.GoogleMaps -Version 2.5.0
<PackageReference Include="MeshWeaver.GoogleMaps" Version="2.5.0" />
<PackageVersion Include="MeshWeaver.GoogleMaps" Version="2.5.0" />Directory.Packages.props
<PackageReference Include="MeshWeaver.GoogleMaps" />Project file
paket add MeshWeaver.GoogleMaps --version 2.5.0
#r "nuget: MeshWeaver.GoogleMaps, 2.5.0"
#:package MeshWeaver.GoogleMaps@2.5.0
#addin nuget:?package=MeshWeaver.GoogleMaps&version=2.5.0Install as a Cake Addin
#tool nuget:?package=MeshWeaver.GoogleMaps&version=2.5.0Install as a Cake Tool
This library provides Google Maps integration for MeshWeaver applications, offering framework-agnostic map controls with Blazor Server rendering capabilities.
Core library containing the framework-agnostic Google Maps controls and data models.
Blazor Server implementation providing the rendering layer for Google Maps integration.
Add Google Maps to your MeshWeaver hub configuration:
public static MessageHubConfiguration ConfigureHub(this MessageHubConfiguration config)
{
return config.AddGoogleMaps();
}
Configure your Google Maps API key:
services.Configure<GoogleMapsConfiguration>(options =>
{
options.ApiKey = "your-google-maps-api-key";
options.Libraries = "places,visualization,drawing,marker"; // Optional
options.Language = "en"; // Optional
options.Region = "US"; // Optional
});
public static UiControl CreateMap() =>
new GoogleMapControl
{
Options = new MapOptions
{
Center = new LatLng(37.7749, -122.4194), // San Francisco
Zoom = 12,
MapTypeId = "roadmap"
},
Markers = new[]
{
new MapMarker
{
Position = new LatLng(37.7749, -122.4194),
Title = "San Francisco",
Label = "SF",
Id = "sf-marker"
}
},
Circles = new[]
{
new MapCircle
{
Center = new LatLng(37.7749, -122.4194),
Radius = 5000, // 5km radius
FillColor = "#FF0000",
FillOpacity = 0.35,
Id = "sf-circle"
}
}
}.WithStyle("height: 400px; width: 100%;");
Main control for rendering Google Maps.
Properties:
Options: Map configuration optionsMarkers: Collection of map markersCircles: Collection of map circlesConfiguration options for the map display.
Properties:
Center: Map center coordinates (LatLng)Zoom: Zoom level (default: 15)MapTypeId: Map type - "roadmap", "satellite", "hybrid", "terrain" (default: "roadmap")DisableDefaultUI: Hide all default UI controls (default: false)ZoomControl: Show zoom controls (default: true)MapTypeControl: Show map type selector (default: true)ScaleControl: Show scale control (default: false)StreetViewControl: Show street view control (default: true)RotateControl: Show rotation control (default: false)FullscreenControl: Show fullscreen control (default: false)Represents a clickable point on the map.
Properties:
Position: Marker coordinates (LatLng)Title: Hover tooltip textLabel: Single character marker labelDraggable: Allow marker dragging (default: false)Icon: Custom marker icon URLId: Unique identifier for click eventsData: Additional data payloadRepresents a circular overlay on the map.
Properties:
Center: Circle center coordinates (LatLng)Radius: Circle radius in meters (default: 1000)FillColor: Interior fill color (default: "#FF0000")FillOpacity: Interior fill opacity (default: 0.35)StrokeColor: Border color (default: "#FF0000")StrokeOpacity: Border opacity (default: 0.8)StrokeWeight: Border width in pixels (default: 2)Id: Unique identifier for click eventsData: Additional data payloadRepresents geographical coordinates.
Constructor:
LatLng(double Lat, double Lng)The GoogleMapView automatically handles marker and circle clicks, posting ClickedEvent messages through MeshWeaver's message hub:
public class MyHandler
{
public IMessageDelivery HandleMapClick(MessageHub hub, IMessageDelivery<ClickedEvent> delivery)
{
var clickedId = delivery.Message.Payload; // Marker or circle ID
// Handle the click event
return delivery.Processed();
}
}
Register the handler in your hub configuration:
config.AddHandler<ClickedEvent>(HandleMapClick)
Configuration options for the Google Maps API integration.
Properties:
ApiKey: Your Google Maps JavaScript API key (required)Libraries: Comma-separated list of additional libraries to load (optional)Language: Language for map labels and controls (optional)Region: Localization region (optional)public static class MyLayoutAreas
{
public static void AddMapAreas(this LayoutConfiguration config)
{
config.AddLayoutArea("LocationMap", LocationMap);
}
public static UiControl LocationMap(LayoutAreaHost host, RenderingContext ctx)
{
var locations = GetLocations(); // Your data source
return new GoogleMapControl
{
Options = new MapOptions
{
Center = new LatLng(locations.First().Latitude, locations.First().Longitude),
Zoom = 10
},
Markers = locations.Select(loc => new MapMarker
{
Position = new LatLng(loc.Latitude, loc.Longitude),
Title = loc.Name,
Id = loc.Id.ToString()
}).ToArray()
}.WithStyle("height: 500px;");
}
}
The map container automatically adapts to its parent's dimensions. Use CSS styling through the WithStyle() method:
var map = new GoogleMapControl { /* options */ }
.WithStyle("height: 400px; width: 100%; border: 1px solid #ccc;");
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 net9.0 is compatible. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 1 NuGet packages that depend on MeshWeaver.GoogleMaps:
| Package | Downloads |
|---|---|
|
MeshWeaver.Blazor.GoogleMaps
Package Description |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.0.0-preview1 | 132 | 4/16/2026 |
| 2.5.0 | 228 | 11/3/2025 |
| 2.4.0 | 220 | 10/2/2025 |