Releases: Outdooractive/mvt-tools
v1.8.5
Added near(latitude,longitude,tolerance)
to the query language.
Examples:
// Features around a coordinate
mvt query -p 14_8716_8015.vector.mvt "near(3.87324,11.53731,1000)"
// With other conditions
mvt query -p 14_8716_8015.vector.mvt ".name =~ /^lac/i and near(3.87324,11.53731,10000)"
v1.8.4
The command line tool (and the library) can now filter by property.
The query language is loosely modeled after the jq query language. Here is an overview.
Example:
"properties": {
"foo": {"bar": 1},
"some": ["a", "b"],
"value": 1,
"string": "Some name"
}
Values are retrieved by putting a .
in front of the property name. The property name must be quoted if it is a number or contains any non-alphabetic characters. Elements in arrays can be accesses either by simply using the array index after the dot, or by wrapping it in brackets.
.foo // true, property "foo" exists
.foo.bar // true, property "foo" is a dictionary containing "bar"
."foo"."bar" // true, same as above but quoted
.foo.x // false, "foo" doesn't contain "x"
."foo.bar" // false, property "foo.bar" doesn't exist
.foo.[0] // false, "foo" is not an array
.some.[0] // true, "some" is an array and has an element at index "0"
.some.0 // true, same as above but without brackets
.some."0" // false, "0" is a string key but "some" is not a dictionary
Comparisons can be expressed like this:
.value == "bar" // false
.value == 1 // true
.value != 1 // false
.value > 1 // false
.value >= 1 // true
.value < 1 // false
.value <= 1 // true
.string =~ /[Ss]ome/ // true
.string =~ /some/ // false
.string =~ /some/i // true, case insensitive
.string =~ "^Some" // true
Conditions (evaluated left to right):
.foo.bar == 1 and .value == 1 // true
.foo == 1 or .bar == 2 // false
.foo == 1 or .value == 1 // true
.foo not // true if foo does not exist
.foo and .bar not // true if foo and bar don't exist together
.foo or .bar not // true if neither foo nor bar exist
.foo.bar not // true if "bar" in dictionary "foo" doesn't exist
Examples:
// Can use single quotes for strings
mvt query -p 14_8716_8015.vector.mvt ".area > 20000 and .class == 'hospital'"
// ... or double quotes, but they must be escaped
mvt query -p 14_8716_8015.vector.mvt ".area > 20000 and .class == \"hospital\""
// No need to quote the query if it doesn't conflict with your shell
// Print all features that have an "area" property
mvt query -p 14_8716_8015.vector.mvt .area
// Features which don't have "area" and "name" properties
mvt query -p 14_8716_8015.vector.mvt .area and .name not
// Case insensitive regular expression
vt query -p 14_8716_8015.vector.mvt ".name =~ /hopital/i"
// Case sensitive regular expression
mvt query -p 14_8716_8015.vector.mvt ".name =~ /Recherches?/"
// Can also use quotes instead of slashes
mvt query -p 14_8716_8015.vector.mvt ".name =~ 'Recherches?'"
v1.8.3
v1.8.2
v1.8.1
Some commands in the mvt
command line tool got some new export/output options:
-oC, --compression-level <oC>
Output file compression level, between 0=none to 9=best.
-oBe, --buffer-extents <oBe>
Output buffer extents for tiles of size 4096.
-oBp, --buffer-pixels <oBp>
Output buffer pixels for tiles of size 256. Overrides 'buffer-extents'.
-oSe, --simplify-extents <oSe>
Simplify output features using tile extents.
-oSm, --simplify-meters <oSm>
Simplify output features using meters. Overrides 'simplify-extents'.
v1.8.0
The command line tool got a complete overhaul. It now works with GeoJSONs and vector tiles and got many new options.
Note: Some commands might behave differently now, please check your scripts.
dump
: Pretty-prints any GeoJSON or vector tile to the consoleinfo
: Print some information about GeoJSONs or vector tiles like Feature counts and propertiesquery
: Query feature properties or perform a search around a coordinatemerge
: Merge any number of GeoJSONs or vector tiles into a GeoJSON or vector tileimport
: Import GeoJSONs into a vector tileexport
: Export a vector tile as GeoJSON
GeoJSONs can contain a layer name in their Feature properties (default name is vt_layer
), and any resulting GeoJSON will automatically include this property.
This can be controlled with the options --property-name
(or -P
), --disable-input-layer-property
(or -Di
) and --disable-output-layer-property
(or -Do
).
Some commands allow limiting the result to certain layers with --layer
(or -l
), which can be repeated for as many layers as necessary.
v1.7.1
v1.7.0
v1.6.2
v1.4.0
Switch from Int ids to UInt ids if overflow happens and the id is not negative (Outdooractive/gis-tools#45) (Thanks @JeffLutzenberger!)