Die GeoPoint-Klasse
Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Die Klasse GeoPoint
stellt einen Punkt auf der Erdoberfläche in Breiten- und Längenkoordinaten dar.
GeoPoint
ist im Modul google.appengine.api.search
definiert.
Einführung
Die GeoPoint-Klasse ermöglicht es, Kartenstandorte zu durchsuchen. Sie beginnen, indem Sie die GeoPoint-Klasse instanziieren und dieses Objekt dann an ein bestimmtes Dokumentfeld weitergeben:
from google.appengine.api import search
...
# Construct the GeoPoint class
geopoint = search.GeoPoint(latitude, longitude)
fields = [search.TextField(name='name', value=store_name),
search.TextField(name='address', value=store_address),
# Construct a GeoField passing geopoint as the value of that field
search.GeoField(name='store_location', value=geopoint)
]
Weitere Informationen zu standortbasierten Suchvorgängen finden Sie unter Queries on geopoint fields
.
Konstruktor
Der Konstruktor für die Klasse GeoPoint
ist so definiert:
-
GeoPoint(latitude, longitude)
Ein Punkt auf der Erdoberfläche, dargestellt in Breiten- und Längenkoordinaten.
Argumente
- latitude
Der Winkel zwischen der Äquatorialebene und einer Linie, die durch den GeoPoint verläuft, zwischen -90 und 90 Grad.
- longitude
Der östlich oder westlich gemessene Winkel zwischen einem Referenzmeridian und einem anderen Meridian, der durch den GeoPoint verläuft, zwischen -180 und 180 Grad.
Ausnahmen
- TypeError
Einer der Parameter weist einen ungültigen Typ auf oder ein unbekanntes Attribut wurde übergeben.
- ValueError
Ein ungültiger Wert wurde für einen der Parameter übergeben.
Eigenschaften
Eine Instanz der Klasse GeoPoint
hat die folgenden Attribute:
- latitude
Ein Winkelabstand in Grad vom Äquator aus betrachtet. Punkte südlich des Äquators haben negative Werte, nördlich davon liegende Punkte positive.
- longitude
Ein Winkelabstand in Grad, vom Nullmeridian aus betrachtet. Punkte westlich des Nullmeridians haben positive Werte, östlich davon liegende Punkte negative.
Sofern nicht anders angegeben, sind die Inhalte dieser Seite unter der Creative Commons Attribution 4.0 License und Codebeispiele unter der Apache 2.0 License lizenziert. Weitere Informationen finden Sie in den Websiterichtlinien von Google Developers. Java ist eine eingetragene Marke von Oracle und/oder seinen Partnern.
Zuletzt aktualisiert: 2025-09-03 (UTC).
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-09-03 (UTC)."],[[["\u003cp\u003eThe \u003ccode\u003eGeoPoint\u003c/code\u003e class represents a location on Earth using latitude and longitude coordinates.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eGeoPoint\u003c/code\u003e objects are created by passing latitude and longitude values to the \u003ccode\u003eGeoPoint\u003c/code\u003e constructor, each within specified degree ranges.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eGeoPoint\u003c/code\u003e objects can be used within a \u003ccode\u003eGeoField\u003c/code\u003e to make map locations searchable in documents.\u003c/p\u003e\n"],["\u003cp\u003eThe latitude property represents the north-south position, and the longitude property represents the east-west position, each with specific degree ranges and signs.\u003c/p\u003e\n"]]],[],null,["# The GeoPoint Class\n\nClass `GeoPoint` represents a point on the earth's surface represented by latitude and longitude coordinates.\n| This API is supported for first-generation runtimes and can be used when [upgrading to corresponding second-generation runtimes](/appengine/docs/standard/\n| python3\n|\n| /services/access). If you are updating to the App Engine Python 3 runtime, refer to the [migration guide](/appengine/migration-center/standard/migrate-to-second-gen/python-differences) to learn about your migration options for legacy bundled services.\n\n`GeoPoint` is defined in the module `google.appengine.api.search`.\n\nIntroduction\n------------\n\nThe GeoPoint class allows you to make map locations searchable. You start by instantiating the GeoPoint class and then pass that object to a specific document field: \n\n```python\nfrom google.appengine.api import search\n...\n# Construct the GeoPoint class\ngeopoint = search.GeoPoint(latitude, longitude)\n\nfields = [search.TextField(name='name', value=store_name),\n search.TextField(name='address', value=store_address),\n # Construct a GeoField passing geopoint as the value of that field\n search.GeoField(name='store_location', value=geopoint)\n ]\n```\n\nFor more information about performing location-based searches, please see [Queries on geopoint fields](/appengine/docs/legacy/standard/python/search/query_strings#queries_on_geopoint_fields).\n\nConstructor\n-----------\n\nThe constructor for class `GeoPoint` is defined as follows:\n\n\nGeoPoint(latitude, longitude)\n\n: A point on the earth's surface represented by latitude and longitude coordinates.\n\n:\n\n Arguments\n\n latitude\n\n : The angle between the equatorial plan and a line that passes through the GeoPoint, between -90 and 90 degrees.\n\n longitude\n\n : The angle east or west from a reference meridian to another meridian that passes through the GeoPoint, between -180 and 180 degrees.\n\n Exceptions\n\n TypeError\n\n : Any of the parameters has an invalid type, or an unknown attribute was passed.\n\n ValueError\n\n : An invalid value was passed for one of the parameters.\n\nProperties\n----------\n\nAn instance of class `GeoPoint` has the following properties:\n\nlatitude\n\n: An angular distance, in degrees, from the equator. Points located to the south of the equator have negative values, while points located to the north of it have positive values.\n\nlongitude\n\n: An angular distance, in degrees, from the prime meridian. Points located to the west of the prime meridian have positive values, while points located to the east of it have negative values."]]