Skip to content
GuidesPlaygroundDashboard

Execute a SPARQL query

query.sparql(QuerySparqlParams**kwargs) -> SparqlResult
POST/api/v1/sparql

Execute a SPARQL query

ParametersExpand Collapse
query: str

SPARQL query string

ReturnsExpand Collapse
class SparqlResult:

GeoJSON FeatureCollection of SPARQL query results

features: List[GeoJsonFeature]

GeoJSON features from SPARQL query

geometry: GeoJsonGeometry
coordinates: Union[List[float], List[List[float]], List[List[List[float]]], List[List[List[List[float]]]]]

GeoJSON coordinates array (nesting depth varies by geometry type)

One of the following:
List[float]
List[List[float]]
List[List[List[float]]]
List[List[List[List[float]]]]
type: Literal["Point", "LineString", "Polygon", 3 more]
One of the following:
"Point"
"LineString"
"Polygon"
"MultiPoint"
"MultiLineString"
"MultiPolygon"
properties: Dict[str, object]
type: Literal["Feature"]
id: Optional[str]

Feature identifier (type/osm_id)

osm_id: Optional[int]

OpenStreetMap ID

type: Literal["FeatureCollection"]

Execute a SPARQL query

import os
from plaza import Plaza

client = Plaza(
    api_key=os.environ.get("PLAZA_API_KEY"),  # This is the default and can be omitted
)
sparql_result = client.query.sparql(
    query="query",
)
print(sparql_result.features)
Returns Examples