An interactive 3D globe visualization built with Next.js, React Three Fiber, and Three.js that displays world country boundaries using GeoJSON data.
- Framework: Next.js 15.4.5 with Turbopack
- UI: React 19 with TypeScript
- 3D Graphics: Three.js, React Three Fiber, React Three Drei
- Styling: Tailwind CSS 4
- Data: GeoJSON world boundaries
- Node.js 18+ or Bun
- Modern web browser with WebGL support
- Clone the repository:
git clone https://github.com/Code-Parth/geo-globe-three
cd geo-globe-three- Install dependencies:
bun install
# or
npm install- Start the development server:
bun run dev
# or
npm run dev- Open http://localhost:3000 in your browser.
dev- Start development server with Turbopackbuild- Build for productionstart- Start production serverlint- Run ESLintlint:fix- Fix linting issues and format with Prettier
The main 3D globe visualization that:
- Loads world boundary data from GeoJSON
- Converts geographic coordinates to 3D sphere coordinates
- Renders country outlines as white lines on a dark sphere
- Supports both Polygon and MultiPolygon geometries
A responsive layout wrapper that:
- Creates an adaptive grid overlay
- Provides corner markers for visual framing
- Maintains responsive design across different screen sizes
- Rotate: Click and drag to rotate the globe
- Zoom: Scroll wheel to zoom in/out (limited between 4-12 units)
- Pan: Disabled for focused globe interaction
The globe can be customized by modifying parameters in app/page.tsx:
- Sphere radius: Adjust the
radiusparameter inconvertToSphereCoordinates - Camera position: Modify the
cameraprop in the Canvas component - Material colors: Change sphere and line materials in the Globe component
- Control limits: Adjust min/max distance and speeds in OrbitControls
The project uses world boundary data from a GeoJSON file (public/world.geojson) that contains:
- Country polygons and multipolygons
- Detailed boundary coordinates
- Country metadata and properties
- Fork the repository
- Create a feature branch
- Make your changes
- Run
bun run lint:fixto ensure code quality - Submit a pull request
The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.
Check out the Next.js deployment documentation for more details.
