Skip to content

Commit

Permalink
maps: networkProvider -> networkProviders
Browse files Browse the repository at this point in the history
  • Loading branch information
odscjames committed Jan 13, 2023
1 parent 16a7d6d commit cb84013
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 5 deletions.
4 changes: 2 additions & 2 deletions cove_ofds/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ class ConvertJSONIntoGeoJSON(ProcessDataTask):
"/features/properties/network/name": "Network",
"/features/properties/phase/name": "Phase",
"/features/properties/physicalInfrastructureProvider/name": "Physical Infrastructure Provider",
"/features/properties/networkProvider/name": "Network Provider",
"/features/properties/networkProviders/name": "Network Providers",
"/features/properties/technologies": "Technologies",
"/features/properties/status": "Status",
"/features/properties/type": "Type",
Expand All @@ -250,7 +250,7 @@ class ConvertJSONIntoGeoJSON(ProcessDataTask):
"/features/properties/network/name": "Network",
"/features/properties/phase/name": "Phase",
"/features/properties/physicalInfrastructureProvider/name": "Physical Infrastructure Provider",
"/features/properties/networkProvider/name": "Network Provider",
"/features/properties/networkProviders/name": "Network Providers",
"/features/properties/supplier/name": "Supplier",
"/features/properties/transmissionMedium": "Transmission Medium",
"/features/properties/status": "Status",
Expand Down
33 changes: 30 additions & 3 deletions cove_ofds/templates/cove_ofds/explore.html
Original file line number Diff line number Diff line change
Expand Up @@ -386,10 +386,19 @@ <h4 class="panel-title">
};

function generatePopup(layer) {
let networkProvidersNames = []
if (layer?.feature?.properties?.networkProviders) {
for(np of layer.feature.properties.networkProviders) {
if (np?.name) {
networkProvidersNames.push(np.name)
}
}
}
networkProvidersNames.sort()
return `
<p><strong>Name:</strong> ${layer?.feature?.properties?.name || 'Unknown'}</p>
<p><strong>Network:</strong> ${layer?.feature?.properties?.network?.name || 'Unknown'}</p>
<p><strong>Network provider:</strong> ${layer?.feature?.properties?.networkProvider?.name || 'Unknown'}</p>
<p><strong>Network provider:</strong> ${networkProvidersNames.join(", ") || 'Unknown'}</p>
<p><strong>Physical infrastructure provider:</strong> ${layer?.feature?.properties?.physicalInfrastructureProvider?.name || 'Unknown'}</p>
<p><strong>Phase:</strong> ${layer?.feature?.properties?.phase?.name || 'Unknown'}</p>
`;
Expand Down Expand Up @@ -454,7 +463,16 @@ <h4 class="panel-title">

function getFeatureName(feature, field) {
let fieldOptions = getJsonFromDict(feature);
if (feature?.properties[field]?.name !== undefined) {
if (field == 'networkProviders' && feature?.properties[field]) {
let names = []
for(np of feature.properties[field]) {
if (np?.name) {
names.push(np.name)
}
}
names.sort()
return names.join(', ')
} else if (feature?.properties[field]?.name !== undefined) {
return feature.properties[field].name
} else if ((feature?.properties[field] !== undefined)) {
return `${fieldOptions[field]}: ${feature?.properties[field] || 'no data'}`
Expand All @@ -471,7 +489,16 @@ <h4 class="panel-title">
let spanLegend = {}

function getFeatureID(feature, field) {
if (feature?.properties[field]?.id !== undefined) {
if (field == 'networkProviders' && feature?.properties[field]) {
let names = []
for(np of feature.properties[field]) {
if (np?.name) {
names.push(np.name)
}
}
names.sort()
return names.join(', ')
} else if (feature?.properties[field]?.id !== undefined) {
return feature.properties[field].id
} else if ((feature?.properties[field] !== undefined)) {
return feature.properties[field]
Expand Down

0 comments on commit cb84013

Please sign in to comment.