ee.Geometry.Point.serialize
Returns the serialized representation of this object.
Usage | Returns |
---|
Point.serialize(legacy) | String |
Argument | Type | Details |
---|
this: geometry | Geometry | The Geometry instance. |
legacy | Boolean, optional | Enables legacy format. |
Examples
// Define a Point object.
var point = ee.Geometry.Point(-122.082, 37.42);
// Apply the serialize method to the Point object.
var pointSerialize = point.serialize();
// Print the result to the console.
print('point.serialize(...) =', pointSerialize);
// Display relevant geometries on the map.
Map.setCenter(-122.085, 37.422, 15);
Map.addLayer(point,
{'color': 'black'},
'Geometry [black]: point');
Python setup
See the
Python Environment page for information on the Python API and using
geemap
for interactive development.
import ee
import geemap.core as geemap
# Define a Point object.
point = ee.Geometry.Point(-122.082, 37.42)
# Apply the serialize method to the Point object.
point_serialize = point.serialize()
# Print the result.
display('point.serialize(...) =', point_serialize)
# Display relevant geometries on the map.
m = geemap.Map()
m.set_center(-122.085, 37.422, 15)
m.add_layer(point, {'color': 'black'}, 'Geometry [black]: point')
m
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-10-06 UTC.
[null,null,["Last updated 2023-10-06 UTC."],[[["The `serialize()` method returns a serialized (string) representation of a Geometry object, like a Point."],["An optional `legacy` Boolean argument can be passed to enable legacy formatting."],["Examples demonstrate the usage of `serialize()` in both JavaScript and Python within the Google Earth Engine context."],["The examples also show how to create and display a Point on a map using the respective APIs."]]],["The `serialize()` method, applicable to a Geometry instance, returns a string representation of the object. It accepts an optional boolean argument, `legacy`, to enable an older format. In JavaScript and Python examples, a Point object is defined, and `serialize()` is applied to it. The resulting serialized string is then printed. The Point geometry is displayed on a map using `Map.addLayer` (JavaScript) or `m.add_layer` (Python).\n"]]