Z-Order Curve Generator
Generate and visualize the Z-order space-filling curve (Morton curve) mapping multi-dimensional data to one dimension, with customizable grid size, colors, drawing speed, and step-by-step layout.
Z-Order Curve Generator - Visualize Space-Filling Curves
Generate and visualize Z-order curves (also known as Morton order or Morton code) with our free online generator. The Z-order curve is a space-filling curve that maps multidimensional data to one dimension while preserving locality. Named after the Z-shaped pattern formed by its construction, this curve is widely used in computer science for spatial indexing, quadtree construction, and improving cache performance in database systems.
What is a Z-Order Curve?
The Z-order curve is constructed by interleaving the binary representations of coordinate values. For two dimensions, the bits of the X and Y coordinates are interleaved to produce a single value called the Z-value or Morton code. When plotted in Z-order, points that are close in the multidimensional space tend to be close in the one-dimensional ordering — a property called locality preservation. This makes Z-order curves ideal for spatial data structures like quadtrees, UB-trees, and geospatial indexing systems.
Frequently Asked Questions
What is the difference between Z-order and Hilbert curves?
Both are space-filling curves, but the Z-order curve has a simpler construction (bit interleaving) and is faster to compute. The Hilbert curve has better locality preservation but is more complex to calculate. Z-order is preferred when computational speed matters. Explore other space-filling curves like the Hilbert Curve Generator or the Peano Curve Generator.
What are Z-order curves used for?
Z-order curves are widely used in geospatial databases (like PostGIS), quadtree/octree implementations, texture mapping in GPUs, image compression, and any application that needs efficient multidimensional data access on disk or in memory.
How many iterations can I generate?
You can generate up to 8 iterations (orders) of the Z-order curve. Each iteration quadruples the number of points, so order 8 produces 65,536 points for a detailed visualization.
Can I download the Z-order curve image?
Yes, you can download the curve as a PNG image or SVG vector file. SVG output preserves the curve details at any scale and is ideal for use in presentations or educational materials.
Can I customize the appearance?
Yes, you can customize the line color, background color, point color, and line thickness. You can also choose to show or hide the individual points along the curve.