export const HONGYUAN_BOUNDS = { west: 101.852492, south: 31.851389, east: 103.347518, north: 33.319796, } export const HONGYUAN_COUNTY_CENTER = [102.600005, 32.585593] export const HONGYUAN_COUNTY_INITIAL_ZOOM = 9 export const HONGYUAN_COUNTY_TARGET_OFFSET = { lng: 0, lat: -0.045 } export const WMS_IMAGE_SIZE = { width: 2400, height: 2400, } export const SATELLITE_TEXTURE_ZOOM = 9 export const NATIONAL_PARK_ZONING_COLORS = { core: { fillColor: "#FFCB45", strokeColor: "#FFF4B8", }, general: { fillColor: "#35E8FF", strokeColor: "#C9FBFF", }, } function escapeCqlLiteral(value) { return String(value).replace(/'/g, "''") } function createEqualityCql(field, value) { return `${field} = '${escapeCqlLiteral(value)}'` } function createBasicGrasslandV21Sld() { return ` ne:resource_basic_grassland_parcel Screen V2.1 基本与一般草原 basic-grassland grassland_category_codeBASIC grassland_category_name基本草原 #35C98B0.58 #A7F3D00.780.65 general-grassland grassland_category_codeGENERAL grassland_category_name一般草原 #E7B9550.56 #FFE3A00.80.65 ` } const grasslandTypeLegends = [ { name: "低地草甸类", fillColor: "#DDE9A6", strokeColor: "#F1F7D0" }, { name: "莎草、杂类草型", fillColor: "#F67A7A", strokeColor: "#F67A7A" }, { name: "山地草甸类", fillColor: "#7ED0A5", strokeColor: "#B9F1D3" }, { name: "羊茅、杂类草型", fillColor: "#E69800", strokeColor: "#E69800" }, { name: "早熟禾、杂类草型", fillColor: "#FFD380", strokeColor: "#FFD380" }, { name: "垂穗披碱草型", fillColor: "#FFAA01", strokeColor: "#FFAA01" }, { name: "苔草、杂类草型", fillColor: "#FFEBB0", strokeColor: "#FFEBB0" }, { name: "委陵菜、杂类草型", fillColor: "#F5CA7B", strokeColor: "#F5CA7B" }, { name: "披碱草型", fillColor: "#A87001", strokeColor: "#A87001" }, { name: "高寒草甸类", fillColor: "#79A7E8", strokeColor: "#BBD3F6" }, { name: "矮生嵩草、杂类草型", fillColor: "#6CB3FF", strokeColor: "#6CB3FF" }, { name: "矮生嵩草、圆穗蓼型", fillColor: "#00C7FF", strokeColor: "#00C7FF" }, { name: "西藏嵩草、杂类草型", fillColor: "#8FE5FD", strokeColor: "#8FE5FD" }, { name: "西藏嵩草、甘肃嵩草型", fillColor: "#7B8FED", strokeColor: "#7B8FED" }, { name: "高山嵩草、矮生嵩草型", fillColor: "#71DDFE", strokeColor: "#71DDFE" }, { name: "高山嵩草、苔草型", fillColor: "#7BB5F3", strokeColor: "#7BB5F3" }, { name: "高山嵩草、杂类草型", fillColor: "#444E87", strokeColor: "#444E87" }, { name: "具灌木的矮生嵩草型", fillColor: "#6873D1", strokeColor: "#6873D1" }, ].map((item, index) => ({ ...item, key: `grassland-type-${index + 1}`, cqlFilter: createEqualityCql("grass_min_type", item.name), rankingPropertyName: ["area_code", "acreage"], rankingTownCodeKeys: ["area_code"], rankingAreaKeys: ["acreage"], })) const productivityLegends = [ { name: ">4000(kg/hm2)", fillColor: "#2F9D78", strokeColor: "#7DE0B9" }, { name: "3000-4000(kg/hm2)", fillColor: "#72B86A", strokeColor: "#A9DC91" }, { name: "2000-3000(kg/hm2)", fillColor: "#D9C55B", strokeColor: "#F1E38C" }, { name: "1500-2000(kg/hm2)", fillColor: "#E4934E", strokeColor: "#F5BD7C" }, { name: "<1500(kg/hm2)", fillColor: "#D65F5F", strokeColor: "#F09191" }, ].map((item) => ({ ...item, selectable: false })) const grasslandLevelText = { 1: "一级", 2: "二级", 3: "三级", 4: "四级", 5: "五级", 6: "六级", 7: "七级", 8: "八级", } const grasslandLevelLegends = [ { level: "1", name: "1级草原", fillColor: "#2E7D6A", strokeColor: "#75C5A9" }, { level: "2", name: "2级草原", fillColor: "#3AAE86", strokeColor: "#82D5B0" }, { level: "3", name: "3级草原", fillColor: "#68C79A", strokeColor: "#A6E2BF" }, { level: "4", name: "4级草原", fillColor: "#A6D96A", strokeColor: "#D0EB9E" }, { level: "5", name: "5级草原", fillColor: "#F0C95B", strokeColor: "#FFE598" }, { level: "6", name: "6级草原", fillColor: "#E99A4A", strokeColor: "#F6C17C" }, { level: "7", name: "7级草原", fillColor: "#E06A52", strokeColor: "#F39B88" }, { level: "8", name: "8级草原", fillColor: "#BD5367", strokeColor: "#E58A9A" }, ].map((item) => ({ ...item, key: `grassland-level-${item.level}`, cqlFilter: `grassland_level IN ('${item.level}','${item.name}','${grasslandLevelText[item.level]}草原','${grasslandLevelText[item.level]}草地')`, rankingPropertyName: ["area_code", "acreage"], rankingTownCodeKeys: ["area_code"], rankingAreaKeys: ["acreage"], level: undefined, })) const wetlandLevelLegends = grasslandLevelLegends.map((item) => { const level = item.key.replace("grassland-level-", "") const name = item.name.replace("草原", "湿地") return { ...item, key: `wetland-level-${level}`, name, cqlFilter: `grassland_level IN ('${level}','${name}','${item.name}','${grasslandLevelText[level]}湿地','${grasslandLevelText[level]}草原','${grasslandLevelText[level]}草地')`, } }) const basicGrasslandLegends = [ { key: "basic-grassland-basic", name: "基本草原", fillColor: "#35C98B", strokeColor: "#A7F3D0", cqlFilter: "(grassland_category_code = 'BASIC' OR grassland_category_name = '基本草原')", rankingValueKey: "basicAreaWanMu", }, { key: "basic-grassland-general", name: "一般草原", fillColor: "#E7B955", strokeColor: "#FFE3A0", cqlFilter: "(grassland_category_code = 'GENERAL' OR grassland_category_name = '一般草原')", rankingValueKey: "generalAreaWanMu", }, ] export const forestGrassWetTopics = [ { key: "overview", name: "资源概览", color: "#30DCFF", defaultLayerKey: "", coreGroups: [], }, { key: "grassland", name: "草地资源", color: "#8AE611", defaultLayerKey: "grassland-distribution", coreGroups: ["grassLand", "grassland"], }, { key: "wetland", name: "湿地资源", color: "#33A3DC", defaultLayerKey: "wetland-distribution", coreGroups: ["wetland"], }, { key: "woodland", name: "林地资源", color: "#2BD17E", defaultLayerKey: "woodland-distribution", coreGroups: ["woodland"], }, ] export const forestGrassWetOverlayLayers = [] export const ecologicalProtectionTopics = [ { key: "ecological-redline", name: "生态保护红线", color: "#30DCFF", defaultLayerKey: "ecological-redline-boundary", }, { key: "natural-protected-area", name: "自然保护地", color: "#19FFC6", defaultLayerKey: "natural-protected-area-boundary", }, { key: "national-park", name: "若尔盖国家公园", color: "#46E7FF", defaultLayerKey: "national-park-zoning", }, { key: "restoration", name: "生态修复工程", color: "#33A3DC", defaultLayerKey: "restoration-projects", }, { key: "engineering-analysis", name: "生态工程分析", color: "#24F6C4", defaultLayerKey: "engineering-suitability", }, ] export const yakIndustryChainTopics = [ { key: "yak-industry-chain", name: "牦牛全产业链", color: "#24F6C4", defaultLayerKey: "yak-industry-points", }, ] export const forestGrassWetLayers = { woodland: [ { key: "woodland-distribution", name: "林地分布", layerName: "ne:resource_woodland_parcel", styles: "woodland_distribution", opacity: 0.82, legends: [{ key: "woodland-distribution-all", name: "林地分布", fillColor: "#2BD17E", strokeColor: "#2BD17E", selectable: false }], }, { key: "woodland-protection", name: "公益林", layerName: "ne:resource_woodland_parcel", styles: "woodland_protection", opacity: 0.86, legends: [ { key: "woodland-protection-level-1", name: "国家一级公益林", fillColor: "#08C4C5", strokeColor: "#08C4C5", cqlFilter: createEqualityCql("gjgyl_bhdj", "1") }, { key: "woodland-protection-level-2", name: "国家二级公益林", fillColor: "#2BD17E", strokeColor: "#2BD17E", cqlFilter: createEqualityCql("gjgyl_bhdj", "2") }, { key: "woodland-protection-unset", name: "未划定", fillColor: "#6B8191", strokeColor: "#6B8191", cqlFilter: "(gjgyl_bhdj IS NULL OR gjgyl_bhdj = '' OR gjgyl_bhdj NOT IN ('1','2'))" }, ], }, { key: "woodland-type", name: "林地类型", layerName: "ne:resource_woodland_parcel", styles: "woodland_type", opacity: 0.84, legends: [ { key: "woodland-type-shrub", name: "灌木林地", fillColor: "#2BD17E", strokeColor: "#2BD17E", cqlFilter: createEqualityCql("dlmc", "灌木林地") }, { key: "woodland-type-arbor", name: "乔木林地", fillColor: "#0DA368", strokeColor: "#0DA368", cqlFilter: createEqualityCql("dlmc", "乔木林地") }, { key: "woodland-type-swamp", name: "灌丛沼泽", fillColor: "#23C7B7", strokeColor: "#23C7B7", cqlFilter: createEqualityCql("dlmc", "灌丛沼泽") }, { key: "woodland-type-other", name: "其他林地", fillColor: "#B7D96B", strokeColor: "#B7D96B", cqlFilter: "(dlmc IS NULL OR dlmc = '' OR dlmc NOT IN ('灌木林地','乔木林地','灌丛沼泽'))" }, ], }, { key: "woodland-quality", name: "林地质量", layerName: "ne:resource_woodland_parcel", styles: "woodland_quality", opacity: 0.84, legends: [ { key: "woodland-quality-2", name: "二级质量", fillColor: "#08C4C5", strokeColor: "#08C4C5", cqlFilter: createEqualityCql("zl_dj", "2") }, { key: "woodland-quality-3", name: "三级质量", fillColor: "#2BD17E", strokeColor: "#2BD17E", cqlFilter: createEqualityCql("zl_dj", "3") }, { key: "woodland-quality-4", name: "四级质量", fillColor: "#23C7B7", strokeColor: "#23C7B7", cqlFilter: createEqualityCql("zl_dj", "4") }, { key: "woodland-quality-5", name: "五级质量", fillColor: "#B7D96B", strokeColor: "#B7D96B", cqlFilter: createEqualityCql("zl_dj", "5") }, { key: "woodland-quality-unset", name: "未划分", fillColor: "#6B8191", strokeColor: "#6B8191", cqlFilter: "(zl_dj IS NULL OR zl_dj = '' OR zl_dj NOT IN ('2','3','4','5'))" }, ], }, { key: "woodland-ownership", name: "林地权属", layerName: "ne:resource_woodland_parcel", styles: "woodland_ownership", opacity: 0.84, legends: [ { key: "woodland-ownership-collective", name: "集体林地", fillColor: "#2BD17E", strokeColor: "#2BD17E", cqlFilter: createEqualityCql("ld_qs", "10") }, { key: "woodland-ownership-other", name: "国有或其他", fillColor: "#08C4C5", strokeColor: "#08C4C5", cqlFilter: "(ld_qs IS NULL OR ld_qs = '' OR ld_qs <> '10')" }, ], }, ], grassland: [ { key: "grassland-distribution", name: "草地分布", layerName: "ne:resource_grassland_distribution", opacity: 0.82, legends: [{ name: "草地", fillColor: "#1D953F", strokeColor: "#1D953F" }], }, { key: "basic-grassland", name: "基本/一般草原", layerName: "ne:resource_basic_grassland_parcel", styles: "", sldBody: createBasicGrasslandV21Sld(), opacity: 0.78, legends: basicGrasslandLegends, }, { key: "grassland-level", name: "草原级", layerName: "ne:resource_grassland_level_parcel", opacity: 0.82, legends: grasslandLevelLegends, }, { key: "grassland-type", name: "草原类型", layerName: "ne:resource_grassland_subtype_parcel", opacity: 0.82, legends: grasslandTypeLegends, }, { key: "grassland-yield", name: "草地产草量/生产力", layerName: "ne:resource_grassland_yield_parcel", opacity: 0.82, legends: productivityLegends, }, { key: "grassland-health", name: "草地健康/退化", layerName: "", opacity: 0.78, legends: [ { name: "非常差", fillColor: "#FF000533", strokeColor: "#FF0005", selectable: false }, { name: "差", fillColor: "#D8EE8C33", strokeColor: "#D8EE8C", selectable: false }, { name: "正常", fillColor: "#78C96233", strokeColor: "#78C962", selectable: false }, { name: "较好", fillColor: "#25814933", strokeColor: "#258149", selectable: false }, ], }, ], wetland: [ { key: "wetland-distribution", name: "湿地分布", layerName: "ne:resource_wetland_parcel", opacity: 0.84, legends: [{ name: "湿地", fillColor: "#33A3DC", strokeColor: "#33A3DC" }], }, { key: "wetland-level", name: "湿地级", layerName: "ne:resource_wetland_level_parcel", opacity: 0.82, legends: wetlandLevelLegends, }, { key: "wetland-type", name: "湿地类型", layerName: "ne:resource_wetland_subtype_parcel", opacity: 0.82, legends: grasslandTypeLegends, }, { key: "wetland-yield", name: "湿地产草量/生产力", layerName: "ne:resource_wetland_yield_parcel", opacity: 0.82, legends: productivityLegends, }, ], } export const ecologicalProtectionLayers = { "ecological-redline": [ { key: "ecological-redline-boundary", name: "生态保护红线", layerName: "ne:resource_ecological_redline_boundary", sourceType: "wfs", styles: "ecological_redline_hy", opacity: 0.58, fillColor: "#5EDFEA", strokeColor: "#BFFFFF", fillAlpha: 0.08, strokeAlpha: 0.56, lineWidth: 1.42, mapView: { targetLngLat: [102.58, 32.72], distanceScale: 0.96, targetLocalZ: 0.76, duration: 0.9, }, legends: [ { key: "ecological-redline-all", name: "生态保护红线", fillColor: "rgba(94, 223, 234, 0.28)", strokeColor: "#BFFFFF", selectable: false, }, ], }, ], "natural-protected-area": [ { key: "natural-protected-area-boundary", name: "自然保护地", layerName: "ne:resource_natural_protected_area_boundary", sourceType: "wfs", styles: "natural_protected_area_hy", opacity: 0.74, mapView: { targetLngLat: [102.64, 33.02], distanceScale: 0.98, targetLocalZ: 0.78, duration: 0.9, }, legends: [ { key: "natural-protected-area-core", name: "核心保护区", fillColor: "#FFD15A", strokeColor: "#FFE7A1", fillAlpha: 0.2, strokeAlpha: 0.95, lineWidth: 2.2, matches: [ { field: "functional_zone", value: "核心保护区" }, { field: "reserve_zone", value: "核心保护区" }, ], selectable: false, }, { key: "natural-protected-area-general", name: "一般控制区", fillColor: "#36D9FF", strokeColor: "#8EEDFF", fillAlpha: 0.14, strokeAlpha: 0.9, lineWidth: 1.8, matches: [ { field: "functional_zone", value: "一般控制区" }, { field: "reserve_zone", value: "一般控制区" }, ], selectable: false, }, ], }, ], "national-park": [ { key: "national-park-zoning", name: "国家公园分区", layerName: "ne:resource_national_park_boundary_render", sourceType: "wfs", opacity: 0.9, mapView: { targetLngLat: [102.88, 33.15], distanceScale: 1, targetLocalZ: 0.78, duration: 0.95, }, legends: [ { key: "national-park-core", name: "核心保护区", fillColor: NATIONAL_PARK_ZONING_COLORS.core.fillColor, strokeColor: NATIONAL_PARK_ZONING_COLORS.core.strokeColor, match: { field: "zone_type", value: "核心保护区" }, selectable: false, }, { key: "national-park-general", name: "一般控制区", fillColor: NATIONAL_PARK_ZONING_COLORS.general.fillColor, strokeColor: NATIONAL_PARK_ZONING_COLORS.general.strokeColor, match: { field: "zone_type", value: "一般控制区" }, selectable: false, }, ], }, ], restoration: [ { key: "restoration-projects", name: "生态修复工程", sourceType: "geojson-api", apiUrl: "/openApi/screen2/ecologicalProtection/restorationMap", opacity: 0.72, mapView: { targetLngLat: [102.58, 32.72], distanceScale: 0.96, targetLocalZ: 0.74, duration: 0.9, }, legends: [ { key: "restoration-grassland", name: "草地修复", fillColor: "#75AD49", strokeColor: "#D2EA78", cqlFilter: createEqualityCql("project_category", "草地修复"), match: { field: "project_category", value: "草地修复" }, }, { key: "restoration-wetland", name: "湿地修复", fillColor: "#4FB4C3", strokeColor: "#A9EEF2", cqlFilter: createEqualityCql("project_category", "湿地修复"), match: { field: "project_category", value: "湿地修复" }, }, { key: "restoration-woodland", name: "林地修复", fillColor: "#43A97A", strokeColor: "#95E2B7", cqlFilter: createEqualityCql("project_category", "林地修复"), match: { field: "project_category", value: "林地修复" }, }, { key: "restoration-linear", name: "线性设施", fillColor: "#D2B24D", strokeColor: "#FFE28A", cqlFilter: createEqualityCql("feature_role", "线性设施"), match: { field: "feature_role", value: "线性设施" }, }, ], }, ], "engineering-analysis": [ { key: "engineering-suitability", name: "工程适宜实施区域", sourceType: "analysis", opacity: 0.76, mapView: { targetLngLat: [102.58, 32.72], distanceScale: 0.94, targetLocalZ: 0.72, duration: 0.85, }, legends: [], }, ], } export const yakIndustryChainLayers = { "yak-industry-chain": [ { key: "yak-recognition-layer", name: "牦牛识别", sourceType: "wmts", layerName: "ne:daping_yak_marks", style: "ne:yak_marks", styles: "ne:yak_marks", format: "image/png", tileMatrixSetID: "EPSG:900913", maximumLevel: 21, homeWmtsZoom: 10, homeWmtsEnhance: true, homeWmtsPointSpread: 1.4, homeWmtsGlowRadius: 1.8, url: "/geoserver/gwc/service/wmts", opacity: 0.96, queryBuffer: 10, fillColor: "rgba(255, 230, 0, 0)", strokeColor: "#FFE600", glowColor: "rgba(255, 230, 0, 0.42)", lineWidth: 1.4, mapView: { targetLngLat: [102.58, 32.72], distanceScale: 0.82, targetLocalZ: 0.76, duration: 0.85, }, legends: [ { key: "yak-recognition-all", name: "牦牛识别", fillColor: "#FFE600", strokeColor: "#FFF58A", selectable: false, }, ], }, { key: "yak-industry-points", name: "牦牛产业点位", sourceType: "geojson", dataPath: "", fallbackPath: "", opacity: 0.96, pointLabelLimit: 12, showPointLabels: false, showPointAtAllDistances: true, mapView: { targetLngLat: [102.48, 32.69], distanceScale: 0.82, targetLocalZ: 0.76, duration: 0.85, }, legends: [ { key: "yak-industry-family-pasture", name: "家庭生态牧场", fillColor: "#30DCFF", strokeColor: "#C9FBFF", iconType: "pasture", match: { field: "stageKey", value: "family-pasture" }, }, { key: "yak-industry-artificial-grassland", name: "人工种草基地点", fillColor: "#22F6B8", strokeColor: "#B7FFF2", iconType: "grass", match: { field: "stageKey", value: "artificial-grassland" }, }, { key: "yak-industry-scale-breeding", name: "规模化养殖基地", fillColor: "#FFD166", strokeColor: "#FFF1B8", iconType: "breeding", match: { field: "stageKey", value: "scale-breeding" }, }, { key: "yak-industry-breeding-selection", name: "选育/扩繁基地", fillColor: "#A78BFA", strokeColor: "#E5D8FF", iconType: "gene", matches: [ { field: "categoryCode", value: "YC-BREEDING-STOCK" }, { field: "categoryCode", value: "YC-CXPT-BREEDING-STOCK-BASE" }, ], }, { key: "yak-industry-forage-storage", name: "防灾减灾", fillColor: "#FF8C78", strokeColor: "#FFE1D8", iconType: "storage", match: { field: "stageKey", value: "forage-storage" }, }, { key: "yak-industry-milk-source-station", name: "奶源站", fillColor: "#6BA7FF", strokeColor: "#D8E8FF", iconType: "milk", match: { field: "stageKey", value: "milk-source-station" }, }, { key: "yak-industry-slaughter-processing", name: "屠宰与加工", fillColor: "#43D9FF", strokeColor: "#B8F7FF", iconType: "factory", match: { field: "stageKey", value: "slaughter-processing" }, }, { key: "yak-industry-forage-trade", name: "牧草交易", fillColor: "#46E6AD", strokeColor: "#B7FFF2", iconType: "trade", match: { field: "stageKey", value: "forage-trade" }, }, { key: "yak-industry-social-service", name: "社会化服务", fillColor: "#F0C35A", strokeColor: "#FFF1B8", iconType: "service", match: { field: "stageKey", value: "social-service" }, }, ], }, { key: "artificial-grassland-plots", name: "人工种草图斑", sourceType: "geojson-api", apiUrl: "/openApi/screen2/industryChain/artificialGrasslandMap", dataPath: "", fallbackPath: "", opacity: 0.94, fillAlpha: 0.34, strokeAlpha: 0.96, lineWidth: 2.6, polygonHeight: 18, polygonClampToGround: false, classificationType: false, clipToHongyuanBoundary: true, mapView: { targetLngLat: [102.51, 32.79], distanceScale: 0.62, targetLocalZ: 0.76, duration: 0.9, }, legends: [ { key: "artificial-grassland-pending", name: "待核定种草图斑", fillColor: "#20D8FF", strokeColor: "#E7FFFF", match: { field: "data_status", value: "待核定" }, selectable: false, }, ], }, ], } const layerRegistry = { ...forestGrassWetLayers, ...ecologicalProtectionLayers, ...yakIndustryChainLayers, } const topicRegistry = [...forestGrassWetTopics, ...ecologicalProtectionTopics, ...yakIndustryChainTopics] export function getTopicConfig(topicKey) { return topicRegistry.find((topic) => topic.key === topicKey) || forestGrassWetTopics[0] } export function getLayersByTopic(topicKey) { return layerRegistry[topicKey] || [] } export function getLayerByKey(topicKey, layerKey) { const layers = getLayersByTopic(topicKey) return layers.find((layer) => layer.key === layerKey) || layers[0] } export function getForestGrassWetOverlayLayers(keys = []) { const selectedKeys = new Set((Array.isArray(keys) ? keys : [keys]).map((key) => String(key || "")).filter(Boolean)) return forestGrassWetOverlayLayers.filter((layer) => selectedKeys.has(layer.key)) }