Skip to content

Commit

Permalink
v0.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
bhousel committed Mar 27, 2021
1 parent c31beaf commit bb76cac
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 14 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ _Breaking changes, which may affect downstream projects, are marked with a_ :war
[#xxx]: https://github.com/ideditor/location-conflation/issues/xxx
-->

# 0.8.0
##### 2021-Mar-27
* Add support for optional `radius` value for point locations.
* Radius is specified in kilometers and is optional. If not specified, it will default to a 25km radius.


# 0.7.0
##### 2020-Dec-30
* Perf improvement: Don't union features iteratively with locationReducer ([#26])
Expand Down
28 changes: 15 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ to bundle or fetch so much geodata.

You can define a *locationSet* as an Object with `include` and `exclude` properties:
```js
let locationSet = {
const locationSet = {
include: [ Array of locations ],
exclude: [ Array of locations ]
};
Expand All @@ -38,7 +38,7 @@ The "locations" can be any of the following:
_Examples: `"de-hamburg.geojson"`, `"new_jersey.geojson"`_

- Circular areas defined as `[longitude, latitude, radius?]` Array.<br/>
Radius is specified in kilometers, and is optional. If not specified, it will default to a 25km radius.<br/>
Radius is specified in kilometers and is optional. If not specified, it will default to a 25km radius.<br/>
_Examples: `[8.67039, 49.41882]`, `[-88.3726, 39.4818, 32]`_


Expand Down Expand Up @@ -66,17 +66,17 @@ You can also use **location-conflation** directly in a web browser. A good way t

The latest versions of many web browsers now support [ES6 modules in script tags](https://caniuse.com/#feat=es6-module) like this:
```html
<script type="module" src="https://cdn.jsdelivr.net/npm/@ideditor/location-conflation@0.7/index.min.mjs"></script>
<script type="module" src="https://cdn.jsdelivr.net/npm/@ideditor/location-conflation@0.8/index.min.mjs"></script>
```

Older versions of modern ES6-capable browsers can still load the UMD build:
```html
<script src="https://cdn.jsdelivr.net/npm/@ideditor/location-conflation@0.7/dist/index.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@ideditor/location-conflation@0.8/dist/index.min.js"></script>
```

Or if you need to support even older browsers like Internet Explorer, fetch the ES5 version:
```html
<script src="https://cdn.jsdelivr.net/npm/@ideditor/location-conflation@0.7/dist/index.es5.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@ideditor/location-conflation@0.8/dist/index.es5.min.js"></script>
```

&nbsp;
Expand All @@ -90,31 +90,31 @@ const loco = new LocationConflation(myFeatures);

#### Southern Europe:
```js
let locationSet = { include: ['039'] }; // 039 = Southern Europe
let result = loco.resolveLocationSet(locationSet);
const locationSet = { include: ['039'] }; // 039 = Southern Europe
const result = loco.resolveLocationSet(locationSet);
```
<img width="800px" alt="Southern Europe" src="https://github.com/raw/ideditor/location-conflation/main/docs/images/example1.png"/>


#### Southern Europe and Northern Africa:
```js
let locationSet = { include: ['039','015'] }; // 015 = Northern Africa
let result = loco.resolveLocationSet(locationSet);
const locationSet = { include: ['039','015'] }; // 015 = Northern Africa
const result = loco.resolveLocationSet(locationSet);
```
<img width="800px" alt="Southern Europe and Northern Africa" src="https://github.com/raw/ideditor/location-conflation/main/docs/images/example2.png"/>


#### Southern Europe and Northern Africa, _excluding_ Egypt and Sudan:
```js
let locationSet = { include: ['039','015'], exclude: ['eg','sd'] };
let result = loco.resolveLocationSet(locationSet);
const locationSet = { include: ['039','015'], exclude: ['eg','sd'] };
const result = loco.resolveLocationSet(locationSet);
```
<img width="800px" alt="Southern Europe and Northern Africa, excluding Egypt and Sudan" src="https://github.com/raw/ideditor/location-conflation/main/docs/images/example3.png"/>


#### The Alps, _excluding_ Liechtenstein and regions around Bern and Zürich
```js
let result = loco.resolveLocationSet({ include: ['alps.geojson'], exclude: ['li', [8.55,47.36], [7.45,46.95]] });
const result = loco.resolveLocationSet({ include: ['alps.geojson'], exclude: ['li', [8.55,47.36], [7.45,46.95]] });
```
<img width="800px" alt="The Alps, excluding Liechtenstein and regions around Bern and Zürich" src="https://github.com/raw/ideditor/location-conflation/main/docs/images/example4.png"/>

Expand Down Expand Up @@ -167,9 +167,11 @@ Validates a given location. The "locations" can be:
- Filename-like identifiers of custom `.geojson` features. <br/>
_Examples: `"de-hamburg.geojson"`, `"new_jersey.geojson"`_

- Points as `[longitude, latitude, radius?]` Arrays.<br/>
- Circular areas defined as `[longitude, latitude, radius?]` Array.<br/>
Radius is specified in kilometers and is optional. If not specified, it will default to a 25km radius.<br/>
_Examples: `[8.67039, 49.41882]`, `[-88.3726, 39.4818, 32]`_


If the location is valid, returns a result `Object` like:
```js
{
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ideditor/location-conflation",
"version": "0.7.0",
"version": "0.8.0",
"license": "ISC",
"repository": "github:ideditor/location-conflation",
"contributors": [
Expand Down

0 comments on commit bb76cac

Please sign in to comment.