Provides geocoding, travel-time matrices, routing, and service territories for Orchard Core via the CrestApps Geo module. Covers IGeoService, IGeocodeQueue, ITerritoryResolver, and Leaflet map integration.
Ships in crestapps-orchardcore. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
You are an Orchard Core expert. Generate accurate setup, recipes and extension code for the CrestApps Geo module, which gives every module a shared way to work with places: points, geocoding in the background with retries, travel times with a built-in estimate, service territories, and a Leaflet map component. It references no vertical module.
CrestApps.OrchardCore.Geo and any provider package (CrestApps.OrchardCore.Geo.AzureMaps, CrestApps.OrchardCore.Geo.GoogleMaps, CrestApps.OrchardCore.Geo.Osrm) in the web/startup project. The CrestApps.OrchardCore.Cms.Core.Targets bundle includes all four.CrestApps.OrchardCore.Geo.Abstractions (GeoPoint, providers, IGeoService, ITerritoryResolver, IGeocodeQueue, IGeocodeTarget, ITerritoryMemberSource); services in CrestApps.OrchardCore.Geo.Core (DefaultGeoService, HaversineTravelTimeProvider, GeoMath, GeoShape, TerritoryMatcher, PolylineEncoding).IGeoService, never a provider directly: it picks the providers named in the settings, caches travel times, and falls back to the built-in estimate.IGeocodeQueue.EnqueueAsync and write results back in an IGeocodeTarget; don't geocode inline on save.orchardcore-addresses; Dispatch uses travel times and territories (see orchardcore-dispatch).{ "steps": [...] }.sealed modifier, except View Models.| Feature | ID | Depends on |
|---|---|---|
| Geo, Maps and Territories | CrestApps.OrchardCore.Geo | CrestApps.OrchardCore.Resources |
| Azure Maps | CrestApps.OrchardCore.Geo.AzureMaps | CrestApps.OrchardCore.Geo |
| Google Maps | CrestApps.OrchardCore.Geo.GoogleMaps | CrestApps.OrchardCore.Geo |
| OSRM | CrestApps.OrchardCore.Geo.Osrm | CrestApps.OrchardCore.Geo |
{
"steps": [
{
"name": "Feature",
"enable": [
"CrestApps.OrchardCore.Geo",
"CrestApps.OrchardCore.Geo.AzureMaps"
],
"disable": []
}
]
}
GeoPoint is a WGS84 readonly record struct GeoPoint(double Latitude, double Longitude) with IsValid and GeoPoint.From(double? latitude, double? longitude) (returns null for missing or invalid values).
| Contract | Members |
|---|---|
IGeocodingProvider | Name, DisplayName, GeocodeAsync(GeocodeQuery), ReverseGeocodeAsync(GeoPoint) returning GeocodeCandidates (Point, Confidence, FormattedAddress, PostalCode, Country) |
ITravelTimeProvider | Name, DisplayName, GetMatrixAsync(origins, destinations, departureUtc, TravelOptions) returning a TravelMatrix of TravelLeg(Duration, DistanceMeters); MaxCacheDuration (default null) |
IRouteProvider | Name, DisplayName, GetRouteAsync(points) returning a GeoRoute (Line, DistanceMeters, Duration, Instructions) |
IGeoService | GeocodeAsync, ReverseGeocodeAsync, GetMatrixAsync, GetRouteAsync |
IGeoService behavior:
GeocodeResponse with no provider when none is set up.MatrixCacheMinutes, capped by the provider's MaxCacheDuration, and fall back to the haversine estimate when the provider is missing or fails.HaversineTravelTimeProvider (name Haversine) is always registered: great-circle distance (GeoMath.DistanceMeters) times RoadFactor (1.3) at AverageSpeedKmh (40) or TravelOptions.SpeedKmh (such as a territory's TravelSpeedKmh).public sealed class DepotDistanceService
{
private readonly IGeoService _geoService;
public DepotDistanceService(IGeoService geoService)
{
_geoService = geoService;
}
public async Task<TimeSpan> DriveTimeAsync(GeoPoint depot, GeoPoint customer, CancellationToken cancellationToken)
{
var matrix = await _geoService.GetMatrixAsync([depot], [customer], DateTime.UtcNow, new TravelOptions { SpeedKmh = 35 }, cancellationToken);
return matrix[0, 0].Duration;
}
}
Each provider adds its section to Settings > Maps and Geocoding and is then chosen there by name. A provider throws GeoProviderException when it has no key or address, its key is refused, or it finds no route; IGeoService then falls back, and the geocoding queue retries. Each HTTP client uses the standard resilience handler.
| Provider name | Settings | Geocoding | Travel times | Routes |
|---|---|---|---|---|
AzureMaps (Azure Maps) | AzureMapsSettings.Key (sent as subscription-key) | Search and reverse geocoding | Route matrix with traffic | Route directions with instructions |
GoogleMaps (Google Maps) | GoogleMapsSettings.Key | Geocoding API | Distance Matrix with traffic; MaxCacheDuration is zero, so never cached (Google's terms) | Directions API, polyline decoded by PolylineEncoding |
Osrm (OSRM) | OsrmSettings.BaseUrl, Profile (driving); no key | none | Table service | Route service with step sentences |
Choosing a geocoding provider wakes requests that waited for one (IGeocodeQueue.WakeAsync).
Settings > Maps and Geocoding (site settings group geo, GeoSettings, permission ManageGeoSettings): GeocodingProvider, TravelTimeProvider, RouteProvider, AverageSpeedKmh (40), RoadFactor (1.3), MatrixCacheMinutes (60), TileUrl, TileAttribution, DefaultLatitude, DefaultLongitude, DefaultZoom. The page also shows how many addresses are waiting, geocoded and not found, and the latest problem.
{
"steps": [
{
"name": "Settings",
"GeoSettings": {
"GeocodingProvider": "AzureMaps",
"TravelTimeProvider": "AzureMaps",
"RouteProvider": "AzureMaps",
"AverageSpeedKmh": 40,
"RoadFactor": 1.3,
"MatrixCacheMinutes": 60,
"TileUrl": "https://tiles.example.com/{z}/{x}/{y}.png",
"TileAttribution": "© Example Tiles",
"DefaultLatitude": 42.36,
"DefaultLongitude": -71.06,
"DefaultZoom": 10
}
}
]
}
ServiceTerritory (in the Geo collection): Name, ParentId, Shape (GeoJSON Polygon or MultiPolygon as a geometry, Feature or FeatureCollection), PostalCodes (a trailing * matches a prefix), TimeZoneId, TravelSpeedKmh, Members (Kind, Id, Role Primary or Secondary). The handler tidies postal codes, checks the shape parses (GeoShape.TryParse), and refuses a territory inside itself.
ITerritoryResolver.ResolveAsync(GeoPoint? point, string postalCode) (and the pure TerritoryMatcher.Match) returns the territory with the smallest shape containing the point, else the one with the postal code (exact before the longest prefix), as a TerritoryMatch(Territory, MatchedBy) where MatchedBy is Shape or PostalCode.
Territory members are listed through every ITerritoryMemberSource (Kind, DisplayName, ListAsync() of (Id, Name)); Dispatch adds Worker (Technicians: active staff members with a dispatch capability, see orchardcore-staff) and Team (Teams, whose members serve the territory). Members of a kind no source lists any more are kept.
IGeocodeQueue.EnqueueAsync(targetType, targetId, GeocodeQuery) keeps one GeocodeRequest per record, replacing an earlier one. The Geocode addresses background task runs every minute (ProcessDueAsync):
IGeocodeTarget whose TargetType matches, with the provider name as source.Built-in targets: Work Orders service addresses (WorkOrderServiceAddress), Workforce team locations (WorkforceTeamLocation) and Staff home bases (StaffHomeBase; requests queued before Staff under WorkforceWorkerHomeBase are still applied to the staff member). Dispatch starts a technician's route from the staff member's geocoded HomeBase, else their team's location. A full custom target is in references/geo-extensions.md.
Address (Addresses module) has optional Latitude, Longitude, GeocodedUtc and GeocodeSource (a provider name, or Manual when pinned), copied by Clone.
CrestApps Resources defines the scripts and styles leaflet (1.9.4), leaflet-markercluster (with style leaflet-markercluster-default), leaflet-geoman (2.20.4), and the crestapps-map script. The Geo module's _GeoMap partial (model GeoSettings, ViewData MapId, MapHeight, MapLabel) renders a map element with the site's tiles and the scripts.
const map = window.crestappsMap.create('my-map'); // reads data-tile-url, data-attribution, data-latitude, data-longitude, data-zoom
window.crestappsMap.showShapes(map, [{ label: 'Boston', geoJson: shapeJson }]);
window.crestappsMap.addMarkers(map, [{ latitude: 42.36, longitude: -71.06, label: 'Depot' }], { fit: true });
window.crestappsMap.pin(map, latitudeInput, longitudeInput); // a draggable pin that writes two inputs
window.crestappsMap.editShapes(map, textarea); // Geoman drawing kept as a GeoJSON FeatureCollection
| Menu | Route | Permission |
|---|---|---|
| Field Service > Territories | geo/territories, geo/territories/edit/{id?} | ManageGeoTerritories |
| Settings > Maps and Geocoding | site settings group geo | ManageGeoSettings |
| Permission | Display name | Default role |
|---|---|---|
ManageGeoTerritories | Manage service territories | Administrator |
ManageGeoSettings | Manage maps and geocoding settings | Administrator |
The Geo step (needs OrchardCore.Recipes.Core) creates or updates Territories by ItemId, parents first, with the editor's checks.
{
"steps": [
{
"name": "Geo",
"Territories": [
{ "ItemId": "4fs7kjkcahkr0q5vh31ktg943y", "Name": "Boston", "PostalCodes": [ "021*" ], "TimeZoneId": "America/New_York", "TravelSpeedKmh": 35 },
{
"ItemId": "4f0n4hbx15vatb9tg9ykcbsym1",
"Name": "Cambridge",
"ParentId": "4fs7kjkcahkr0q5vh31ktg943y",
"PostalCodes": [ "02138", "02139" ],
"TimeZoneId": "America/New_York",
"Shape": "{\"type\":\"Polygon\",\"coordinates\":[[[-71.16,42.35],[-71.06,42.35],[-71.06,42.40],[-71.16,42.40],[-71.16,42.35]]]}"
}
]
}
]
}
Shape is a string holding GeoJSON (longitude before latitude).GeoDeploymentStep, exported parents first) and Maps and geocoding settings (exports GeoSettings through the Settings step; provider keys stay on each site).| Symptom | Check |
|---|---|
| Travel times look like straight lines | No travel-time provider chosen, or it failed and the haversine fallback answered. Check the provider key and the logs. |
| Google travel times are slow or costly | Expected: they are never cached. Use Azure Maps or OSRM for heavy optimizer use. |
| Addresses never get coordinates | Choose a geocoding provider; requests wait without one. OSRM can't geocode. |
| Territory not found for a point | The shape must be valid GeoJSON with longitude first; otherwise the postal code is used. |
| Map tiles refused | Tiles are requested with the site's origin as referrer; use a tile service whose policy allows your site. |
The CrestApps.OrchardCore.Geo meter counts crestapps.geo.provider.fallbacks (failed travel-time and route calls answered with the built-in estimate; tags provider, operation matrix/route), crestapps.geo.matrix.cache.lookups (tags provider, result hit/miss) and crestapps.geo.geocode.requests (tag result: done, no_match, gone, no_target, no_provider, retry, failed). A rising fallback count means the provider key or quota needs attention. See orchardcore-opentelemetry.
Related skills: orchardcore-addresses, orchardcore-dispatch, orchardcore-work-orders, orchardcore-assets, orchardcore-staff, orchardcore-workforce, orchardcore-crestapps-resources.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
orchard-core, geocoding, travel-time, service-territory, leaflet
/crestapps-orchardcore:orchardcore-geofrom crestapps-orchardcore
npx claudepluginhub crestapps/crestapps.agentskills --plugin crestapps-orchardcore137 skills in this plugin
/orchardcore-accountsSkill for the CrestApps Orchard Core Accounts module (CrestApps.OrchardCore.Accounts) with its Account Members, Account Team, Account E-mail Domains and Account Locations features. Covers the Account type and AccountPart, the account picker and search, IAccountChildTypeRule, account page sections (AccountPageTabs, AddPageSection, Notes), members and IAccountMemberService, account invitations, the account owner and team picked from staff, e-mail domains, locations with a billing location, the account's billing profile and party members, the Accounts recipe and deployment steps, and the admin menu. Use this skill when requests mention accounts, the businesses or households records belong to, an account page tab, members, invitations, owners, domains or locations. Strong matches include AccountPart, AccountPageTabs, IAccountMemberService, IAccountInvitationService, AccountInvitation, AccountTeamPart, AccountEmailDomainsPart, IAccountEmailDomains, AccountLocationsPart and ManageAccountMembers./orchardcore-accounts-b2bSkill for the CrestApps Orchard Core Accounts B2B module (CrestApps.OrchardCore.Accounts.B2B), business selling on an Account content item. Covers B2BAccountPart and B2BAccount, buyers as account members and ship-to addresses as account locations, terms (deposit, net days, credit limit) through the account-terms tender billed to the account, the account's billing profile, purchase order numbers, quotes, price lists through IBuyerPriceProvider, order limits, approvals and budgets, OCI punchout, the account/business page and API, the PriceLists recipe and deployment steps, the B2BAccounts report source, and the move from the removed Companies module. Use this skill when requests mention B2B, wholesale or business buyers, net terms, purchase orders, price lists, order approvals or punchout. Strong matches include B2BAccountPart, B2BAccount, AccountTerms, AccountTermsTenderProvider, B2BAccountBillingProfileSource, IB2BAccountStore, PriceList, B2BPriceProvider, B2BApprovalService and ManageB2BAccounts.Other plugins' skills for the same job