diff --git a/samples/python/apidocs/ee_geometry_multipolygon_area.py b/samples/python/apidocs/ee_geometry_multipolygon_area.py new file mode 100644 index 000000000..a3dcaeea3 --- /dev/null +++ b/samples/python/apidocs/ee_geometry_multipolygon_area.py @@ -0,0 +1,40 @@ +# Copyright 2023 The Google Earth Engine Community Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# [START earthengine__apidocs__ee_geometry_multipolygon_area] +# Define a MultiPolygon object. +multipolygon = ee.Geometry.MultiPolygon([ + [[ + [-122.092, 37.424], + [-122.086, 37.418], + [-122.079, 37.425], + [-122.085, 37.423], + ]], + [[[-122.081, 37.417], [-122.086, 37.421], [-122.089, 37.416]]], +]) + +# Apply the area method to the MultiPolygon object. +multipolygon_area = multipolygon.area(maxError=1) + +# Print the result. +display('multipolygon.area(...) =', multipolygon_area) + +# Display relevant geometries on the map. +m = geemap.Map() +m.set_center(-122.085, 37.422, 15) +m.add_ee_layer( + multipolygon, {'color': 'black'}, 'Geometry [black]: multipolygon' +) +m +# [END earthengine__apidocs__ee_geometry_multipolygon_area] diff --git a/samples/python/apidocs/ee_geometry_multipolygon_bounds.py b/samples/python/apidocs/ee_geometry_multipolygon_bounds.py new file mode 100644 index 000000000..2efef393a --- /dev/null +++ b/samples/python/apidocs/ee_geometry_multipolygon_bounds.py @@ -0,0 +1,43 @@ +# Copyright 2023 The Google Earth Engine Community Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# [START earthengine__apidocs__ee_geometry_multipolygon_bounds] +# Define a MultiPolygon object. +multipolygon = ee.Geometry.MultiPolygon([ + [[ + [-122.092, 37.424], + [-122.086, 37.418], + [-122.079, 37.425], + [-122.085, 37.423], + ]], + [[[-122.081, 37.417], [-122.086, 37.421], [-122.089, 37.416]]], +]) + +# Apply the bounds method to the MultiPolygon object. +multipolygon_bounds = multipolygon.bounds() + +# Print the result. +display('multipolygon.bounds(...) =', multipolygon_bounds) + +# Display relevant geometries on the map. +m = geemap.Map() +m.set_center(-122.085, 37.422, 15) +m.add_ee_layer( + multipolygon, {'color': 'black'}, 'Geometry [black]: multipolygon' +) +m.add_ee_layer( + multipolygon_bounds, {'color': 'red'}, 'Result [red]: multipolygon.bounds' +) +m +# [END earthengine__apidocs__ee_geometry_multipolygon_bounds] diff --git a/samples/python/apidocs/ee_geometry_multipolygon_buffer.py b/samples/python/apidocs/ee_geometry_multipolygon_buffer.py new file mode 100644 index 000000000..4b4b3bea1 --- /dev/null +++ b/samples/python/apidocs/ee_geometry_multipolygon_buffer.py @@ -0,0 +1,43 @@ +# Copyright 2023 The Google Earth Engine Community Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# [START earthengine__apidocs__ee_geometry_multipolygon_buffer] +# Define a MultiPolygon object. +multipolygon = ee.Geometry.MultiPolygon([ + [[ + [-122.092, 37.424], + [-122.086, 37.418], + [-122.079, 37.425], + [-122.085, 37.423], + ]], + [[[-122.081, 37.417], [-122.086, 37.421], [-122.089, 37.416]]], +]) + +# Apply the buffer method to the MultiPolygon object. +multipolygon_buffer = multipolygon.buffer(distance=100) + +# Print the result. +display('multipolygon.buffer(...) =', multipolygon_buffer) + +# Display relevant geometries on the map. +m = geemap.Map() +m.set_center(-122.085, 37.422, 15) +m.add_ee_layer( + multipolygon, {'color': 'black'}, 'Geometry [black]: multipolygon' +) +m.add_ee_layer( + multipolygon_buffer, {'color': 'red'}, 'Result [red]: multipolygon.buffer' +) +m +# [END earthengine__apidocs__ee_geometry_multipolygon_buffer] diff --git a/samples/python/apidocs/ee_geometry_multipolygon_centroid.py b/samples/python/apidocs/ee_geometry_multipolygon_centroid.py new file mode 100644 index 000000000..363731f9b --- /dev/null +++ b/samples/python/apidocs/ee_geometry_multipolygon_centroid.py @@ -0,0 +1,45 @@ +# Copyright 2023 The Google Earth Engine Community Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# [START earthengine__apidocs__ee_geometry_multipolygon_centroid] +# Define a MultiPolygon object. +multipolygon = ee.Geometry.MultiPolygon([ + [[ + [-122.092, 37.424], + [-122.086, 37.418], + [-122.079, 37.425], + [-122.085, 37.423], + ]], + [[[-122.081, 37.417], [-122.086, 37.421], [-122.089, 37.416]]], +]) + +# Apply the centroid method to the MultiPolygon object. +multipolygon_centroid = multipolygon.centroid(maxError=1) + +# Print the result. +display('multipolygon.centroid(...) =', multipolygon_centroid) + +# Display relevant geometries on the map. +m = geemap.Map() +m.set_center(-122.085, 37.422, 15) +m.add_ee_layer( + multipolygon, {'color': 'black'}, 'Geometry [black]: multipolygon' +) +m.add_ee_layer( + multipolygon_centroid, + {'color': 'red'}, + 'Result [red]: multipolygon.centroid', +) +m +# [END earthengine__apidocs__ee_geometry_multipolygon_centroid] diff --git a/samples/python/apidocs/ee_geometry_multipolygon_containedin.py b/samples/python/apidocs/ee_geometry_multipolygon_containedin.py new file mode 100644 index 000000000..2c5d87a7d --- /dev/null +++ b/samples/python/apidocs/ee_geometry_multipolygon_containedin.py @@ -0,0 +1,46 @@ +# Copyright 2023 The Google Earth Engine Community Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# [START earthengine__apidocs__ee_geometry_multipolygon_containedin] +# Define a MultiPolygon object. +multipolygon = ee.Geometry.MultiPolygon([ + [[ + [-122.092, 37.424], + [-122.086, 37.418], + [-122.079, 37.425], + [-122.085, 37.423], + ]], + [[[-122.081, 37.417], [-122.086, 37.421], [-122.089, 37.416]]], +]) + +# Define other inputs. +input_geom = ee.Geometry.BBox(-122.085, 37.415, -122.075, 37.425) + +# Apply the containedIn method to the MultiPolygon object. +multipolygon_contained_in = multipolygon.containedIn( + right=input_geom, maxError=1 +) + +# Print the result. +display('multipolygon.containedIn(...) =', multipolygon_contained_in) + +# Display relevant geometries on the map. +m = geemap.Map() +m.set_center(-122.085, 37.422, 15) +m.add_ee_layer( + multipolygon, {'color': 'black'}, 'Geometry [black]: multipolygon' +) +m.add_ee_layer(input_geom, {'color': 'blue'}, 'Parameter [blue]: input_geom') +m +# [END earthengine__apidocs__ee_geometry_multipolygon_containedin] diff --git a/samples/python/apidocs/ee_geometry_multipolygon_contains.py b/samples/python/apidocs/ee_geometry_multipolygon_contains.py new file mode 100644 index 000000000..df917abcf --- /dev/null +++ b/samples/python/apidocs/ee_geometry_multipolygon_contains.py @@ -0,0 +1,44 @@ +# Copyright 2023 The Google Earth Engine Community Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# [START earthengine__apidocs__ee_geometry_multipolygon_contains] +# Define a MultiPolygon object. +multipolygon = ee.Geometry.MultiPolygon([ + [[ + [-122.092, 37.424], + [-122.086, 37.418], + [-122.079, 37.425], + [-122.085, 37.423], + ]], + [[[-122.081, 37.417], [-122.086, 37.421], [-122.089, 37.416]]], +]) + +# Define other inputs. +input_geom = ee.Geometry.BBox(-122.085, 37.415, -122.075, 37.425) + +# Apply the contains method to the MultiPolygon object. +multipolygon_contains = multipolygon.contains(right=input_geom, maxError=1) + +# Print the result. +display('multipolygon.contains(...) =', multipolygon_contains) + +# Display relevant geometries on the map. +m = geemap.Map() +m.set_center(-122.085, 37.422, 15) +m.add_ee_layer( + multipolygon, {'color': 'black'}, 'Geometry [black]: multipolygon' +) +m.add_ee_layer(input_geom, {'color': 'blue'}, 'Parameter [blue]: input_geom') +m +# [END earthengine__apidocs__ee_geometry_multipolygon_contains] diff --git a/samples/python/apidocs/ee_geometry_multipolygon_convexhull.py b/samples/python/apidocs/ee_geometry_multipolygon_convexhull.py new file mode 100644 index 000000000..45d5fc4b0 --- /dev/null +++ b/samples/python/apidocs/ee_geometry_multipolygon_convexhull.py @@ -0,0 +1,45 @@ +# Copyright 2023 The Google Earth Engine Community Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# [START earthengine__apidocs__ee_geometry_multipolygon_convexhull] +# Define a MultiPolygon object. +multipolygon = ee.Geometry.MultiPolygon([ + [[ + [-122.092, 37.424], + [-122.086, 37.418], + [-122.079, 37.425], + [-122.085, 37.423], + ]], + [[[-122.081, 37.417], [-122.086, 37.421], [-122.089, 37.416]]], +]) + +# Apply the convexHull method to the MultiPolygon object. +multipolygon_convex_hull = multipolygon.convexHull(maxError=1) + +# Print the result. +display('multipolygon.convexHull(...) =', multipolygon_convex_hull) + +# Display relevant geometries on the map. +m = geemap.Map() +m.set_center(-122.085, 37.422, 15) +m.add_ee_layer( + multipolygon, {'color': 'black'}, 'Geometry [black]: multipolygon' +) +m.add_ee_layer( + multipolygon_convex_hull, + {'color': 'red'}, + 'Result [red]: multipolygon.convexHull', +) +m +# [END earthengine__apidocs__ee_geometry_multipolygon_convexhull] diff --git a/samples/python/apidocs/ee_geometry_multipolygon_coordinates.py b/samples/python/apidocs/ee_geometry_multipolygon_coordinates.py new file mode 100644 index 000000000..f9229ba39 --- /dev/null +++ b/samples/python/apidocs/ee_geometry_multipolygon_coordinates.py @@ -0,0 +1,40 @@ +# Copyright 2023 The Google Earth Engine Community Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# [START earthengine__apidocs__ee_geometry_multipolygon_coordinates] +# Define a MultiPolygon object. +multipolygon = ee.Geometry.MultiPolygon([ + [[ + [-122.092, 37.424], + [-122.086, 37.418], + [-122.079, 37.425], + [-122.085, 37.423], + ]], + [[[-122.081, 37.417], [-122.086, 37.421], [-122.089, 37.416]]], +]) + +# Apply the coordinates method to the MultiPolygon object. +multipolygon_coordinates = multipolygon.coordinates() + +# Print the result. +display('multipolygon.coordinates(...) =', multipolygon_coordinates) + +# Display relevant geometries on the map. +m = geemap.Map() +m.set_center(-122.085, 37.422, 15) +m.add_ee_layer( + multipolygon, {'color': 'black'}, 'Geometry [black]: multipolygon' +) +m +# [END earthengine__apidocs__ee_geometry_multipolygon_coordinates] diff --git a/samples/python/apidocs/ee_geometry_multipolygon_difference.py b/samples/python/apidocs/ee_geometry_multipolygon_difference.py new file mode 100644 index 000000000..ecd599ead --- /dev/null +++ b/samples/python/apidocs/ee_geometry_multipolygon_difference.py @@ -0,0 +1,49 @@ +# Copyright 2023 The Google Earth Engine Community Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# [START earthengine__apidocs__ee_geometry_multipolygon_difference] +# Define a MultiPolygon object. +multipolygon = ee.Geometry.MultiPolygon([ + [[ + [-122.092, 37.424], + [-122.086, 37.418], + [-122.079, 37.425], + [-122.085, 37.423], + ]], + [[[-122.081, 37.417], [-122.086, 37.421], [-122.089, 37.416]]], +]) + +# Define other inputs. +input_geom = ee.Geometry.BBox(-122.085, 37.415, -122.075, 37.425) + +# Apply the difference method to the MultiPolygon object. +multipolygon_difference = multipolygon.difference(right=input_geom, maxError=1) + +# Print the result. +display('multipolygon.difference(...) =', multipolygon_difference) + +# Display relevant geometries on the map. +m = geemap.Map() +m.set_center(-122.085, 37.422, 15) +m.add_ee_layer( + multipolygon, {'color': 'black'}, 'Geometry [black]: multipolygon' +) +m.add_ee_layer(input_geom, {'color': 'blue'}, 'Parameter [blue]: input_geom') +m.add_ee_layer( + multipolygon_difference, + {'color': 'red'}, + 'Result [red]: multipolygon.difference', +) +m +# [END earthengine__apidocs__ee_geometry_multipolygon_difference] diff --git a/samples/python/apidocs/ee_geometry_multipolygon_disjoint.py b/samples/python/apidocs/ee_geometry_multipolygon_disjoint.py new file mode 100644 index 000000000..b486f5559 --- /dev/null +++ b/samples/python/apidocs/ee_geometry_multipolygon_disjoint.py @@ -0,0 +1,44 @@ +# Copyright 2023 The Google Earth Engine Community Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# [START earthengine__apidocs__ee_geometry_multipolygon_disjoint] +# Define a MultiPolygon object. +multipolygon = ee.Geometry.MultiPolygon([ + [[ + [-122.092, 37.424], + [-122.086, 37.418], + [-122.079, 37.425], + [-122.085, 37.423], + ]], + [[[-122.081, 37.417], [-122.086, 37.421], [-122.089, 37.416]]], +]) + +# Define other inputs. +input_geom = ee.Geometry.BBox(-122.085, 37.415, -122.075, 37.425) + +# Apply the disjoint method to the MultiPolygon object. +multipolygon_disjoint = multipolygon.disjoint(right=input_geom, maxError=1) + +# Print the result. +display('multipolygon.disjoint(...) =', multipolygon_disjoint) + +# Display relevant geometries on the map. +m = geemap.Map() +m.set_center(-122.085, 37.422, 15) +m.add_ee_layer( + multipolygon, {'color': 'black'}, 'Geometry [black]: multipolygon' +) +m.add_ee_layer(input_geom, {'color': 'blue'}, 'Parameter [blue]: input_geom') +m +# [END earthengine__apidocs__ee_geometry_multipolygon_disjoint] diff --git a/samples/python/apidocs/ee_geometry_multipolygon_dissolve.py b/samples/python/apidocs/ee_geometry_multipolygon_dissolve.py new file mode 100644 index 000000000..2bcac20e2 --- /dev/null +++ b/samples/python/apidocs/ee_geometry_multipolygon_dissolve.py @@ -0,0 +1,45 @@ +# Copyright 2023 The Google Earth Engine Community Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# [START earthengine__apidocs__ee_geometry_multipolygon_dissolve] +# Define a MultiPolygon object. +multipolygon = ee.Geometry.MultiPolygon([ + [[ + [-122.092, 37.424], + [-122.086, 37.418], + [-122.079, 37.425], + [-122.085, 37.423], + ]], + [[[-122.081, 37.417], [-122.086, 37.421], [-122.089, 37.416]]], +]) + +# Apply the dissolve method to the MultiPolygon object. +multipolygon_dissolve = multipolygon.dissolve(maxError=1) + +# Print the result. +display('multipolygon.dissolve(...) =', multipolygon_dissolve) + +# Display relevant geometries on the map. +m = geemap.Map() +m.set_center(-122.085, 37.422, 15) +m.add_ee_layer( + multipolygon, {'color': 'black'}, 'Geometry [black]: multipolygon' +) +m.add_ee_layer( + multipolygon_dissolve, + {'color': 'red'}, + 'Result [red]: multipolygon.dissolve', +) +m +# [END earthengine__apidocs__ee_geometry_multipolygon_dissolve] diff --git a/samples/python/apidocs/ee_geometry_multipolygon_distance.py b/samples/python/apidocs/ee_geometry_multipolygon_distance.py new file mode 100644 index 000000000..75315854c --- /dev/null +++ b/samples/python/apidocs/ee_geometry_multipolygon_distance.py @@ -0,0 +1,44 @@ +# Copyright 2023 The Google Earth Engine Community Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# [START earthengine__apidocs__ee_geometry_multipolygon_distance] +# Define a MultiPolygon object. +multipolygon = ee.Geometry.MultiPolygon([ + [[ + [-122.092, 37.424], + [-122.086, 37.418], + [-122.079, 37.425], + [-122.085, 37.423], + ]], + [[[-122.081, 37.417], [-122.086, 37.421], [-122.089, 37.416]]], +]) + +# Define other inputs. +input_geom = ee.Geometry.Point(-122.090, 37.423) + +# Apply the distance method to the MultiPolygon object. +multipolygon_distance = multipolygon.distance(right=input_geom, maxError=1) + +# Print the result. +display('multipolygon.distance(...) =', multipolygon_distance) + +# Display relevant geometries on the map. +m = geemap.Map() +m.set_center(-122.085, 37.422, 15) +m.add_ee_layer( + multipolygon, {'color': 'black'}, 'Geometry [black]: multipolygon' +) +m.add_ee_layer(input_geom, {'color': 'blue'}, 'Parameter [blue]: input_geom') +m +# [END earthengine__apidocs__ee_geometry_multipolygon_distance] diff --git a/samples/python/apidocs/ee_geometry_multipolygon_edgesaregeodesics.py b/samples/python/apidocs/ee_geometry_multipolygon_edgesaregeodesics.py new file mode 100644 index 000000000..5ebfab094 --- /dev/null +++ b/samples/python/apidocs/ee_geometry_multipolygon_edgesaregeodesics.py @@ -0,0 +1,42 @@ +# Copyright 2023 The Google Earth Engine Community Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# [START earthengine__apidocs__ee_geometry_multipolygon_edgesaregeodesics] +# Define a MultiPolygon object. +multipolygon = ee.Geometry.MultiPolygon([ + [[ + [-122.092, 37.424], + [-122.086, 37.418], + [-122.079, 37.425], + [-122.085, 37.423], + ]], + [[[-122.081, 37.417], [-122.086, 37.421], [-122.089, 37.416]]], +]) + +# Apply the edgesAreGeodesics method to the MultiPolygon object. +multipolygon_edges_are_geodesics = multipolygon.edgesAreGeodesics() + +# Print the result. +display( + 'multipolygon.edgesAreGeodesics(...) =', multipolygon_edges_are_geodesics +) + +# Display relevant geometries on the map. +m = geemap.Map() +m.set_center(-122.085, 37.422, 15) +m.add_ee_layer( + multipolygon, {'color': 'black'}, 'Geometry [black]: multipolygon' +) +m +# [END earthengine__apidocs__ee_geometry_multipolygon_edgesaregeodesics] diff --git a/samples/python/apidocs/ee_geometry_multipolygon_geodesic.py b/samples/python/apidocs/ee_geometry_multipolygon_geodesic.py new file mode 100644 index 000000000..1cd3ac1b7 --- /dev/null +++ b/samples/python/apidocs/ee_geometry_multipolygon_geodesic.py @@ -0,0 +1,40 @@ +# Copyright 2023 The Google Earth Engine Community Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# [START earthengine__apidocs__ee_geometry_multipolygon_geodesic] +# Define a MultiPolygon object. +multipolygon = ee.Geometry.MultiPolygon([ + [[ + [-122.092, 37.424], + [-122.086, 37.418], + [-122.079, 37.425], + [-122.085, 37.423], + ]], + [[[-122.081, 37.417], [-122.086, 37.421], [-122.089, 37.416]]], +]) + +# Apply the geodesic method to the MultiPolygon object. +multipolygon_geodesic = multipolygon.geodesic() + +# Print the result. +display('multipolygon.geodesic(...) =', multipolygon_geodesic) + +# Display relevant geometries on the map. +m = geemap.Map() +m.set_center(-122.085, 37.422, 15) +m.add_ee_layer( + multipolygon, {'color': 'black'}, 'Geometry [black]: multipolygon' +) +m +# [END earthengine__apidocs__ee_geometry_multipolygon_geodesic] diff --git a/samples/python/apidocs/ee_geometry_multipolygon_geometries.py b/samples/python/apidocs/ee_geometry_multipolygon_geometries.py new file mode 100644 index 000000000..447b77af9 --- /dev/null +++ b/samples/python/apidocs/ee_geometry_multipolygon_geometries.py @@ -0,0 +1,40 @@ +# Copyright 2023 The Google Earth Engine Community Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# [START earthengine__apidocs__ee_geometry_multipolygon_geometries] +# Define a MultiPolygon object. +multipolygon = ee.Geometry.MultiPolygon([ + [[ + [-122.092, 37.424], + [-122.086, 37.418], + [-122.079, 37.425], + [-122.085, 37.423], + ]], + [[[-122.081, 37.417], [-122.086, 37.421], [-122.089, 37.416]]], +]) + +# Apply the geometries method to the MultiPolygon object. +multipolygon_geometries = multipolygon.geometries() + +# Print the result. +display('multipolygon.geometries(...) =', multipolygon_geometries) + +# Display relevant geometries on the map. +m = geemap.Map() +m.set_center(-122.085, 37.422, 15) +m.add_ee_layer( + multipolygon, {'color': 'black'}, 'Geometry [black]: multipolygon' +) +m +# [END earthengine__apidocs__ee_geometry_multipolygon_geometries] diff --git a/samples/python/apidocs/ee_geometry_multipolygon_getinfo.py b/samples/python/apidocs/ee_geometry_multipolygon_getinfo.py new file mode 100644 index 000000000..11067bc7c --- /dev/null +++ b/samples/python/apidocs/ee_geometry_multipolygon_getinfo.py @@ -0,0 +1,40 @@ +# Copyright 2023 The Google Earth Engine Community Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# [START earthengine__apidocs__ee_geometry_multipolygon_getinfo] +# Define a MultiPolygon object. +multipolygon = ee.Geometry.MultiPolygon([ + [[ + [-122.092, 37.424], + [-122.086, 37.418], + [-122.079, 37.425], + [-122.085, 37.423], + ]], + [[[-122.081, 37.417], [-122.086, 37.421], [-122.089, 37.416]]], +]) + +# Apply the getInfo method to the MultiPolygon object. +multipolygon_get_info = multipolygon.getInfo() + +# Print the result. +display('multipolygon.getInfo(...) =', multipolygon_get_info) + +# Display relevant geometries on the map. +m = geemap.Map() +m.set_center(-122.085, 37.422, 15) +m.add_ee_layer( + multipolygon, {'color': 'black'}, 'Geometry [black]: multipolygon' +) +m +# [END earthengine__apidocs__ee_geometry_multipolygon_getinfo] diff --git a/samples/python/apidocs/ee_geometry_multipolygon_intersection.py b/samples/python/apidocs/ee_geometry_multipolygon_intersection.py new file mode 100644 index 000000000..23936c6e3 --- /dev/null +++ b/samples/python/apidocs/ee_geometry_multipolygon_intersection.py @@ -0,0 +1,51 @@ +# Copyright 2023 The Google Earth Engine Community Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# [START earthengine__apidocs__ee_geometry_multipolygon_intersection] +# Define a MultiPolygon object. +multipolygon = ee.Geometry.MultiPolygon([ + [[ + [-122.092, 37.424], + [-122.086, 37.418], + [-122.079, 37.425], + [-122.085, 37.423], + ]], + [[[-122.081, 37.417], [-122.086, 37.421], [-122.089, 37.416]]], +]) + +# Define other inputs. +input_geom = ee.Geometry.BBox(-122.085, 37.415, -122.075, 37.425) + +# Apply the intersection method to the MultiPolygon object. +multipolygon_intersection = multipolygon.intersection( + right=input_geom, maxError=1 +) + +# Print the result. +display('multipolygon.intersection(...) =', multipolygon_intersection) + +# Display relevant geometries on the map. +m = geemap.Map() +m.set_center(-122.085, 37.422, 15) +m.add_ee_layer( + multipolygon, {'color': 'black'}, 'Geometry [black]: multipolygon' +) +m.add_ee_layer(input_geom, {'color': 'blue'}, 'Parameter [blue]: input_geom') +m.add_ee_layer( + multipolygon_intersection, + {'color': 'red'}, + 'Result [red]: multipolygon.intersection', +) +m +# [END earthengine__apidocs__ee_geometry_multipolygon_intersection] diff --git a/samples/python/apidocs/ee_geometry_multipolygon_intersects.py b/samples/python/apidocs/ee_geometry_multipolygon_intersects.py new file mode 100644 index 000000000..d7adad2d5 --- /dev/null +++ b/samples/python/apidocs/ee_geometry_multipolygon_intersects.py @@ -0,0 +1,44 @@ +# Copyright 2023 The Google Earth Engine Community Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# [START earthengine__apidocs__ee_geometry_multipolygon_intersects] +# Define a MultiPolygon object. +multipolygon = ee.Geometry.MultiPolygon([ + [[ + [-122.092, 37.424], + [-122.086, 37.418], + [-122.079, 37.425], + [-122.085, 37.423], + ]], + [[[-122.081, 37.417], [-122.086, 37.421], [-122.089, 37.416]]], +]) + +# Define other inputs. +input_geom = ee.Geometry.BBox(-122.085, 37.415, -122.075, 37.425) + +# Apply the intersects method to the MultiPolygon object. +multipolygon_intersects = multipolygon.intersects(right=input_geom, maxError=1) + +# Print the result. +display('multipolygon.intersects(...) =', multipolygon_intersects) + +# Display relevant geometries on the map. +m = geemap.Map() +m.set_center(-122.085, 37.422, 15) +m.add_ee_layer( + multipolygon, {'color': 'black'}, 'Geometry [black]: multipolygon' +) +m.add_ee_layer(input_geom, {'color': 'blue'}, 'Parameter [blue]: input_geom') +m +# [END earthengine__apidocs__ee_geometry_multipolygon_intersects] diff --git a/samples/python/apidocs/ee_geometry_multipolygon_isunbounded.py b/samples/python/apidocs/ee_geometry_multipolygon_isunbounded.py new file mode 100644 index 000000000..954b6264c --- /dev/null +++ b/samples/python/apidocs/ee_geometry_multipolygon_isunbounded.py @@ -0,0 +1,40 @@ +# Copyright 2023 The Google Earth Engine Community Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# [START earthengine__apidocs__ee_geometry_multipolygon_isunbounded] +# Define a MultiPolygon object. +multipolygon = ee.Geometry.MultiPolygon([ + [[ + [-122.092, 37.424], + [-122.086, 37.418], + [-122.079, 37.425], + [-122.085, 37.423], + ]], + [[[-122.081, 37.417], [-122.086, 37.421], [-122.089, 37.416]]], +]) + +# Apply the isUnbounded method to the MultiPolygon object. +multipolygon_is_unbounded = multipolygon.isUnbounded() + +# Print the result. +display('multipolygon.isUnbounded(...) =', multipolygon_is_unbounded) + +# Display relevant geometries on the map. +m = geemap.Map() +m.set_center(-122.085, 37.422, 15) +m.add_ee_layer( + multipolygon, {'color': 'black'}, 'Geometry [black]: multipolygon' +) +m +# [END earthengine__apidocs__ee_geometry_multipolygon_isunbounded] diff --git a/samples/python/apidocs/ee_geometry_multipolygon_length.py b/samples/python/apidocs/ee_geometry_multipolygon_length.py new file mode 100644 index 000000000..87de8b6e8 --- /dev/null +++ b/samples/python/apidocs/ee_geometry_multipolygon_length.py @@ -0,0 +1,40 @@ +# Copyright 2023 The Google Earth Engine Community Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# [START earthengine__apidocs__ee_geometry_multipolygon_length] +# Define a MultiPolygon object. +multipolygon = ee.Geometry.MultiPolygon([ + [[ + [-122.092, 37.424], + [-122.086, 37.418], + [-122.079, 37.425], + [-122.085, 37.423], + ]], + [[[-122.081, 37.417], [-122.086, 37.421], [-122.089, 37.416]]], +]) + +# Apply the length method to the MultiPolygon object. +multipolygon_length = multipolygon.length() + +# Print the result. +display('multipolygon.length(...) =', multipolygon_length) + +# Display relevant geometries on the map. +m = geemap.Map() +m.set_center(-122.085, 37.422, 15) +m.add_ee_layer( + multipolygon, {'color': 'black'}, 'Geometry [black]: multipolygon' +) +m +# [END earthengine__apidocs__ee_geometry_multipolygon_length] diff --git a/samples/python/apidocs/ee_geometry_multipolygon_perimeter.py b/samples/python/apidocs/ee_geometry_multipolygon_perimeter.py new file mode 100644 index 000000000..af5224643 --- /dev/null +++ b/samples/python/apidocs/ee_geometry_multipolygon_perimeter.py @@ -0,0 +1,40 @@ +# Copyright 2023 The Google Earth Engine Community Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# [START earthengine__apidocs__ee_geometry_multipolygon_perimeter] +# Define a MultiPolygon object. +multipolygon = ee.Geometry.MultiPolygon([ + [[ + [-122.092, 37.424], + [-122.086, 37.418], + [-122.079, 37.425], + [-122.085, 37.423], + ]], + [[[-122.081, 37.417], [-122.086, 37.421], [-122.089, 37.416]]], +]) + +# Apply the perimeter method to the MultiPolygon object. +multipolygon_perimeter = multipolygon.perimeter(maxError=1) + +# Print the result. +display('multipolygon.perimeter(...) =', multipolygon_perimeter) + +# Display relevant geometries on the map. +m = geemap.Map() +m.set_center(-122.085, 37.422, 15) +m.add_ee_layer( + multipolygon, {'color': 'black'}, 'Geometry [black]: multipolygon' +) +m +# [END earthengine__apidocs__ee_geometry_multipolygon_perimeter] diff --git a/samples/python/apidocs/ee_geometry_multipolygon_projection.py b/samples/python/apidocs/ee_geometry_multipolygon_projection.py new file mode 100644 index 000000000..a321f2655 --- /dev/null +++ b/samples/python/apidocs/ee_geometry_multipolygon_projection.py @@ -0,0 +1,40 @@ +# Copyright 2023 The Google Earth Engine Community Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# [START earthengine__apidocs__ee_geometry_multipolygon_projection] +# Define a MultiPolygon object. +multipolygon = ee.Geometry.MultiPolygon([ + [[ + [-122.092, 37.424], + [-122.086, 37.418], + [-122.079, 37.425], + [-122.085, 37.423], + ]], + [[[-122.081, 37.417], [-122.086, 37.421], [-122.089, 37.416]]], +]) + +# Apply the projection method to the MultiPolygon object. +multipolygon_projection = multipolygon.projection() + +# Print the result. +display('multipolygon.projection(...) =', multipolygon_projection) + +# Display relevant geometries on the map. +m = geemap.Map() +m.set_center(-122.085, 37.422, 15) +m.add_ee_layer( + multipolygon, {'color': 'black'}, 'Geometry [black]: multipolygon' +) +m +# [END earthengine__apidocs__ee_geometry_multipolygon_projection] diff --git a/samples/python/apidocs/ee_geometry_multipolygon_serialize.py b/samples/python/apidocs/ee_geometry_multipolygon_serialize.py new file mode 100644 index 000000000..2b8615cff --- /dev/null +++ b/samples/python/apidocs/ee_geometry_multipolygon_serialize.py @@ -0,0 +1,40 @@ +# Copyright 2023 The Google Earth Engine Community Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# [START earthengine__apidocs__ee_geometry_multipolygon_serialize] +# Define a MultiPolygon object. +multipolygon = ee.Geometry.MultiPolygon([ + [[ + [-122.092, 37.424], + [-122.086, 37.418], + [-122.079, 37.425], + [-122.085, 37.423], + ]], + [[[-122.081, 37.417], [-122.086, 37.421], [-122.089, 37.416]]], +]) + +# Apply the serialize method to the MultiPolygon object. +multipolygon_serialize = multipolygon.serialize() + +# Print the result. +display('multipolygon.serialize(...) =', multipolygon_serialize) + +# Display relevant geometries on the map. +m = geemap.Map() +m.set_center(-122.085, 37.422, 15) +m.add_ee_layer( + multipolygon, {'color': 'black'}, 'Geometry [black]: multipolygon' +) +m +# [END earthengine__apidocs__ee_geometry_multipolygon_serialize] diff --git a/samples/python/apidocs/ee_geometry_multipolygon_simplify.py b/samples/python/apidocs/ee_geometry_multipolygon_simplify.py new file mode 100644 index 000000000..82f133e80 --- /dev/null +++ b/samples/python/apidocs/ee_geometry_multipolygon_simplify.py @@ -0,0 +1,45 @@ +# Copyright 2023 The Google Earth Engine Community Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# [START earthengine__apidocs__ee_geometry_multipolygon_simplify] +# Define a MultiPolygon object. +multipolygon = ee.Geometry.MultiPolygon([ + [[ + [-122.092, 37.424], + [-122.086, 37.418], + [-122.079, 37.425], + [-122.085, 37.423], + ]], + [[[-122.081, 37.417], [-122.086, 37.421], [-122.089, 37.416]]], +]) + +# Apply the simplify method to the MultiPolygon object. +multipolygon_simplify = multipolygon.simplify(maxError=1) + +# Print the result. +display('multipolygon.simplify(...) =', multipolygon_simplify) + +# Display relevant geometries on the map. +m = geemap.Map() +m.set_center(-122.085, 37.422, 15) +m.add_ee_layer( + multipolygon, {'color': 'black'}, 'Geometry [black]: multipolygon' +) +m.add_ee_layer( + multipolygon_simplify, + {'color': 'red'}, + 'Result [red]: multipolygon.simplify', +) +m +# [END earthengine__apidocs__ee_geometry_multipolygon_simplify] diff --git a/samples/python/apidocs/ee_geometry_multipolygon_symmetricdifference.py b/samples/python/apidocs/ee_geometry_multipolygon_symmetricdifference.py new file mode 100644 index 000000000..b1c4f8f36 --- /dev/null +++ b/samples/python/apidocs/ee_geometry_multipolygon_symmetricdifference.py @@ -0,0 +1,53 @@ +# Copyright 2023 The Google Earth Engine Community Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# [START earthengine__apidocs__ee_geometry_multipolygon_symmetricdifference] +# Define a MultiPolygon object. +multipolygon = ee.Geometry.MultiPolygon([ + [[ + [-122.092, 37.424], + [-122.086, 37.418], + [-122.079, 37.425], + [-122.085, 37.423], + ]], + [[[-122.081, 37.417], [-122.086, 37.421], [-122.089, 37.416]]], +]) + +# Define other inputs. +input_geom = ee.Geometry.BBox(-122.085, 37.415, -122.075, 37.425) + +# Apply the symmetricDifference method to the MultiPolygon object. +multipolygon_symmetric_difference = multipolygon.symmetricDifference( + right=input_geom, maxError=1 +) + +# Print the result. +display( + 'multipolygon.symmetricDifference(...) =', multipolygon_symmetric_difference +) + +# Display relevant geometries on the map. +m = geemap.Map() +m.set_center(-122.085, 37.422, 15) +m.add_ee_layer( + multipolygon, {'color': 'black'}, 'Geometry [black]: multipolygon' +) +m.add_ee_layer(input_geom, {'color': 'blue'}, 'Parameter [blue]: input_geom') +m.add_ee_layer( + multipolygon_symmetric_difference, + {'color': 'red'}, + 'Result [red]: multipolygon.symmetricDifference', +) +m +# [END earthengine__apidocs__ee_geometry_multipolygon_symmetricdifference] diff --git a/samples/python/apidocs/ee_geometry_multipolygon_togeojson.py b/samples/python/apidocs/ee_geometry_multipolygon_togeojson.py new file mode 100644 index 000000000..f204441d8 --- /dev/null +++ b/samples/python/apidocs/ee_geometry_multipolygon_togeojson.py @@ -0,0 +1,40 @@ +# Copyright 2023 The Google Earth Engine Community Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# [START earthengine__apidocs__ee_geometry_multipolygon_togeojson] +# Define a MultiPolygon object. +multipolygon = ee.Geometry.MultiPolygon([ + [[ + [-122.092, 37.424], + [-122.086, 37.418], + [-122.079, 37.425], + [-122.085, 37.423], + ]], + [[[-122.081, 37.417], [-122.086, 37.421], [-122.089, 37.416]]], +]) + +# Apply the toGeoJSON method to the MultiPolygon object. +multipolygon_to_geojson = multipolygon.toGeoJSON() + +# Print the result. +display('multipolygon.toGeoJSON(...) =', multipolygon_to_geojson) + +# Display relevant geometries on the map. +m = geemap.Map() +m.set_center(-122.085, 37.422, 15) +m.add_ee_layer( + multipolygon, {'color': 'black'}, 'Geometry [black]: multipolygon' +) +m +# [END earthengine__apidocs__ee_geometry_multipolygon_togeojson] diff --git a/samples/python/apidocs/ee_geometry_multipolygon_togeojsonstring.py b/samples/python/apidocs/ee_geometry_multipolygon_togeojsonstring.py new file mode 100644 index 000000000..b3539b6d6 --- /dev/null +++ b/samples/python/apidocs/ee_geometry_multipolygon_togeojsonstring.py @@ -0,0 +1,40 @@ +# Copyright 2023 The Google Earth Engine Community Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# [START earthengine__apidocs__ee_geometry_multipolygon_togeojsonstring] +# Define a MultiPolygon object. +multipolygon = ee.Geometry.MultiPolygon([ + [[ + [-122.092, 37.424], + [-122.086, 37.418], + [-122.079, 37.425], + [-122.085, 37.423], + ]], + [[[-122.081, 37.417], [-122.086, 37.421], [-122.089, 37.416]]], +]) + +# Apply the toGeoJSONString method to the MultiPolygon object. +multipolygon_to_geojson_string = multipolygon.toGeoJSONString() + +# Print the result. +display('multipolygon.toGeoJSONString(...) =', multipolygon_to_geojson_string) + +# Display relevant geometries on the map. +m = geemap.Map() +m.set_center(-122.085, 37.422, 15) +m.add_ee_layer( + multipolygon, {'color': 'black'}, 'Geometry [black]: multipolygon' +) +m +# [END earthengine__apidocs__ee_geometry_multipolygon_togeojsonstring] diff --git a/samples/python/apidocs/ee_geometry_multipolygon_type.py b/samples/python/apidocs/ee_geometry_multipolygon_type.py new file mode 100644 index 000000000..38a321695 --- /dev/null +++ b/samples/python/apidocs/ee_geometry_multipolygon_type.py @@ -0,0 +1,40 @@ +# Copyright 2023 The Google Earth Engine Community Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# [START earthengine__apidocs__ee_geometry_multipolygon_type] +# Define a MultiPolygon object. +multipolygon = ee.Geometry.MultiPolygon([ + [[ + [-122.092, 37.424], + [-122.086, 37.418], + [-122.079, 37.425], + [-122.085, 37.423], + ]], + [[[-122.081, 37.417], [-122.086, 37.421], [-122.089, 37.416]]], +]) + +# Apply the type method to the MultiPolygon object. +multipolygon_type = multipolygon.type() + +# Print the result. +display('multipolygon.type(...) =', multipolygon_type) + +# Display relevant geometries on the map. +m = geemap.Map() +m.set_center(-122.085, 37.422, 15) +m.add_ee_layer( + multipolygon, {'color': 'black'}, 'Geometry [black]: multipolygon' +) +m +# [END earthengine__apidocs__ee_geometry_multipolygon_type] diff --git a/samples/python/apidocs/ee_geometry_multipolygon_union.py b/samples/python/apidocs/ee_geometry_multipolygon_union.py new file mode 100644 index 000000000..311524d8b --- /dev/null +++ b/samples/python/apidocs/ee_geometry_multipolygon_union.py @@ -0,0 +1,47 @@ +# Copyright 2023 The Google Earth Engine Community Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# [START earthengine__apidocs__ee_geometry_multipolygon_union] +# Define a MultiPolygon object. +multipolygon = ee.Geometry.MultiPolygon([ + [[ + [-122.092, 37.424], + [-122.086, 37.418], + [-122.079, 37.425], + [-122.085, 37.423], + ]], + [[[-122.081, 37.417], [-122.086, 37.421], [-122.089, 37.416]]], +]) + +# Define other inputs. +input_geom = ee.Geometry.BBox(-122.085, 37.415, -122.075, 37.425) + +# Apply the union method to the MultiPolygon object. +multipolygon_union = multipolygon.union(right=input_geom, maxError=1) + +# Print the result. +display('multipolygon.union(...) =', multipolygon_union) + +# Display relevant geometries on the map. +m = geemap.Map() +m.set_center(-122.085, 37.422, 15) +m.add_ee_layer( + multipolygon, {'color': 'black'}, 'Geometry [black]: multipolygon' +) +m.add_ee_layer(input_geom, {'color': 'blue'}, 'Parameter [blue]: input_geom') +m.add_ee_layer( + multipolygon_union, {'color': 'red'}, 'Result [red]: multipolygon.union' +) +m +# [END earthengine__apidocs__ee_geometry_multipolygon_union] diff --git a/samples/python/apidocs/ee_geometry_multipolygon_withindistance.py b/samples/python/apidocs/ee_geometry_multipolygon_withindistance.py new file mode 100644 index 000000000..1ac6dc68f --- /dev/null +++ b/samples/python/apidocs/ee_geometry_multipolygon_withindistance.py @@ -0,0 +1,46 @@ +# Copyright 2023 The Google Earth Engine Community Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# [START earthengine__apidocs__ee_geometry_multipolygon_withindistance] +# Define a MultiPolygon object. +multipolygon = ee.Geometry.MultiPolygon([ + [[ + [-122.092, 37.424], + [-122.086, 37.418], + [-122.079, 37.425], + [-122.085, 37.423], + ]], + [[[-122.081, 37.417], [-122.086, 37.421], [-122.089, 37.416]]], +]) + +# Define other inputs. +input_geom = ee.Geometry.Point(-122.090, 37.423) + +# Apply the withinDistance method to the MultiPolygon object. +multipolygon_within_distance = multipolygon.withinDistance( + right=input_geom, distance=500, maxError=1 +) + +# Print the result. +display('multipolygon.withinDistance(...) =', multipolygon_within_distance) + +# Display relevant geometries on the map. +m = geemap.Map() +m.set_center(-122.085, 37.422, 15) +m.add_ee_layer( + multipolygon, {'color': 'black'}, 'Geometry [black]: multipolygon' +) +m.add_ee_layer(input_geom, {'color': 'blue'}, 'Parameter [blue]: input_geom') +m +# [END earthengine__apidocs__ee_geometry_multipolygon_withindistance]