-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
43 additions
and
36 deletions.
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
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[](https://github.com/ideditor/location-conflation/actions?query=workflow%3A%22build%22) | ||
[](https://badge.fury.io/js/%40ideditor%2Flocation-conflation) | ||
[](https://github.com/rapideditor/location-conflation/actions?query=workflow%3A%22build%22) | ||
[](https://badge.fury.io/js/%40rapideditor%2Flocation-conflation) | ||
|
||
|
||
# location-conflation | ||
|
@@ -15,7 +15,7 @@ including and excluding other locations and shapes. | |
It is useful for generating geofences in a declarative way, so your application doesn't need | ||
to bundle or fetch so much geodata. | ||
|
||
⚡️ Try it now!: https://ideditor.github.io/location-conflation/ | ||
⚡️ Try it now!: https://location-conflation.com/ | ||
|
||
|
||
You can define a *locationSet* as an Object with `include` and `exclude` properties: | ||
|
@@ -28,7 +28,7 @@ const locationSet = { | |
|
||
The "locations" can be any of the following: | ||
|
||
- Strings recognized by the [country-coder library](https://github.com/ideditor/country-coder#readme).<br/> | ||
- Strings recognized by the [country-coder library](https://github.com/rapideditor/country-coder#readme).<br/> | ||
These include [ISO 3166-1 2 or 3 letter country codes](https://en.wikipedia.org/wiki/List_of_countries_by_United_Nations_geoscheme), [UN M.49 numeric codes](https://en.wikipedia.org/wiki/UN_M49), and supported Wikidata QIDs.<br/> | ||
_Examples: `"de"`, `"001"`, `"conus"`, `"gb-sct"`, `"Q620634"`_<br/> | ||
👉 A current list of supported codes can be found at <https://ideditor.codes> | ||
|
@@ -46,15 +46,15 @@ The "locations" can be any of the following: | |
|
||
### Use in Node | ||
|
||
`npm install @ideditor/location-conflation` | ||
`npm install @rapideditor/location-conflation` | ||
|
||
**location-conflation** is distributed in CJS and ESM module formats for maxmimum compatibility. ([Read more about Javascript module formats](https://dev.to/iggredible/what-the-heck-are-cjs-amd-umd-and-esm-ikm)) | ||
|
||
|
||
```js | ||
const LocationConflation = require('@ideditor/location-conflation').default; // require CJS | ||
const LocationConflation = require('@rapideditor/location-conflation').default; // require CJS | ||
// or | ||
import LocationConflation from '@ideditor/location-conflation'; // import ESM | ||
import LocationConflation from '@rapideditor/location-conflation'; // import ESM | ||
``` | ||
|
||
|
||
|
@@ -65,7 +65,7 @@ You can also use **location-conflation** directly in a web browser. A good way | |
When you load this file in a `<script>` tag, you'll get a `LocationConflation` global to use elsewhere in your scripts: | ||
```html | ||
<head> | ||
<script src="https://cdn.jsdelivr.net/npm/@ideditor/[email protected]/dist/location-conflation.iife.min.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/@rapideditor/[email protected]/dist/location-conflation.iife.min.js"></script> | ||
</head> | ||
… | ||
<script> | ||
|
@@ -80,7 +80,7 @@ When you load this file in a `<script>` tag, you'll get a `LocationConflation` g | |
|
||
## Examples | ||
```js | ||
const LocationConflation = require('@ideditor/location-conflation').default; | ||
const LocationConflation = require('@rapideditor/location-conflation').default; | ||
const myFeatures = require('./path/to/FeatureCollection.json'); // optional | ||
const loco = new LocationConflation(myFeatures); | ||
``` | ||
|
@@ -90,30 +90,30 @@ const loco = new LocationConflation(myFeatures); | |
const locationSet = { include: ['039'] }; // 039 = Southern Europe | ||
const result = loco.resolveLocationSet(locationSet); | ||
``` | ||
<img width="800px" alt="Southern Europe" src="https://raw.githubusercontent.com/ideditor/location-conflation/main/docs/images/example1.png"/> | ||
<img width="800px" alt="Southern Europe" src="https://raw.githubusercontent.com/rapideditor/location-conflation/main/docs/images/example1.png"/> | ||
|
||
|
||
#### Southern Europe and Northern Africa: | ||
```js | ||
const locationSet = { include: ['039','015'] }; // 015 = Northern Africa | ||
const result = loco.resolveLocationSet(locationSet); | ||
``` | ||
<img width="800px" alt="Southern Europe and Northern Africa" src="https://raw.githubusercontent.com/ideditor/location-conflation/main/docs/images/example2.png"/> | ||
<img width="800px" alt="Southern Europe and Northern Africa" src="https://raw.githubusercontent.com/rapideditor/location-conflation/main/docs/images/example2.png"/> | ||
|
||
|
||
#### Southern Europe and Northern Africa, _excluding_ Egypt and Sudan: | ||
```js | ||
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://raw.githubusercontent.com/ideditor/location-conflation/main/docs/images/example3.png"/> | ||
<img width="800px" alt="Southern Europe and Northern Africa, excluding Egypt and Sudan" src="https://raw.githubusercontent.com/rapideditor/location-conflation/main/docs/images/example3.png"/> | ||
|
||
|
||
#### The Alps, _excluding_ Liechtenstein and regions around Bern and Zürich | ||
```js | ||
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://raw.githubusercontent.com/ideditor/location-conflation/main/docs/images/example4.png"/> | ||
<img width="800px" alt="The Alps, excluding Liechtenstein and regions around Bern and Zürich" src="https://raw.githubusercontent.com/rapideditor/location-conflation/main/docs/images/example4.png"/> | ||
|
||
|
||
| ||
|
@@ -157,7 +157,7 @@ Each feature *must* have a filename-like `id`, for example: `new_jersey.geojson` | |
<a name="validateLocation" href="#validateLocation">#</a> <i>loco</i>.<b>validateLocation</b>(<i>location</i>) | ||
|
||
Validates a given location. The "locations" can be: | ||
- Strings recognized by the [country-coder library](https://github.com/ideditor/country-coder#readme). <br/> | ||
- Strings recognized by the [country-coder library](https://github.com/rapideditor/country-coder#readme). <br/> | ||
👉 A current list of supported codes can be found at <https://ideditor.codes><br/> | ||
_Examples: `"de"`, `"001"`, `"conus"`, `"gb-sct"`, `"Q620634"`_ | ||
|
||
|
@@ -295,7 +295,7 @@ Convenience method to access the internal feature `_cache`. You probably should | |
### Installing | ||
|
||
* Clone this project, for example: | ||
`git clone [email protected]:ideditor/location-conflation.git` | ||
`git clone [email protected]:rapideditor/location-conflation.git` | ||
* `cd` into the project folder, | ||
* Run `npm install` to install libraries | ||
|
||
|
@@ -308,7 +308,7 @@ Convenience method to access the internal feature `_cache`. You probably should | |
### Thanks! | ||
|
||
**location-conflation** is really just a wrapper around these other great projects: | ||
* [country-coder](https://github.com/ideditor/country-coder) for world boundaries, and | ||
* [country-coder](https://github.com/rapideditor/country-coder) for world boundaries, and | ||
* [polygon-clipping](https://github.com/mfogel/polygon-clipping) for union/difference functions | ||
|
||
|
||
|
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 |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v1.13.1/mapbox-gl.js'></script> | ||
<script defer src='https://kit.fontawesome.com/c772610440.js' crossorigin='anonymous'></script> | ||
<script defer src='https://cdn.jsdelivr.net/npm/[email protected]/dist/index.min.js'></script> | ||
<script defer src='https://cdn.jsdelivr.net/npm/@ideditor/[email protected]/dist/location-conflation.iife.min.js'></script> | ||
<script defer src='https://cdn.jsdelivr.net/npm/@rapideditor/[email protected]/dist/location-conflation.iife.min.js'></script> | ||
<!-- <script defer src='../dist/location-conflation.iife.js'></script> --> | ||
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v1.13.1/mapbox-gl.css' rel='stylesheet'/> | ||
<link href='style.css' rel='stylesheet' type='text/css'/> | ||
|
@@ -29,7 +29,7 @@ | |
<div id='sidebar' class='hasRows'> | ||
|
||
<div id='loco' class='section'> | ||
<p>Paste a locationSet:<a href='https://github.com/ideditor/location-conflation/blob/main/README.md#location-conflation' target='_blank' style='font-size: smaller; margin-left: 70px'>What's this?</a></p> | ||
<p>Paste a locationSet:<a href='https://github.com/rapideditor/location-conflation/blob/main/README.md#location-conflation' target='_blank' style='font-size: smaller; margin-left: 70px'>What's this?</a></p> | ||
<textarea autofocus id='loco-textarea' name='loco-textarea' rows='5'> | ||
{ include: ['de', 'cz', 'pl'] } | ||
</textarea> | ||
|
@@ -67,7 +67,7 @@ <h3>Try these!</h3> | |
<div class='icon'><i class='fas fa-file-code fa-lg'></i></div> | ||
</div> | ||
<div id='octocat'> | ||
<a href='https://github.com/ideditor/location-conflation' target='_blank'> | ||
<a href='https://github.com/rapideditor/location-conflation' target='_blank'> | ||
<i class='fab fa-github fa-2x'></i> | ||
</a> | ||
</div> | ||
|
@@ -201,7 +201,7 @@ <h3>Try these!</h3> | |
} else if (qs.referrer === 'nsi') { | ||
_fcPromise = fetch('https://cdn.jsdelivr.net/gh/osmlab/name-suggestion-index@main/dist/featureCollection.min.json'); | ||
} else if (qs.referrer === 'ii') { | ||
_fcPromise = fetch('https://cdn.jsdelivr.net/gh/ideditor/imagery-index@main/dist/featureCollection.min.json'); | ||
_fcPromise = fetch('https://cdn.jsdelivr.net/gh/rapideditor/imagery-index@main/dist/featureCollection.min.json'); | ||
} else { | ||
_fcPromise = Promise.resolve({ ok: true, json: function() { return {}; } }); // fake response | ||
} | ||
|
@@ -397,8 +397,8 @@ <h3>Try these!</h3> | |
} | ||
|
||
// Display the emoji flag | ||
// https://github.com/ideditor/country-coder/issues/25 | ||
// https://github.com/ideditor/country-coder/issues/26 | ||
// https://github.com/rapideditor/country-coder/issues/25 | ||
// https://github.com/rapideditor/country-coder/issues/26 | ||
var overrideFlag = { | ||
Q21: '🏴', // GB-ENG (England) | ||
Q22: '🏴', // GB-SCT (Scotland) | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
{ | ||
"name": "@ideditor/location-conflation", | ||
"version": "1.1.0", | ||
"name": "@rapideditor/location-conflation", | ||
"version": "1.2.0", | ||
"license": "ISC", | ||
"repository": "github:ideditor/location-conflation", | ||
"repository": "github:rapideditor/location-conflation", | ||
"contributors": [ | ||
"Bryan Housel <[email protected]> (https://github.com/bhousel)" | ||
], | ||
|
@@ -39,16 +39,16 @@ | |
}, | ||
"dependencies": { | ||
"@aitodotai/json-stringify-pretty-compact": "^1.3.0", | ||
"@ideditor/country-coder": "^5.1.0", | ||
"@mapbox/geojson-area": "^0.2.2", | ||
"@rapideditor/country-coder": "^5.2.0", | ||
"circle-to-polygon": "^2.2.0", | ||
"geojson-precision": "^1.0.0", | ||
"polygon-clipping": "~0.15.3" | ||
}, | ||
"devDependencies": { | ||
"c8": "^7.13.0", | ||
"esbuild": "^0.17.10", | ||
"eslint": "^8.35.0", | ||
"esbuild": "^0.17.11", | ||
"eslint": "^8.36.0", | ||
"npm-run-all": "^4.1.5", | ||
"shx": "^0.3.4", | ||
"tap": "^16.3.4" | ||
|