# Elements ## Query features by spatial predicate, bounding box, or H3 cell `FeatureCollection Elements.Query(ElementQueryParams?parameters, CancellationTokencancellationToken = default)` **get** `/api/v1/features` Query features by spatial predicate, bounding box, or H3 cell ### Parameters - `ElementQueryParams parameters` - `string bbox` Legacy shorthand. Bounding box: south,west,north,east. Use spatial predicates (near, within, intersects) instead. - `string contains` Geometry that features must contain - `string crosses` Geometry that features must cross - `string cursor` Cursor for pagination - `string h3` Legacy shorthand. H3 cell index. Use spatial predicates instead. - `string intersects` Geometry that features must intersect - `Long limit` Maximum results (default 100, max 10000) - `string near` Point geometry for proximity search (lat,lng). Requires radius. - `Double outputBuffer` Buffer geometry by meters - `Boolean outputCentroid` Replace geometry with centroid - `string outputFields` Comma-separated property fields to include - `Boolean outputGeometry` Include geometry (default true) - `string outputInclude` Extra computed fields: bbox, distance, center - `Long outputPrecision` Coordinate decimal precision (1-15, default 7) - `Double outputSimplify` Simplify geometry tolerance in meters - `string outputSort` Sort by: distance, name, osm_id - `Double radius` Search radius in meters (for near) or buffer distance (for other predicates) - `string touches` Geometry that features must touch - `string type` Element types (comma-separated: node,way,relation) - `string within` Geometry that features must be within ### Returns - `class FeatureCollection:` GeoJSON FeatureCollection (RFC 7946). For paginated endpoints, metadata is returned in HTTP response headers rather than the body: | Header | Description | | --------------- | ------------------------------------------------ | | `X-Limit` | Requested result limit | | `X-Has-More` | `true` if more results exist | | `X-Next-Cursor` | Opaque cursor for next page (cursor pagination) | | `X-Next-Offset` | Numeric offset for next page (offset pagination) | | `Link` | RFC 8288 `rel="next"` link to the next page | Content-Type is `application/geo+json`. - `required IReadOnlyList Features` Array of GeoJSON Feature objects - `required GeoJsonGeometry Geometry` GeoJSON Geometry object per RFC 7946. Coordinates use [longitude, latitude] order. 3D coordinates [lng, lat, elevation] are used for elevation endpoints. - `required Coordinates Coordinates` Coordinates array. Nesting depth varies by geometry type: Point = [lng, lat], LineString = [[lng, lat], ...], Polygon = [[[lng, lat], ...], ...], etc. - `IReadOnlyList` - `IReadOnlyList>` - `IReadOnlyList>>` - `IReadOnlyList>>>` - `required Type Type` Geometry type - `"Point"Point` - `"LineString"LineString` - `"Polygon"Polygon` - `"MultiPoint"MultiPoint` - `"MultiLineString"MultiLineString` - `"MultiPolygon"MultiPolygon` - `required IReadOnlyDictionary Properties` OSM tags flattened as key-value pairs, plus `@type` (node/way/relation) and `@id` (OSM ID) metadata fields. May include `distance_m` for proximity queries. - `required Type Type` Always `Feature` - `"Feature"Feature` - `string ID` Compound identifier in `type/osm_id` format - `required Type Type` Always `FeatureCollection` - `"FeatureCollection"FeatureCollection` ### Example ```csharp ElementQueryParams parameters = new(); var featureCollection = await client.Elements.Query(parameters); Console.WriteLine(featureCollection); ``` #### Response ```json { "features": [ { "geometry": { "coordinates": [ 2.3522, 48.8566 ], "type": "Point" }, "properties": { "@id": "bar", "@type": "bar", "amenity": "bar", "cuisine": "bar", "name": "bar" }, "type": "Feature", "id": "node/21154906" } ], "type": "FeatureCollection" } ``` ## Query features by spatial predicate, bounding box, or H3 cell `FeatureCollection Elements.QueryPost(ElementQueryPostParams?parameters, CancellationTokencancellationToken = default)` **post** `/api/v1/features` Query features by spatial predicate, bounding box, or H3 cell ### Parameters - `ElementQueryPostParams parameters` - `string bbox` Legacy shorthand. Bounding box: south,west,north,east. Use spatial predicates (near, within, intersects) instead. - `string contains` Geometry that features must contain - `string crosses` Geometry that features must cross - `string cursor` Cursor for pagination - `string h3` Legacy shorthand. H3 cell index. Use spatial predicates instead. - `string intersects` Geometry that features must intersect - `Long limit` Maximum results (default 100, max 10000) - `string near` Point geometry for proximity search (lat,lng). Requires radius. - `Double outputBuffer` Buffer geometry by meters - `Boolean outputCentroid` Replace geometry with centroid - `string outputFields` Comma-separated property fields to include - `Boolean outputGeometry` Include geometry (default true) - `string outputInclude` Extra computed fields: bbox, distance, center - `Long outputPrecision` Coordinate decimal precision (1-15, default 7) - `Double outputSimplify` Simplify geometry tolerance in meters - `string outputSort` Sort by: distance, name, osm_id - `Double radius` Search radius in meters (for near) or buffer distance (for other predicates) - `string touches` Geometry that features must touch - `string type` Element types (comma-separated: node,way,relation) - `string within` Geometry that features must be within ### Returns - `class FeatureCollection:` GeoJSON FeatureCollection (RFC 7946). For paginated endpoints, metadata is returned in HTTP response headers rather than the body: | Header | Description | | --------------- | ------------------------------------------------ | | `X-Limit` | Requested result limit | | `X-Has-More` | `true` if more results exist | | `X-Next-Cursor` | Opaque cursor for next page (cursor pagination) | | `X-Next-Offset` | Numeric offset for next page (offset pagination) | | `Link` | RFC 8288 `rel="next"` link to the next page | Content-Type is `application/geo+json`. - `required IReadOnlyList Features` Array of GeoJSON Feature objects - `required GeoJsonGeometry Geometry` GeoJSON Geometry object per RFC 7946. Coordinates use [longitude, latitude] order. 3D coordinates [lng, lat, elevation] are used for elevation endpoints. - `required Coordinates Coordinates` Coordinates array. Nesting depth varies by geometry type: Point = [lng, lat], LineString = [[lng, lat], ...], Polygon = [[[lng, lat], ...], ...], etc. - `IReadOnlyList` - `IReadOnlyList>` - `IReadOnlyList>>` - `IReadOnlyList>>>` - `required Type Type` Geometry type - `"Point"Point` - `"LineString"LineString` - `"Polygon"Polygon` - `"MultiPoint"MultiPoint` - `"MultiLineString"MultiLineString` - `"MultiPolygon"MultiPolygon` - `required IReadOnlyDictionary Properties` OSM tags flattened as key-value pairs, plus `@type` (node/way/relation) and `@id` (OSM ID) metadata fields. May include `distance_m` for proximity queries. - `required Type Type` Always `Feature` - `"Feature"Feature` - `string ID` Compound identifier in `type/osm_id` format - `required Type Type` Always `FeatureCollection` - `"FeatureCollection"FeatureCollection` ### Example ```csharp ElementQueryPostParams parameters = new(); var featureCollection = await client.Elements.QueryPost(parameters); Console.WriteLine(featureCollection); ``` #### Response ```json { "features": [ { "geometry": { "coordinates": [ 2.3522, 48.8566 ], "type": "Point" }, "properties": { "@id": "bar", "@type": "bar", "amenity": "bar", "cuisine": "bar", "name": "bar" }, "type": "Feature", "id": "node/21154906" } ], "type": "FeatureCollection" } ``` ## Get feature by type and ID `GeoJsonFeature Elements.Retrieve(ElementRetrieveParamsparameters, CancellationTokencancellationToken = default)` **get** `/api/v1/features/{type}/{id}` Get feature by type and ID ### Parameters - `ElementRetrieveParams parameters` - `required string type` Element type (node, way, relation) - `required Long id` OSM ID ### Returns - `class GeoJsonFeature:` GeoJSON Feature representing an OSM element. Tags from the original OSM element are flattened directly into `properties` (not nested under a `tags` key). Metadata fields `@type` and `@id` identify the OSM element type and ID within properties. - `required GeoJsonGeometry Geometry` GeoJSON Geometry object per RFC 7946. Coordinates use [longitude, latitude] order. 3D coordinates [lng, lat, elevation] are used for elevation endpoints. - `required Coordinates Coordinates` Coordinates array. Nesting depth varies by geometry type: Point = [lng, lat], LineString = [[lng, lat], ...], Polygon = [[[lng, lat], ...], ...], etc. - `IReadOnlyList` - `IReadOnlyList>` - `IReadOnlyList>>` - `IReadOnlyList>>>` - `required Type Type` Geometry type - `"Point"Point` - `"LineString"LineString` - `"Polygon"Polygon` - `"MultiPoint"MultiPoint` - `"MultiLineString"MultiLineString` - `"MultiPolygon"MultiPolygon` - `required IReadOnlyDictionary Properties` OSM tags flattened as key-value pairs, plus `@type` (node/way/relation) and `@id` (OSM ID) metadata fields. May include `distance_m` for proximity queries. - `required Type Type` Always `Feature` - `"Feature"Feature` - `string ID` Compound identifier in `type/osm_id` format ### Example ```csharp ElementRetrieveParams parameters = new() { Type = "type", ID = 0, }; var geoJsonFeature = await client.Elements.Retrieve(parameters); Console.WriteLine(geoJsonFeature); ``` #### Response ```json { "geometry": { "coordinates": [ 2.3522, 48.8566 ], "type": "Point" }, "properties": { "@id": "bar", "@type": "bar", "amenity": "bar", "cuisine": "bar", "name": "bar" }, "type": "Feature", "id": "node/21154906" } ``` ## Get feature by type and ID `GeoJsonFeature Elements.Lookup(ElementLookupParams?parameters, CancellationTokencancellationToken = default)` **post** `/api/v1/features/lookup` Get feature by type and ID ### Parameters - `ElementLookupParams parameters` ### Returns - `class GeoJsonFeature:` GeoJSON Feature representing an OSM element. Tags from the original OSM element are flattened directly into `properties` (not nested under a `tags` key). Metadata fields `@type` and `@id` identify the OSM element type and ID within properties. - `required GeoJsonGeometry Geometry` GeoJSON Geometry object per RFC 7946. Coordinates use [longitude, latitude] order. 3D coordinates [lng, lat, elevation] are used for elevation endpoints. - `required Coordinates Coordinates` Coordinates array. Nesting depth varies by geometry type: Point = [lng, lat], LineString = [[lng, lat], ...], Polygon = [[[lng, lat], ...], ...], etc. - `IReadOnlyList` - `IReadOnlyList>` - `IReadOnlyList>>` - `IReadOnlyList>>>` - `required Type Type` Geometry type - `"Point"Point` - `"LineString"LineString` - `"Polygon"Polygon` - `"MultiPoint"MultiPoint` - `"MultiLineString"MultiLineString` - `"MultiPolygon"MultiPolygon` - `required IReadOnlyDictionary Properties` OSM tags flattened as key-value pairs, plus `@type` (node/way/relation) and `@id` (OSM ID) metadata fields. May include `distance_m` for proximity queries. - `required Type Type` Always `Feature` - `"Feature"Feature` - `string ID` Compound identifier in `type/osm_id` format ### Example ```csharp ElementLookupParams parameters = new(); var geoJsonFeature = await client.Elements.Lookup(parameters); Console.WriteLine(geoJsonFeature); ``` #### Response ```json { "geometry": { "coordinates": [ 2.3522, 48.8566 ], "type": "Point" }, "properties": { "@id": "bar", "@type": "bar", "amenity": "bar", "cuisine": "bar", "name": "bar" }, "type": "Feature", "id": "node/21154906" } ``` ## Fetch multiple features by type and ID `FeatureCollection Elements.Batch(ElementBatchParamsparameters, CancellationTokencancellationToken = default)` **post** `/api/v1/features/batch` Fetch multiple features by type and ID ### Parameters - `ElementBatchParams parameters` - `required IReadOnlyList elements` Array of element references to fetch - `required Long ID` OSM element ID - `required Type Type` OSM element type - `"node"Node` - `"way"Way` - `"relation"Relation` ### Returns - `class FeatureCollection:` GeoJSON FeatureCollection (RFC 7946). For paginated endpoints, metadata is returned in HTTP response headers rather than the body: | Header | Description | | --------------- | ------------------------------------------------ | | `X-Limit` | Requested result limit | | `X-Has-More` | `true` if more results exist | | `X-Next-Cursor` | Opaque cursor for next page (cursor pagination) | | `X-Next-Offset` | Numeric offset for next page (offset pagination) | | `Link` | RFC 8288 `rel="next"` link to the next page | Content-Type is `application/geo+json`. - `required IReadOnlyList Features` Array of GeoJSON Feature objects - `required GeoJsonGeometry Geometry` GeoJSON Geometry object per RFC 7946. Coordinates use [longitude, latitude] order. 3D coordinates [lng, lat, elevation] are used for elevation endpoints. - `required Coordinates Coordinates` Coordinates array. Nesting depth varies by geometry type: Point = [lng, lat], LineString = [[lng, lat], ...], Polygon = [[[lng, lat], ...], ...], etc. - `IReadOnlyList` - `IReadOnlyList>` - `IReadOnlyList>>` - `IReadOnlyList>>>` - `required Type Type` Geometry type - `"Point"Point` - `"LineString"LineString` - `"Polygon"Polygon` - `"MultiPoint"MultiPoint` - `"MultiLineString"MultiLineString` - `"MultiPolygon"MultiPolygon` - `required IReadOnlyDictionary Properties` OSM tags flattened as key-value pairs, plus `@type` (node/way/relation) and `@id` (OSM ID) metadata fields. May include `distance_m` for proximity queries. - `required Type Type` Always `Feature` - `"Feature"Feature` - `string ID` Compound identifier in `type/osm_id` format - `required Type Type` Always `FeatureCollection` - `"FeatureCollection"FeatureCollection` ### Example ```csharp ElementBatchParams parameters = new() { Elements = [ new() { ID = 21154906, Type = Type.Node, }, new() { ID = 4589123, Type = Type.Way, }, ], }; var featureCollection = await client.Elements.Batch(parameters); Console.WriteLine(featureCollection); ``` #### Response ```json { "features": [ { "geometry": { "coordinates": [ 2.3522, 48.8566 ], "type": "Point" }, "properties": { "@id": "bar", "@type": "bar", "amenity": "bar", "cuisine": "bar", "name": "bar" }, "type": "Feature", "id": "node/21154906" } ], "type": "FeatureCollection" } ``` ## Find features near a geographic point `FeatureCollection Elements.Nearby(ElementNearbyParams?parameters, CancellationTokencancellationToken = default)` **get** `/api/v1/features/nearby` Find features near a geographic point ### Parameters - `ElementNearbyParams parameters` - `Double lat` Legacy shorthand. Latitude (-90 to 90). Use near param instead. - `Long limit` Maximum results (default 20, max 100) - `Double lng` Legacy shorthand. Longitude (-180 to 180). Use near param instead. - `string near` Point geometry for proximity search (lat,lng or GeoJSON). Alternative to lat/lng params. - `Double outputBuffer` Buffer geometry by meters - `Boolean outputCentroid` Replace geometry with centroid - `string outputFields` Comma-separated property fields to include - `Boolean outputGeometry` Include geometry (default true) - `string outputInclude` Extra computed fields: bbox, distance, center - `Long outputPrecision` Coordinate decimal precision (1-15, default 7) - `Double outputSimplify` Simplify geometry tolerance in meters - `string outputSort` Sort by: distance, name, osm_id - `Long radius` Search radius in meters (default 500, max 10000) ### Returns - `class FeatureCollection:` GeoJSON FeatureCollection (RFC 7946). For paginated endpoints, metadata is returned in HTTP response headers rather than the body: | Header | Description | | --------------- | ------------------------------------------------ | | `X-Limit` | Requested result limit | | `X-Has-More` | `true` if more results exist | | `X-Next-Cursor` | Opaque cursor for next page (cursor pagination) | | `X-Next-Offset` | Numeric offset for next page (offset pagination) | | `Link` | RFC 8288 `rel="next"` link to the next page | Content-Type is `application/geo+json`. - `required IReadOnlyList Features` Array of GeoJSON Feature objects - `required GeoJsonGeometry Geometry` GeoJSON Geometry object per RFC 7946. Coordinates use [longitude, latitude] order. 3D coordinates [lng, lat, elevation] are used for elevation endpoints. - `required Coordinates Coordinates` Coordinates array. Nesting depth varies by geometry type: Point = [lng, lat], LineString = [[lng, lat], ...], Polygon = [[[lng, lat], ...], ...], etc. - `IReadOnlyList` - `IReadOnlyList>` - `IReadOnlyList>>` - `IReadOnlyList>>>` - `required Type Type` Geometry type - `"Point"Point` - `"LineString"LineString` - `"Polygon"Polygon` - `"MultiPoint"MultiPoint` - `"MultiLineString"MultiLineString` - `"MultiPolygon"MultiPolygon` - `required IReadOnlyDictionary Properties` OSM tags flattened as key-value pairs, plus `@type` (node/way/relation) and `@id` (OSM ID) metadata fields. May include `distance_m` for proximity queries. - `required Type Type` Always `Feature` - `"Feature"Feature` - `string ID` Compound identifier in `type/osm_id` format - `required Type Type` Always `FeatureCollection` - `"FeatureCollection"FeatureCollection` ### Example ```csharp ElementNearbyParams parameters = new(); var featureCollection = await client.Elements.Nearby(parameters); Console.WriteLine(featureCollection); ``` #### Response ```json { "features": [ { "geometry": { "coordinates": [ 2.3522, 48.8566 ], "type": "Point" }, "properties": { "@id": "bar", "@type": "bar", "amenity": "bar", "cuisine": "bar", "name": "bar" }, "type": "Feature", "id": "node/21154906" } ], "type": "FeatureCollection" } ``` ## Find features near a geographic point `FeatureCollection Elements.NearbyPost(ElementNearbyPostParams?parameters, CancellationTokencancellationToken = default)` **post** `/api/v1/features/nearby` Find features near a geographic point ### Parameters - `ElementNearbyPostParams parameters` - `Double lat` Legacy shorthand. Latitude (-90 to 90). Use near param instead. - `Long limit` Maximum results (default 20, max 100) - `Double lng` Legacy shorthand. Longitude (-180 to 180). Use near param instead. - `string near` Point geometry for proximity search (lat,lng or GeoJSON). Alternative to lat/lng params. - `Double outputBuffer` Buffer geometry by meters - `Boolean outputCentroid` Replace geometry with centroid - `string outputFields` Comma-separated property fields to include - `Boolean outputGeometry` Include geometry (default true) - `string outputInclude` Extra computed fields: bbox, distance, center - `Long outputPrecision` Coordinate decimal precision (1-15, default 7) - `Double outputSimplify` Simplify geometry tolerance in meters - `string outputSort` Sort by: distance, name, osm_id - `Long radius` Search radius in meters (default 500, max 10000) ### Returns - `class FeatureCollection:` GeoJSON FeatureCollection (RFC 7946). For paginated endpoints, metadata is returned in HTTP response headers rather than the body: | Header | Description | | --------------- | ------------------------------------------------ | | `X-Limit` | Requested result limit | | `X-Has-More` | `true` if more results exist | | `X-Next-Cursor` | Opaque cursor for next page (cursor pagination) | | `X-Next-Offset` | Numeric offset for next page (offset pagination) | | `Link` | RFC 8288 `rel="next"` link to the next page | Content-Type is `application/geo+json`. - `required IReadOnlyList Features` Array of GeoJSON Feature objects - `required GeoJsonGeometry Geometry` GeoJSON Geometry object per RFC 7946. Coordinates use [longitude, latitude] order. 3D coordinates [lng, lat, elevation] are used for elevation endpoints. - `required Coordinates Coordinates` Coordinates array. Nesting depth varies by geometry type: Point = [lng, lat], LineString = [[lng, lat], ...], Polygon = [[[lng, lat], ...], ...], etc. - `IReadOnlyList` - `IReadOnlyList>` - `IReadOnlyList>>` - `IReadOnlyList>>>` - `required Type Type` Geometry type - `"Point"Point` - `"LineString"LineString` - `"Polygon"Polygon` - `"MultiPoint"MultiPoint` - `"MultiLineString"MultiLineString` - `"MultiPolygon"MultiPolygon` - `required IReadOnlyDictionary Properties` OSM tags flattened as key-value pairs, plus `@type` (node/way/relation) and `@id` (OSM ID) metadata fields. May include `distance_m` for proximity queries. - `required Type Type` Always `Feature` - `"Feature"Feature` - `string ID` Compound identifier in `type/osm_id` format - `required Type Type` Always `FeatureCollection` - `"FeatureCollection"FeatureCollection` ### Example ```csharp ElementNearbyPostParams parameters = new(); var featureCollection = await client.Elements.NearbyPost(parameters); Console.WriteLine(featureCollection); ``` #### Response ```json { "features": [ { "geometry": { "coordinates": [ 2.3522, 48.8566 ], "type": "Point" }, "properties": { "@id": "bar", "@type": "bar", "amenity": "bar", "cuisine": "bar", "name": "bar" }, "type": "Feature", "id": "node/21154906" } ], "type": "FeatureCollection" } ``` ## Domain Types ### Batch Request - `class BatchRequest:` Fetch multiple OSM elements by their type and ID in a single request. Maximum 100 elements per batch. - `required IReadOnlyList Elements` Array of element references to fetch - `required Long ID` OSM element ID - `required Type Type` OSM element type - `"node"Node` - `"way"Way` - `"relation"Relation`