Skip to content

Commit 5216b57

Browse files
committed
Update documentation
1 parent 73085c5 commit 5216b57

File tree

2 files changed

+63
-54
lines changed

2 files changed

+63
-54
lines changed

CONTRIBUTING.md

+53-48
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@
44

55
There are 2 kinds of files in this project:
66

7-
* Under `features/` there are `.geojson` files to describe the areas where the communities are active
87
* Under `resources/` there are `.json` files to describe the community resources
8+
* Under `features/` there are `.geojson` files to describe the areas where the communities are active
99

1010
##### tl;dr
1111

1212
To add your community resource:
1313

14-
* Add a **feature** `.geojson` file under `features/` folder
15-
* This is a boundary around where the resource is active
16-
* You can use [geojson.io](http://geojson.io) or other tools to create these.
17-
* Add a **resource** `.json` file under `resources/` folder
14+
* (required) Add a **resource** `.json` file under `resources/` folder
1815
* This contains info about what the resource is (slack, forum, mailinglist, facebook, etc.)
1916
* You can just copy and change an existing one
20-
* Several resources can share the same `.geojson` feature
17+
* Each resource needs an `includeLocations` property to say where it is active.
18+
* (optional) Add a **feature** `.geojson` file under `features/` folder
19+
* This is a boundary around where the resource is active
20+
* You can use [geojson.io](http://geojson.io) or other tools to create these.
2121
* `npm run test`
2222
* This will build and check for errors and make the files pretty
2323

@@ -30,56 +30,18 @@ To add your community resource:
3030
* Run `npm install` to install libraries
3131

3232

33-
### Features
34-
35-
These are `*.geojson` files found under the `features/` folder. Each feature file contains a single GeoJSON `Feature` for a region where a community resource is active.
36-
37-
Feature files look like this:
38-
39-
```js
40-
{
41-
"type": "Feature",
42-
"id": "usa_full",
43-
"properties": { "area": 11645277.77 },
44-
"geometry": {
45-
"type": "MultiPolygon",
46-
"coordinates": [
47-
...
48-
]
49-
}
50-
}
51-
```
52-
53-
Note: A `FeatureCollection` containing a single `Feature` is ok too - the build script can handle this.
54-
55-
There are many online tools to create or modify these `.geojson` files. A workflow could be:
56-
57-
1. Create the shape with [geojson.io](http://geojson.io) from scratch.
58-
59-
or
60-
61-
1. Generate a precise file with the [Polygon creation](http://polygons.openstreetmap.fr/) from an OSM Relation.
62-
1. Simplify the file with [Mapshaper](http://mapshaper.org/). Beware that the simplification probably cuts some border areas.
63-
1. So load the file in [geojson.io](http://geojson.io) and include the border areas again and perhaps reduce the point count further. It is probably better to have the feature a bit larger than missing an area.
64-
65-
Each feature must have a unique `id` property, for example `usa_full`.
66-
67-
You do not need to supply an `area` property. The `npm run build` script will calculate the `area` property automatically.
68-
69-
7033
### Resources
7134

7235
These are `*.json` files found under the `resources/` folder.
73-
Each resource file contains a single JSON object with information about
74-
the community resource.
36+
Each resource file contains a single JSON object with information about the community resource.
7537

7638
Resource files look like this:
7739

7840
```js
7941
{
8042
"id": "OSM-US-slack",
81-
"featureId": "usa_full",
8243
"type": "slack",
44+
"includeLocations": ["us"],
8345
"countryCodes": ["us"],
8446
"languageCodes": ["en"],
8547
"name": "OpenStreetMap US Slack",
@@ -111,14 +73,24 @@ Resource files look like this:
11173
Here are the properties that a resource file can contain:
11274

11375
* __`id`__ - (required) A unique identifier for the resource.
114-
* __`featureId`__ - (optional) A unique identifier for the feature. This `featureId` matches the resource to a .geojson feature. If null, this is a global resource.
11576
* __`type`__ - (required) Type of community resource (see below for list).
77+
* __`includeLocations`__ - (required) Array of locations where the resource is active. May contain any of these:
78+
* Any string recognized by the [country-coder library](https://github.com/ideditor/country-coder#readme). These should be [ISO 3166-1 2 or 3 letter country codes or UN M.49 numeric codes](https://en.wikipedia.org/wiki/List_of_countries_by_United_Nations_geoscheme).
79+
Example: `"de"`
80+
* Any filename for a `.geojson` file saved under the `/features` folder
81+
Example: `"de-hamburg.geojson"`
82+
* A `[longitude, latitude]` coordinate pair. A 15km radius circle will be computed around this point.
83+
Example: `[8.67039, 49.41882]`
84+
* __`excludeLocations`__ - (optional) Array of locations to exclude from `includeLocations` (specified in the same format):
11685
* __`name`__ - (required) Display name for this community resource
86+
(in English, will be sent to Transifex for translation to other languages)
11787
* __`description`__ - (required) One line description of the community resource
88+
(in English, will be sent to Transifex for translation to other languages)
11889
* __`extendedDescription`__ - (optional) Longer description of the community resource
90+
(in English, will be sent to Transifex for translation to other languages)
11991
* __`url`__ - (required) A url link to visit the community resource
12092
* __`signupUrl`__ - (optional) A url link to sign up for the community resource
121-
* __`countryCodes`__ - (optional) Array of [two letter country codes](https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes) where the community is active
93+
* __`countryCodes`__ - (optional) Array of [two letter country codes](https://en.wikipedia.org/wiki/List_of_countries_by_United_Nations_geoscheme) where the community is active
12294
* __`languageCodes`__ - (optional) Array of [two letter](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) or [three letter](https://en.wikipedia.org/wiki/List_of_ISO_639-3_codes) spoken by this community
12395
* __`order`__ - (optional) When several resources with same geography are present, this adjusts the display order (default = 0, higher numbers display more prominently)
12496

@@ -165,6 +137,39 @@ Resources may have events. These are optional.
165137
* __`url`__ - (optional) A url link for the event
166138

167139

140+
### Features
141+
142+
These are `*.geojson` files found under the `features/` folder. Each feature file contains a single GeoJSON `Feature` for a region where a community resource is active.
143+
144+
Feature files look like this:
145+
146+
```js
147+
{
148+
"type": "Feature",
149+
"id": "boston_metro",
150+
"properties": {"area": 6992.97},
151+
"geometry": {
152+
"type": "Polygon",
153+
"coordinates": [...]
154+
}
155+
}
156+
```
157+
158+
Note: A `FeatureCollection` containing a single `Feature` is ok too - the build script can handle this.
159+
160+
There are many online tools to create or modify these `.geojson` files. A workflow could be:
161+
162+
1. Create the shape with [geojson.io](http://geojson.io) from scratch.
163+
164+
or
165+
166+
1. Generate a precise file with the [Polygon creation](http://polygons.openstreetmap.fr/) from an OSM Relation.
167+
1. Simplify the file with [Mapshaper](http://mapshaper.org/). Beware that the simplification probably cuts some border areas.
168+
1. So load the file in [geojson.io](http://geojson.io) and include the border areas again and perhaps reduce the point count further. It is probably better to have the feature a bit larger than missing an area.
169+
170+
You do not need to supply an `area` property or `id` property. The `npm run build` script will calculate these automatically.
171+
172+
168173
### Building
169174

170175
* Just `npm run test`

README.md

+10-6
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ might find interesting or helpful.
2424
#### Source files
2525
The source files for this index are stored in two kinds of files:
2626

27-
* Under `features/` there are `.geojson` files to describe the areas where the communities are active
2827
* Under `resources/` there are `.json` files to describe the community resources
28+
* Under `features/` there are `.geojson` files to describe the areas where the communities are active
2929

3030
:point_right: See [CONTRIBUTING.md](CONTRIBUTING.md) for info about how to add your
3131
community resource to this index.
@@ -43,33 +43,37 @@ Several files are published under `dist/`
4343

4444
##### tl;dr
4545

46-
* Add a **feature** `.geojson` file under `features/` folder
47-
* This is a boundary around where the resource is active
48-
* You can use [geojson.io](http://geojson.io) to create these
49-
* Add a **resource** `.json` file under `resources/` folder
46+
* (required) Add a **resource** `.json` file under `resources/` folder
5047
* This contains info about what the resource is (slack, forum, mailinglist, facebook, etc.)
5148
* You can just copy and change an existing one
52-
* Several resources can share the same `.geojson` feature
49+
* Each resource needs an `includeLocations` property to define where it is active.
50+
* (optional) Add a **feature** `.geojson` file under `features/` folder
51+
* This is a boundary around where the resource is active
52+
* You can use [geojson.io](http://geojson.io) or other tools to create these.
5353
* `npm run test`
5454
* This will build and check for errors and make the files pretty
5555

56+
5657
#### Prerequisites
5758

5859
* [Node.js](https://nodejs.org/) version 8 or newer
5960
* [`git`](https://www.atlassian.com/git/tutorials/install-git/) for your platform
6061

62+
6163
#### Installing
6264

6365
* Clone this project, for example:
6466
`git clone git@github.com:osmlab/osm-community-index.git`
6567
* `cd` into the project folder,
6668
* Run `npm install` to install libraries
6769

70+
6871
#### Building
6972

7073
* Just `npm run test`
7174
* This will check the files for errors and make them pretty.
7275

76+
7377
### License
7478

7579
osm-community-index is available under the [ISC License](https://opensource.org/licenses/ISC).

0 commit comments

Comments
 (0)