serde_esri
Esri JSON parsing library.
This crate provides representations of Esri JSON objects with serde::Deserialize and serde::Serialize trait implementations.
serde_esri has two additional features geo and geoarrow.
geoimplementsFromfor the Esri JSON objects.geoarrowprovides compatibility with arrow and geoarrow by implementing geoarrow geometry traits as well as providing a utility functionfeatureset_to_geoarrow()which converts aFeatureSetto an arrowGeoTable.
Example usage:
This example reads a few features from a feature service and returns a FeatureSet struct. It illustrates the use of the geo and geoarrow features.
[]
= "0.28.0"
= "0.2.0"
= { = "0.12.3", = ["blocking"] }
= { = "0.2.0", = ["geo", "geoarrow"] }
= "1.0.115"
use ;
use featureset_to_geoarrow;
use FeatureSet;
use Read;
Supported Esri JSON objects:
Geometry
Esri Geometries Objects are encoded by the following structs:
EsriPointEsriMultiPoint<N>EsriPolyline<N>EsriPolygon<N>EsriEnvelope
They are encapsulated by the EsriGeometry enum:
The parameter N is used to specify the dimension of the geometries. Use <2> for 2 dimensional data, <3> for Z values and <4> when M and Z are present.
FeatureSets
An Esri JSON FeatureSet is what is most commonly returned from a Feature Service. It is comprised of a number of optional fields and most importantly, a vector of Features.
Features are a struct with a geometry and an attributes field. The geometry must be one of the possible geometry types and attributes can be an key-value pair.
FeatureSets are defined as
Spatial References
Esri Spatial Reference Objects are represented by the SpatialReference struct. Note that while all fields are optional, one should always be provided.