### Draw Polylines on Globe with React Source: https://context7.com/openglobus/openglobus-react/llms.txt This example shows how to draw lines and paths on the globe using the Polyline component. It allows for defining multiple path segments, specifying colors for each segment, and customizing the thickness, altitude, and opacity of the line. ```tsx import React from 'react'; import { GlobeContextProvider, Globe, Vector, Entity, Polyline } from '@openglobus/openglobus-react'; function MapWithRoute() { const routePath = [ [ [-122.4194, 37.7749, 10000], // San Francisco [-118.2437, 34.0522, 10000], // Los Angeles [-112.0740, 33.4484, 10000] // Phoenix ] ]; const pathColors = [ ['#FF0000', '#00FF00', '#0000FF'] ]; return (
); } export default MapWithRoute; ``` -------------------------------- ### Display GLTF 3D Models on Globe with React Source: https://context7.com/openglobus/openglobus-react/llms.txt This example demonstrates loading and displaying 3D models in GLTF/GLB format at specific geographic locations using the Gltf component. It allows for precise placement using longitude, latitude, altitude, and rotation parameters (yaw, pitch, roll). ```tsx import React from 'react'; import { GlobeContextProvider, Globe, Vector, Entity, Gltf } from '@openglobus/openglobus-react'; function MapWith3DModels() { return (
); } export default MapWith3DModels; ``` -------------------------------- ### Create and Configure Vector Layer Source: https://context7.com/openglobus/openglobus-react/llms.txt This snippet demonstrates the creation of a Vector layer within the OpenGlobus React application. The Vector component acts as a container for geospatial entities and supports features like visibility management, scaling based on distance, and event handling, such as `onMouseEnter`. The example includes a basic event handler to log entity properties when the mouse hovers over an object within the layer. ```tsx import React from 'react'; import { GlobeContextProvider, Globe, Vector } from '@openglobus/openglobus-react'; function MapWithVectorLayer() { const handleMouseEnter = (e) => { console.log('Mouse entered:', e.pickingObject.entity.properties); }; return (
{/* Entities go here */}
); } export default MapWithVectorLayer; ``` -------------------------------- ### Add XYZ Tile Layer to Globe Source: https://context7.com/openglobus/openglobus-react/llms.txt This example shows how to add a raster tile layer to the OpenGlobus globe using the XYZ component. It configures the layer with a name, URL pointing to an XYZ tile service (OpenStreetMap in this case), attribution, zoom level constraints, opacity, and visibility. This allows for displaying base map imagery. ```tsx import React from 'react'; import { GlobeContextProvider, Globe, XYZ } from '@openglobus/openglobus-react'; function MapWithCustomTiles() { return (
); } export default MapWithCustomTiles; ``` -------------------------------- ### Add Entities with Billboards to Vector Layer Source: https://context7.com/openglobus/openglobus-react/llms.txt This example illustrates how to add individual geographic entities to a Vector layer and display them as image markers using the Billboard component. Each Entity is defined by its geographic coordinates (longitude, latitude, altitude) and custom properties. The Billboard component is configured with an image source, size, color, rotation, and offset to customize the marker's appearance. The code iterates over a list of locations to create multiple entities. ```tsx import React from 'react'; import { GlobeContextProvider, Globe, Vector, Entity, Billboard } from '@openglobus/openglobus-react'; function MapWithMarkers() { const locations = [ { lon: -122.4194, lat: 37.7749, name: 'San Francisco' }, { lon: -118.2437, lat: 34.0522, name: 'Los Angeles' }, { lon: -73.9352, lat: 40.7306, name: 'New York' } ]; return (
{locations.map((loc, idx) => ( ))}
); } export default MapWithMarkers; ``` -------------------------------- ### Initialize Globe with Context Provider Source: https://context7.com/openglobus/openglobus-react/llms.txt This snippet demonstrates how to set up the fundamental OpenGlobus React application structure. It initializes the GlobeContextProvider to manage the globe's state and renders the Globe component, which serves as the main container for all geospatial content. The Globe component is configured with atmosphere and sun effects, and its initial view extent is set. ```tsx import React from 'react'; import { GlobeContextProvider, Globe } from '@openglobus/openglobus-react'; function App() { return (
); } export default App; ``` -------------------------------- ### Interactive Globe with City Selection and Route Display - React Source: https://context7.com/openglobus/openglobus-react/llms.txt This React component creates an interactive 3D globe. It displays cities with labels and billboards, allows users to select a city to view its details, and toggles the visibility of a route between two points. The component utilizes state management for dynamic updates and integrates various OpenGlobus React components like Globe, Entity, Vector, Billboard, Label, Polyline, and PlanetCamera. ```tsx import React, { useState } from 'react'; import { GlobeContextProvider, Globe, Vector, Entity, Billboard, Label, Polyline, PlanetCamera } from '@openglobus/openglobus-react'; function InteractiveMap() { const [selectedCity, setSelectedCity] = useState(null); const [showRoute, setShowRoute] = useState(true); const cities = [ { id: 1, lon: -122.4194, lat: 37.7749, name: 'San Francisco', population: '874,961' }, { id: 2, lon: -118.2437, lat: 34.0522, name: 'Los Angeles', population: '3,979,576' } ]; const route = [[ [-122.4194, 37.7749, 5000], [-118.2437, 34.0522, 5000] ]]; const handleCityClick = (cityId) => { setSelectedCity(cities.find(c => c.id === cityId)); }; return (
{selectedCity && (

{selectedCity.name}

Population: {selectedCity.population}

)}
handleCityClick(e.pickingObject.entity.id)}> {cities.map(city => ( ))} {showRoute && ( )} {selectedCity && ( )}
); } export default InteractiveMap; ``` -------------------------------- ### Control Planet Camera Programmatically with React Source: https://context7.com/openglobus/openglobus-react/llms.txt This snippet shows how to control the camera's position and view angle programmatically using the PlanetCamera component in React. It utilizes `useState` for managing camera state and allows for smooth animations when changing camera coordinates. Dependencies include React and @openglobus/openglobus-react. ```tsx import React, { useState } from 'react'; import { GlobeContextProvider, Globe, PlanetCamera } from '@openglobus/openglobus-react'; function MapWithCameraControl() { const [cameraPosition, setCameraPosition] = useState({ lon: -122.4194, lat: 37.7749, alt: 10000 }); const flyToNewYork = () => { setCameraPosition({ lon: -73.9352, lat: 40.7306, alt: 10000 }); }; return (
); } export default MapWithCameraControl; ``` -------------------------------- ### Overlay Geographic Images with React Source: https://context7.com/openglobus/openglobus-react/llms.txt This snippet demonstrates how to overlay images on specific geographic extents using the GeoImage component in React. It ensures proper projection of the image onto the globe based on provided corner coordinates. Dependencies include React and @openglobus/openglobus-react. ```tsx import React from 'react'; import { GlobeContextProvider, Globe, GeoImage } from '@openglobus/openglobus-react'; function MapWithImageOverlay() { return (
); } export default MapWithImageOverlay; ``` -------------------------------- ### Render GeoJSON Geometries on Globe with React Source: https://context7.com/openglobus/openglobus-react/llms.txt This snippet illustrates rendering GeoJSON-style geometries, such as polygons, on the globe using the Geometry component. It supports various geometry types and allows customization of fill color, line color, stroke, and width. ```tsx import React from 'react'; import { GlobeContextProvider, Globe, Vector, Entity, Geometry } from '@openglobus/openglobus-react'; function MapWithGeometry() { const polygonCoords = [ [ [-122.5, 37.5, 0], [-122.5, 38.0, 0], [-122.0, 38.0, 0], [-122.0, 37.5, 0], [-122.5, 37.5, 0] ] ]; return (
); } export default MapWithGeometry; ``` -------------------------------- ### Add Labels to Geographic Locations with React Source: https://context7.com/openglobus/openglobus-react/llms.txt This snippet demonstrates how to add text labels to specific geographic coordinates on a globe using the Label component from '@openglobus/openglobus-react'. It includes styling options such as text, size, color, outline, font, alignment, and opacity. ```tsx import React from 'react'; import { GlobeContextProvider, Globe, Vector, Entity, Label } from '@openglobus/openglobus-react'; function MapWithLabels() { return (
); } export default MapWithLabels; ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.