-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Maps integration #240
Merged
Merged
Maps integration #240
Changes from 1 commit
Commits
Show all changes
71 commits
Select commit
Hold shift + click to select a range
50da8f9
feat: Add interactiveFiltersConfig to maps
bprusinowski 3948b3e
feat: Initial addition of GeoDimension
bprusinowski f5ba35e
feat: Initial integration of maps with configurator: base layers
bprusinowski d9eac54
feat: Show areaLayer and symbolLayer in the configurator panel for maps
bprusinowski 04855f6
refactor: Minor code cleaning
bprusinowski d6cae96
feat: Add geoShapes fetching to RDF and GraphQL
bprusinowski f1e89d8
feat; Add initial custom shapes drawing
bprusinowski f572ada
feat: Add geoShapes parsing to resolvers + minor improvements
bprusinowski d350226
fix: Map tooltip
bprusinowski 9882cf3
feat: Add color palette selector to maps
bprusinowski ec636d8
chore: Clean up the code
bprusinowski e2f852d
feat: Add scale type selector to maps
bprusinowski 8beedf5
feat: Add symbol layer to maps
bprusinowski 93b9d6c
chore: Remove experimental map
bprusinowski 943ca30
refactor: Use isSegmentInConfig method to check for segments
bprusinowski 2414a13
chore: Revert SPARQL_ENDPOINT to a correct value
bprusinowski 2889b61
feat: Switch to topoJSON + add mesh to the map
bprusinowski ad5976d
perf: Save observations in GeoJSON.Feature properties
bprusinowski edfc783
fix: Legend for no data points
bprusinowski c429a73
refactor: Move number of classes options outside of the component
bprusinowski 5118f10
chore: Remove unused map prototype components
bprusinowski c5597e1
fix: Color and radius issues for undefined observations
bprusinowski a2597c7
feat: Use DataLoader for geoShapes fetching
bprusinowski 29d81a7
feat: Add an ability to set symbolLayer color
bprusinowski 4d03c9a
feat: Use batching from DataLoader to fetch geoDimensions
bprusinowski f239a5b
wip: Initial map legend optimizations & sizing issue fixes
bprusinowski dcc9eab
feat: Add GeoCoordinatesDimension
bprusinowski 13e027f
Merge branch 'feat/fetch-dimension-values-if-no-sh-in' of github.com:…
bprusinowski a25f06e
feat: Change the query not to use OPTIONAL + n of outputs === n of in…
bprusinowski 5253ad8
chore: Update yarn.lock
bprusinowski 4e33ecb
feat: Remove OPTIONAL fields from GeoCoordinates + clean the code
bprusinowski 068a837
Merge branch 'main' of github.com:visualize-admin/visualization-tool …
bprusinowski d88e62b
feat: Enable geo fetching for new dimensionValues format
bprusinowski 5f99327
fix: Load GeoCoordinates using versioned dimension values
bprusinowski 868b459
feat: Add getGeoDimensions functions
bprusinowski 449b60d
feat: Populate initial map chart config symbol field with proper dims
bprusinowski 3c4df67
feat: Update map chart options
bprusinowski 14d2aba
feat: Add initial geoCoordinates drawing
bprusinowski 9db11ec
fix: Flickering screen when selecting a map chart
bprusinowski 8496dda
feat: Minor deck.gl adjustments
bprusinowski c502611
fix: Radius extent to start from 0
bprusinowski 43074ac
fix: Hover on shape boundary
bprusinowski b50eaeb
feat: Add useTooltip
bprusinowski 42326eb
feat: Map tooltip & legend optimizations
bprusinowski 45dba12
fix: Initial legend labels
bprusinowski 53bed74
fix: Hide lower circle in symbol legend on hover
bprusinowski b8f809b
refactor: Map legend & tooltip
bprusinowski 64977a2
feat: Add fallback for geo labels with no locales
bprusinowski 953cb00
feat: Small improvements to the map
bprusinowski 1069b87
feat: Initial geo hierarchies
bprusinowski 7725bc5
feat: Add geo hierarchies to area layer
bprusinowski 227cae8
refactor: Simplify createHierarchy
bprusinowski 1c06e65
Merge branch fix/data-loader-bugs
bprusinowski 74ac892
feat: Retrieve SPARQL_GEO_ENDPOINT from env variables
bprusinowski 03fe84f
feat: Switck back to int.lindas for preview deployments
bprusinowski ff6220d
fix: Hierarchy select types + small improvements
bprusinowski d542d98
chore: Rename chart prototype file
bprusinowski c761d73
refactor: Improve types
bprusinowski bf172b6
chore: Remove unused map config field
bprusinowski 2aeabc4
refactor: Small optimization
bprusinowski e2093e7
fix: Enabled chart types
bprusinowski 8bb49ff
feat: Decrease maxBatchSize for geoCoords due to filtering in SpQL
bprusinowski 222f157
refactor: Map legend improvements
bprusinowski 15dcaf4
refactor: Extract Circle from CircleLegend
bprusinowski b97a2a4
refactor: Map chart options to useMemo
bprusinowski ec093d3
refactor: Use ns.schema instead of hard-coded string in geoCoords
bprusinowski 609c2a6
refactor: Use hierarchy levels defined in shapes instead of creating …
bprusinowski 7e63406
fix: Allow observation to be undefined in GeoProperties
bprusinowski 56ab798
refactor: Use proper ns.schema instead of hard-coded string in geoCoords
bprusinowski b3b8310
refactor: Map tooltip optimizations
bprusinowski c2d56d0
refactor: Split geoShapes query into 2 to prevent SPARQL failures + s…
bprusinowski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,7 @@ export interface GeoShapeFeature { | |
properties: { | ||
iri: string; | ||
label: string; | ||
observation: Observation; | ||
}; | ||
geometry: GeoJSON.Geometry; | ||
} | ||
|
@@ -61,37 +62,64 @@ export const ChartMapVisualization = ({ | |
iri: dataSetIri, | ||
measures: [ | ||
chartConfig.fields.areaLayer.componentIri, | ||
chartConfig.fields.symbolLayer?.componentIri, | ||
chartConfig.fields.symbolLayer.componentIri, | ||
], | ||
filters: queryFilters, | ||
}, | ||
}); | ||
|
||
const geoDimension = data?.dataCubeByIri?.dimensions.find( | ||
(d) => d.__typename === "GeoDimension" | ||
) as GeoDimension | undefined; | ||
(d) => d.iri === chartConfig.fields.areaLayer.componentIri | ||
) as GeoDimension; | ||
|
||
const areaLayer = useMemo(() => { | ||
if (geoDimension) { | ||
const geoShapes = geoDimension.geoShapes as GeoShapes; | ||
const shapes = topojsonFeature( | ||
geoShapes, | ||
geoShapes.objects.shapes | ||
) as GeoJSON.FeatureCollection< | ||
GeoJSON.GeometryObject, | ||
GeoShapeFeature["properties"] | ||
>; | ||
|
||
shapes.features.forEach((d) => { | ||
// Should we match by labels? | ||
d.properties.observation = data?.dataCubeByIri?.observations.data.find( | ||
(o) => | ||
o[chartConfig.fields.areaLayer.componentIri] === d.properties!.label | ||
); | ||
}); | ||
|
||
return { | ||
shapes: topojsonFeature( | ||
geoShapes, | ||
geoShapes.objects.shapes | ||
) as GeoJSON.FeatureCollection, | ||
shapes, | ||
mesh: topojsonMesh(geoShapes, geoShapes.objects.shapes as any), | ||
}; | ||
} | ||
}, [geoDimension]); | ||
}, [ | ||
geoDimension, | ||
chartConfig.fields.areaLayer.componentIri, | ||
data?.dataCubeByIri?.observations.data, | ||
]); | ||
|
||
const symbolLayer = useMemo(() => { | ||
return areaLayer?.shapes.features.map((d) => ({ | ||
coordinates: geoCentroid(d), | ||
iri: d.properties!.iri, | ||
label: d.properties!.label, | ||
properties: { | ||
iri: d.properties!.iri, | ||
label: d.properties!.label, | ||
// Should we match by labels? | ||
observation: data?.dataCubeByIri?.observations.data.find( | ||
(o) => | ||
o[chartConfig.fields.areaLayer.componentIri] === d.properties!.label | ||
), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The observtions by label index could be used here. |
||
}, | ||
})); | ||
}, [areaLayer]); | ||
}, [ | ||
areaLayer, | ||
chartConfig.fields.areaLayer.componentIri, | ||
data?.dataCubeByIri?.observations.data, | ||
]); | ||
|
||
useEffect(() => { | ||
const loadGeoData = async () => { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could use an index label -> observations here so that this step is O(nlogn) instead of O(n2).