ee.Geometry.MultiPoint.toGeoJSONString
Returns a GeoJSON string representation of the geometry.
Usage | Returns |
---|
MultiPoint.toGeoJSONString() | String |
Argument | Type | Details |
---|
this: geometry | Geometry | The Geometry instance. |
Examples
// Define a MultiPoint object.
var multiPoint = ee.Geometry.MultiPoint([[-122.082, 37.420], [-122.081, 37.426]]);
// Apply the toGeoJSONString method to the MultiPoint object.
var multiPointToGeoJSONString = multiPoint.toGeoJSONString();
// Print the result to the console.
print('multiPoint.toGeoJSONString(...) =', multiPointToGeoJSONString);
// Display relevant geometries on the map.
Map.setCenter(-122.085, 37.422, 15);
Map.addLayer(multiPoint,
{'color': 'black'},
'Geometry [black]: multiPoint');
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 MultiPoint object.
multipoint = ee.Geometry.MultiPoint([[-122.082, 37.420], [-122.081, 37.426]])
# Apply the toGeoJSONString method to the MultiPoint object.
multipoint_to_geojson_string = multipoint.toGeoJSONString()
# Print the result.
display('multipoint.toGeoJSONString(...) =', multipoint_to_geojson_string)
# Display relevant geometries on the map.
m = geemap.Map()
m.set_center(-122.085, 37.422, 15)
m.add_layer(multipoint, {'color': 'black'}, 'Geometry [black]: multipoint')
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 `toGeoJSONString()` method returns a GeoJSON string representation of a given Earth Engine Geometry."],["This function is applicable to MultiPoint geometries and returns a string containing the GeoJSON representation."],["Examples demonstrate its usage in both JavaScript and Python environments within the Google Earth Engine Code Editor and Colab, respectively."],["Users can visualize the geometry on a map using provided code snippets in conjunction with the generated GeoJSON string."]]],["The `toGeoJSONString()` method converts a geometry object into its GeoJSON string representation. It's applicable to `Geometry` instances like `MultiPoint`. The method takes a `Geometry` instance as input and returns a string. The provided examples demonstrate creating a `MultiPoint` object and then using `toGeoJSONString()` to get its GeoJSON string. The output string and the geometry can be visualized on a map. The code examples showcase this in both Javascript and Python.\n"]]