-
-
Notifications
You must be signed in to change notification settings - Fork 6
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
Map country areas #484
base: develop
Are you sure you want to change the base?
Map country areas #484
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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.
Nice work and very well documented. Thank you for this, Luke.
Some minor comments here
The Map block expects incoming data to be an array of objects. | ||
Each object represents a marker, and/or a country area. Each object can include the following properties: | ||
|
||
- **Location-based Pin:** Provide both ``lat`` and ``long`` properties to display a pin at the specified coordinates. |
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.
Can you please write the properties exactly as they are in the object? We do like this in all the other blocks and common way of documenting.
So in this case it would be:
customPin
: explanation
lat
long
label
and so on.
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.
An example made by you ;) here: https://github.com/kendraio/kendraio-app/pull/477/files#diff-4354ba88bbed0d8a4f177a6a9a4523155e8e57b2af6e29029d98396e6f5fc8fdR20
|
||
Optionally, include a ``label`` property for the popup label and a ``customPin`` property for custom icons (see below). | ||
|
||
**Example: Displaying location pins** |
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.
Can we keep the format of "Examples" as chapter title and then the examples name as subtitle?
Like we do here: https://kendraio-app.readthedocs.io/en/latest/workflow/blocks/actions.html
"type": "mapping", | ||
"mapping": "data[?recovered > `20`].{ lat: lat, long: long, label: join(' ', [to_string(recovered), 'recovered in', combinedKey][? @ != null]) }" | ||
} | ||
{ |
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.
This is not clear to me. Where this countryStyle
object should stay? Is another property of the object containing the country, the lat and long? Or where it stays?
|
||
Example map block configuration: | ||
**Example: Displaying country areas** |
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.
I would suggest getting rid of this title and the countryStyle code and directly write the complete code example.
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.
I would say you can even write an example with the customPin
. Is clear enough, I don't think it needs two separate example for it.
|
||
**Example: Custom pin icons with emojis** | ||
|
||
This example uses emojis as custom pin icons for specific locations: |
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.
I am confuse, I don't see any difference between this customPin
value and previous example customPin
value
component = fixture.componentInstance; | ||
}); | ||
|
||
it("should create", () => { |
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.
it should create... what? :)
lat: `51.5074`, | ||
long: `-0.1278`, | ||
label: "London", | ||
customPin: "📍", |
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.
shouldn't this be plain text?
@@ -28,23 +29,92 @@ contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA | |||
markerClusterData = []; | |||
markerClusterOptions = {}; | |||
|
|||
// Country GeoJSON provider base URL | |||
countryProviderBaseURL = 'https://raw.githubusercontent.com/AshKyd/geojson-regions/main/public/countries/50m/'; |
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.
These are static values, right?
Can you please write them in uppercase and outside the component? So they do not get re-render/re-computed
|
||
// In-memory cache for country GeoJSON data | ||
countryCache: { [key: string]: any } = {}; | ||
|
||
onConfigUpdate(config: any) { | ||
this.height = get(config, 'height', 500); | ||
set(this.options, 'zoom', get(config, 'zoom', 8)); | ||
const latln = get(config, 'latlng', [51.505, -0.09]); |
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.
Where do these static values come from? 500
, 8
and [51,505, -0,09]
Would be great to know. Maybe add a comment on the code?
}); | ||
} | ||
|
||
if (lat && long) { |
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.
Is it reasonable to create an object without LAT and LONG? Aren't they indispensable information to work with a map?
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.
A country is an area, and so is a LAT and LONG, it is just smaller, as a point.
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.
Honestly @lukestanley I do not understand this comment. Can you help me understand better what do you mean?
My question is: Can map object exist and be valid without a LAT and LONG? If yes, how come?
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.
Very nice work!
Makes Map block able to accept a "country" property in the array of map points it processes, that show as an area, the values must be 3 letter ISO country codes.
Shading for area can be adjusted.
Custom map pin points may be set to an emoji flag.
Documentation has been updated.
A unit tests file for the block was added.
This should meet requirements for: #483