science Dieses Produkt oder diese Funktion ist experimentell (pre-GA). Pre-GA-Produkte und ‑Funktionen werden eventuell nur eingeschränkt unterstützt. Außerdem sind Änderungen an diesen Produkten und Funktionen möglicherweise nicht mit anderen pre-GA-Versionen kompatibel. Pre-GA-Angebote sind durch die dienstspezifischen Nutzungsbedingungen für die Google Maps Platform abgedeckt. Weitere Informationen finden Sie unter den Beschreibungen der Startphase. Melden Sie sich an, um Places Insights zu testen.
Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Die Funktion PLACES_COUNT_PER_GEO verwendet ein Array von geografischen Einheiten für die Suche und gibt eine Tabelle mit der Anzahl der Orte pro Einheit zurück. Wenn Sie beispielsweise ein Array von Postleitzahlen als Suchbereich angeben, enthält die Antwort eine Tabelle mit einer separaten Zeile für jede Postleitzahl.
Da die Funktion PLACES_COUNT_PER_GEO eine Tabelle zurückgibt, rufen Sie sie mit einer FROM-Klausel auf.
Eingabeparameter:
Erforderlich: Der geographies-Filterparameter, der den Suchbereich angibt. Der Parameter geographies akzeptiert ein Array von Werten, die durch den BigQuery-Datentyp GEOGRAPHY definiert werden. Dieser unterstützt Punkte, Linienzüge und Polygone.
Optional: Zusätzliche Filterparameter, um die Suche einzugrenzen.
Liefert:
Eine Tabelle mit einer Zeile pro geografischem Bereich. Die Tabelle enthält die Spalten geography (GEOGRAPHY), count (INT64) und sample_place_ids (ARRAY<STRING>), wobei sample_place_ids bis zu 250 Orts-IDs für jedes geografische Gebiet enthält.
Beispiel: Anzahl der Restaurants in jedem Bezirk von New York City berechnen
In diesem Beispiel wird eine Tabelle mit der Anzahl der betriebsbereiten Restaurants pro Bezirk in New York City generiert.
In diesem Beispiel wird das öffentliche BigQuery-DatasetDaten des US Census Bureau verwendet, um die Grenzen der drei Bezirke in New York City abzurufen: „Queens“, „Kings“ und „New York“. Die Grenzen der einzelnen Landkreise sind in der Spalte county_geom enthalten.
In diesem Beispiel wird dann die BigQuery-Funktion ST_SIMPLIFY verwendet, um eine vereinfachte Version von county_geom zurückzugeben. Mit der Funktion ST_SIMPLIFY werden nahezu gerade Verkettungen von Kanten durch eine einzelne lange Kante ersetzt.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Benötigte Informationen nicht gefunden","missingTheInformationINeed","thumb-down"],["Zu umständlich/zu viele Schritte","tooComplicatedTooManySteps","thumb-down"],["Nicht mehr aktuell","outOfDate","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Problem mit Beispielen/Code","samplesCodeIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-09-06 (UTC)."],[],[],null,["The `PLACES_COUNT_PER_GEO` function takes an array of geographic areas to search\nand returns a table of places counts per area. For example, if you specify an\narray of zip codes as the search area, the response contains a table with a\nseparate row for each zip code.\n\nBecause the `PLACES_COUNT_PER_GEO` function returns a table, call it using\na `FROM` clause.\n\n- Input parameters:\n\n - **Required** : The `geographies`\n [filter parameter](/maps/documentation/placesinsights/experimental/filter-params) that specifies the search area. The\n `geographies` parameter takes an array of values defined by the BigQuery\n [`GEOGRAPHY`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#geography_type)\n data type, which supports points, linestrings, and polygons.\n\n - **Optional** : Additional [filter](/maps/documentation/placesinsights/experimental/filter-params) parameters to refine your\n search.\n\n- Returns:\n\n - A table with one row per geographic area. The table contains the columns `geography` (`GEOGRAPHY`) and `count` (`INT64`).\n\nExample: Calculate the number of restaurants in each county of New York City\n\nThis example generates a table of counts of operational restaurants per county\nin New York City.\n| **Note:** Because the response table contains a `geographies` field, you can visualize it using tools that support BigQuery `GEOGRAPHY` types. For an example of visualizing the results of a function, see [Visualize\n| results](#visualize_results). For more information and example on visualizing Places Insights results, see [Visualize query results](/maps/documentation/placesinsights/visualize-data).\n\nThis example uses the [United States Census Bureau\nData](https://console.cloud.google.com/marketplace/product/united-states-census-bureau/us-geographic-boundaries)\nBigQuery [public dataset](https://cloud.google.com/bigquery/public-data) to get\nthe boundaries for the three counties in New York City: \"Queens\",\"Kings\", \"New\nYork\". The boundaries of each county are contained in the `county_geom` column.\n\nThis example then uses the BigQuery\n[`ST_SIMPLIFY`](https://cloud.google.com/bigquery/docs/reference/standard-sql/geography_functions#st_simplify)\nfunction to return a simplified version of `county_geom`. The `ST_SIMPLIFY`\nfunction replaces nearly straight chains of edges with a single long edge. \n\n```googlesql\nDECLARE geos ARRAY\u003cGEOGRAPHY\u003e;\n\nSET geos = (SELECT ARRAY_AGG(ST_SIMPLIFY(county_geom, 100))\n FROM `bigquery-public-data.geo_us_boundaries.counties`\n WHERE county_name IN (\"Queens\",\"Kings\", \"New York\") AND state_fips_code = \"36\");\n\nSELECT * FROM `maps-platform-analytics-hub.sample_places_insights_us.PLACES_COUNT_PER_GEO`(\n JSON_OBJECT(\n 'geographies', geos,\n 'types', [\"restaurant\"],\n 'business_status', [\"OPERATIONAL\"]\n )\n);\n```\n\nThe response for the function:\n\nVisualize results\n\nThe following images show this data displayed in Looker Studio as a filled map,\nincluding the outline of each county:\n\nTo import your data into Looker Studio:\n\n1. Run the function above to generate the results.\n\n2. In the BigQuery results, click **Open in -\\\u003e Looker Studio**. Your results\n are automatically imported into Looker Studio.\n\n3. Looker Studio creates a default report page and initializes it with a title,\n table, and bar graph of the results.\n\n4. Select everything on the page and delete it.\n\n5. Click **Insert -\\\u003e Filled map** to add a filled map to your report.\n\n6. Under **Chart types -\\\u003e Setup** configure the fields as shown below::\n\n7. The filled map appears as above. You can optionally select **Chart types -\\\u003e\n Styles** to further configure the appearance of the map.\n\nFor more information and example on visualizing Places Insights results, see\n[Visualize query results](/maps/documentation/placesinsights/visualize-data)."]]