Main OverpassQL webpack loader function.
+Main OverpassQL webpack loader function.
the webpack loader context
OverpassQL content
-Consumes OverpassQL source content and transforms it into a +
when this
(loader context) is not provided
The default OpenStreetMaps properties and tags filter. +
The default OpenStreetMaps properties and tags filter. This removes everything but names and addresses.
-Key-value object containing OpenStreetMap tags
+Helper function to determine whether an object contains OpenStreetMaps +
Helper function to determine whether an object is a real traversible +
Helper function to process OpenStreetMaps GeoJSON with the supplied filter +
Helper function to process OpenStreetMaps GeoJSON with the supplied filter function. Scans the entire object at multiple levels for filtering.
OpenStreetMaps GeoJSON object
-Optional
filter: PropertiesFilterfiltering function
+Optional
filter: PropertiesFilterfiltering function
OpenStreetMaps GeoJSON object after filtering with the function
-This Webpack loader allows you to pull in OverpassQL files as strings, providing seamless integration of OpenStreetMap data into your application.
@@ -23,58 +22,63 @@You can install the loader using npm
, yarn
, or your preferred JavaScript
+
You can install the loader using npm
, yarn
, or your preferred JavaScript
package management program.
yarn add --dev overpassql-loader
-
+yarn add --dev overpassql-loader
+
+
or
-npm install --save-dev overpassql-loader
-
-Add overpassql-loader
to your Webpack configuration:
import type { Configuration, RuleSetUse } from 'webpack';
import type { PropertiesFilter } from 'overpassql-loader';
const IS_DEV: boolean = (process.env.NODE_ENV === 'development');
const propertiesFilter: PropertiesFilter = (properties) => ({
return (Object.keys(properties)
.filter(tag => /addr:.*/i.test(tag))
.reduce((filtered, tag) => {
filtered[tag] = properties[tag];
return filtered;
}, {}));
});
const useOverpassql: RuleSetUse = {
test: /\.overpass(ql)?$/,
options: {
// minify the query
stripWhitespace: !IS_DEV,
stripComments: !IS_DEV,
// cache API response
cacheGeoJSON: !IS_DEV,
// remove tags we're not interested in
keepProperties: false,
propertiesFilter
}
}
export const config: Configuration = {
module: {
rules: [useOverpassql]
}
}
-
+npm install --save-dev overpassql-loader
+
+
+Add overpassql-loader
to your Webpack configuration:
import type { Configuration, RuleSetUse } from 'webpack';
import type { PropertiesFilter } from 'overpassql-loader';
const IS_DEV: boolean = (process.env.NODE_ENV === 'development');
const propertiesFilter: PropertiesFilter = (properties) => ({
return (Object.keys(properties)
.filter(tag => /addr:.*/i.test(tag))
.reduce((filtered, tag) => {
filtered[tag] = properties[tag];
return filtered;
}, {}));
});
const useOverpassql: RuleSetUse = {
test: /\.overpass(ql)?$/,
options: {
// minify the query
stripWhitespace: !IS_DEV,
stripComments: !IS_DEV,
// cache API response
cacheGeoJSON: !IS_DEV,
// remove tags we're not interested in
keepProperties: false,
propertiesFilter
}
}
export const config: Configuration = {
module: {
rules: [useOverpassql]
}
}
+
+
Use the import
in your project:
import { overpassJson } from 'overpass-ts';
import osmtogeojson from 'osmtogeojson';
import query from './my-query.overpassql';
const endpoint: string = 'https://overpass-api.de/api/interpreter';
console.log(query); // print the query to console
overpassJson(query, { endpoint }).then((osmdata) => {
const geoJSON = osmtogeojson(osmdata);
// work with the GeoJSON or OSM response
// e.g., integrate with Leaflet.js GeoJSON layers
});
-
-The following procedure for contributing changes is recommended:
+import { overpassJson } from 'overpass-ts';
import osmtogeojson from 'osmtogeojson';
import query from './my-query.overpassql';
const endpoint: string = 'https://overpass-api.de/api/interpreter';
console.log(query); // print the query to console
overpassJson(query, { endpoint }).then((osmdata) => {
const geoJSON = osmtogeojson(osmdata);
// work with the GeoJSON or OSM response
// e.g., integrate with Leaflet.js GeoJSON layers
});
+
+
+The following procedure for contributing changes is recommended:
fix/[issue or description]
, feature/[issue or description]
, ...Of course, you're welcome to use any reasonable workflow that best suits your +
Of course, you're welcome to use any reasonable workflow that best suits your style. After all, I committed to unprotected main throughout this project.
Please add any of the following strings to your commit message if the commit does not modify any code (e.g., documentation work):
[skip ci]
, [ci skip]
, [no ci]
, [skip actions]
, [actions skip]
See: GitHub documentation, "skipping workflow runs"
-To bump versions:
-yarn version --patch
yarn version --minor
yarn version --major
-
-Given this project is licensed under the MIT License, please be mindful that +
To bump versions:
+yarn version --patch
yarn version --minor
yarn version --major
+
+
+Given this project is licensed under the MIT License, please be mindful that your contributions will fall under the same licensing scheme.
-The following projects are core to the function of OverpassQL Loader. +
The following projects are core to the function of OverpassQL Loader. They are worth checking out. The authors have my thanks. :-)
-+overpass-ts
-promise-based overpass api client in typescript
osmtogeojson
+osmtogeojson
-Converts OSM data to GeoJSON.
License
This project is licensed under the MIT License. +
License
This project is licensed under the MIT License. See
-LICENSE
for more information.
OverpassQL Loader options.
-Optional
cachePreload and cache the Overpass API response from the query. +
OverpassQL Loader options.
+Optional
cachePreload and cache the Overpass API response from the query.
Connects to the Overpass API specified in endpoint
to execute
the query and cache the GeoJSON response in the rendered module.
Optional
esEmit an ES-style module. -(e.g. 'export default' instead of 'module.exports =')
-Optional
keepAvoid clobbering properties when caching the GeoJSON response from the +
Optional
esEmit an ES-style module. +(e.g. 'export default' instead of 'module.exports =')
+Optional
keepAvoid clobbering properties when caching the GeoJSON response from the Overpass API.
The value has no effect when cacheGeoJSON
is not set or set to false.
Optional
osmtogeojsonOptions to pass through to the "osmtogeojson" package.
-"osmtogeojson" package: +
Optional
osmtogeojsonOptions to pass through to the "osmtogeojson" package.
+"osmtogeojson" package: https://github.com/tyrasd/osmtogeojson https://www.npmjs.com/package/osmtogeojson
The value has no effect when cacheGeoJSON
is not set or set to false.
Optional
overpassOptions to pass through to the Overpass API handler (e.g. "overpass-ts").
-"overpass-ts" package: +
Optional
overpassOptions to pass through to the Overpass API handler (e.g. "overpass-ts").
+"overpass-ts" package: https://www.npmjs.com/package/overpass-ts
-Optional
propertiesFunction to clobber properties (e.g. to remove or keep them).
+Optional
propertiesFunction to clobber properties (e.g. to remove or keep them).
The value has no effect when cacheGeoJSON
is not set or set to false.
The value has no effect when keepProperties
is set to true.
Optional
simplificationTolerance value for shape simplification. +
Optional
simplificationTolerance value for shape simplification. Function uses the "simplify-geojson" package: https://www.npmjs.com/package/simplify-geojson https://github.com/maxogden/simplify-geojson
-Optional
stripRemove comments to save space. +
Optional
stripRemove comments to save space. The function to strip comments will respect "@preserve" directives.
-Optional
stripRemove redundant whitespace to save space.
-Optional
stripRemove redundant whitespace to save space.
+Const
Maximum permissible content size, measured in number of characters, to +
Const
Maximum permissible content size, measured in number of characters, to prevent occurrences of ReDoS (Regular expression Denial of Service).
-
API function for Overpass JSON responses. +
- Preparing search index...
- The search index is not available
OverpassQL LoaderFunction api
API function for Overpass JSON responses. Useful if you want to implement your own way of doing it. :-)
-Parameters
Optional
opts: Partial<OverpassOptions>Returns Promise<OverpassJson>
Settings
Member Visibility
Theme