Load Hotel Building Polygons (WKT) in GeoPandas, PostGIS and QGIS
Each hotel in the data can carry the outline of the building it occupies, stored as plain WKT text. This guide shows how to load those footprints into GeoPandas, PostGIS and QGIS, which rows to trust, and how to convert them to GeoJSON.
What you are loading
The footprint lives in building_polygon_wkt: a MULTIPOLYGON in WGS84 longitude/latitude (EPSG:4326), the same coordinate system as the hotel's latitude and longitude. A multipolygon rather than a polygon, because some buildings are mapped as several parts. Next to it sit the columns that tell you how far to trust it:
building_match_grade: A (highest confidence) to E (lowest);polygon_source:overture_containswhen the hotel point lies inside an Overture building,osm_namewhen an OpenStreetMap building's name matches the hotel,overture_nearestwhen the nearest Overture building was taken;building_dist_m: distance from the hotel point to the building;building_area_m2: footprint area in square metres.
In the free sample, 215 of the 250 hotels (86%) have a polygon. The grades break down as A 154, B 24, C 14, D 17 and E 6, and 35 hotels have none. The median footprint is 946 m².
Step 1: decide which polygons to use
For anything automated, such as geofences, point-in-polygon joins or area statistics, keep grades A and B. That is 178 of the 215 sample polygons. Grades C to E are still useful, but look at them on a map before relying on them: a nearest-building match in a dense old town can pick the neighbour. If you only need the hotel's location, the point coordinates are always there, polygon or not.
A WKT value is text, so the first job in every tool is the same: drop empty rows, parse the text into a geometry, and declare EPSG:4326.
Step 2a: GeoPandas
Read the Hotels sheet (or the CSV you received), parse the WKT with Shapely and build a GeoDataFrame:
import pandas as pd
import geopandas as gpd
from shapely import wkt
df = pd.read_excel("lodgingeo-hotel-data-sample-2026-10.xlsx", sheet_name="Hotels")
# or: df = pd.read_csv("hotels.csv")
df = df[df["building_polygon_wkt"].notna()]
df = df[df["building_match_grade"].isin(["A", "B"])]
gdf = gpd.GeoDataFrame(
df,
geometry=df["building_polygon_wkt"].apply(wkt.loads),
crs="EPSG:4326",
)
print(len(gdf), gdf.geometry.geom_type.unique())
Two checks are worth running once. First, validity: gdf.geometry.is_valid.all(); if it is not, gdf.geometry = gdf.geometry.make_valid() repairs self-intersections. Second, area: degrees are not metres, so project before measuring and compare with the delivered column:
metric = gdf.to_crs(gdf.estimate_utm_crs())
gdf["area_check_m2"] = metric.area
print(gdf[["building_area_m2", "area_check_m2"]].head())
estimate_utm_crs() picks one UTM zone for the whole frame, which is fine for a city or a country but not for a worldwide file; for that, project per country or use an equal-area projection.
Step 2b: PostGIS
Load the CSV into a table with the WKT as text, then add a geometry column:
CREATE TABLE hotels (
ld_id text PRIMARY KEY,
name text,
latitude double precision,
longitude double precision,
building_polygon_wkt text,
building_match_grade text,
building_area_m2 double precision
);
-- psql: \copy hotels FROM 'hotels.csv' WITH (FORMAT csv, HEADER true)
ALTER TABLE hotels ADD COLUMN geom geometry(MultiPolygon, 4326);
UPDATE hotels
SET geom = ST_Multi(ST_GeomFromText(building_polygon_wkt, 4326))
WHERE building_polygon_wkt IS NOT NULL;
CREATE INDEX hotels_geom_gix ON hotels USING gist (geom);
If your CSV has more columns than the table, list the ones you want in the \copy statement or load into a wide staging table first. ST_Multi keeps the column type consistent even if a footprint arrives as a single polygon. To measure area in square metres, cast to geography: ST_Area(geom::geography). A typical next step is a point-in-polygon join, for example counting your own location events inside each hotel building with ST_Contains(h.geom, e.geom), filtered to building_match_grade IN ('A', 'B').
Step 2c: QGIS
- Save the Hotels sheet as CSV (or use the CSV you received).
- Open Layer → Add Layer → Add Delimited Text Layer and choose the file.
- Under Geometry definition, select Well known text (WKT) and set the geometry field to
building_polygon_wkt. - Set the geometry CRS to EPSG:4326 – WGS 84 and click Add.
Rows without a polygon are skipped for that layer. To see the points too, add the same file a second time with Point coordinates, using longitude as X and latitude as Y. Styling the polygon layer by building_match_grade (categorised) is the fastest way to review the C to E matches against a basemap.
Step 3: convert to GeoJSON
GeoJSON is expected to be in WGS84 longitude/latitude, which is what the data already uses, so no reprojection is needed. From GeoPandas:
gdf[["ld_id", "name", "building_area_m2", "building_match_grade", "geometry"]] \
.to_file("hotel_buildings.geojson", driver="GeoJSON")
Or straight from the CSV with GDAL:
ogr2ogr -f GeoJSON hotel_buildings.geojson hotels.csv \
-oo GEOM_POSSIBLE_NAMES=building_polygon_wkt -a_srs EPSG:4326
Hotels without a footprint come out as features with a null geometry; filter them out first if your viewer objects.
Keep the attribute list short for web maps: a worldwide file with every column is large, and most map viewers only need an ID, a name and the grade.
Common pitfalls
- Axis order. WKT here is longitude first, then latitude. Swapping them puts Madrid in the Indian Ocean.
- Area in degrees.
.areaon an EPSG:4326 geometry returns square degrees. Project first, or usebuilding_area_m2. - Excel cell length. An Excel cell holds at most 32,767 characters. Very large footprints are safer in the CSV delivery.
- One building, several hotels. Hotels that share a building share a footprint;
places_inside_buildingtells you how many places sit inside it.
Where to go next
The building polygons page shows example footprints from the sample, and the data dictionary lists every building column. Attribution for OpenStreetMap and Overture data is on the methodology page.