Skip to content

Geographic Data

Generate millions of geographic coordinate records from minimal JSSON code. Perfect for legacy systems, mapping applications, and location-based services.

A developer on TabNews mentioned working with millions of geographic coordinate records in JSON for a legacy system. Writing and maintaining such files manually is:

  • Impractical — Can’t write millions of records by hand
  • Error-prone — Easy to make mistakes in repetitive data
  • Hard to maintain — Changes require updating thousands of lines

With JSSON, you can generate 10,000+ coordinate records from ~20 lines of code!

cityGrid [
template { id, zone }
map (point) = {
id = "grid-" + point.id
lat = -23.5505 + (point.id / 10) * 0.01
lon = -46.6333 + (point.id % 10) * 0.01
zone = point.zone
type = "grid_point"
precision = "high"
}
// Generate 10,000 coordinate points!
0..9999, "urban"
]
// Generate 10,000 points
0..9999, "urban"
// For MILLIONS of records:
0..999999, "urban"

Change one number to scale from thousands to millions!

map (point) = {
id = "grid-" + point.id
lat = -23.5505 + (point.id / 10) * 0.01
lon = -46.6333 + (point.id % 10) * 0.01
}

Calculate coordinates dynamically based on ID.

// Grid calculation
lat = -23.5505 + (point.id / 10) * 0.01
lon = -46.6333 + (point.id % 10) * 0.01

Use division and modulo to create coordinate grids.

deliveryRoute [
template { waypointId, routeId }
map (wp) = {
id = "wp-" + wp.routeId + "-" + wp.waypointId
routeId = "route-" + wp.routeId
sequence = wp.waypointId
lat = -23.5505 + (wp.waypointId * 0.001)
lon = -46.6333 + (wp.waypointId * 0.0015)
estimatedTime = wp.waypointId * 3
status = "pending"
}
// Route 1: 500 waypoints
0..499, 1
]
geofenceZones [
template { zoneId, category }
map (zone) = {
id = "zone-" + zone.zoneId
name = zone.category + "-zone-" + zone.zoneId
category = zone.category
centerLat = -23.5505 + (zone.zoneId * 0.05)
centerLon = -46.6333 + (zone.zoneId * 0.05)
radiusMeters = zone.category == "store" ? 100 : 500
alertOnEntry = true
alertOnExit = zone.category == "restricted" ? true : false
allowedActions = ["entry", "exit", "dwell"]
}
0..9, "store"
10..19, "warehouse"
20..24, "restricted"
]

Notice the arrays in objects (allowedActions) and ternary operators for conditional values!

ScaleJSSON LinesJSON RecordsRatio
Small201005:1
Medium2010,000500:1
Large201,000,00050,000:1

The same 20 lines can generate from hundreds to millions of records!

Perfect for:

  • Mapping applications with grid-based coordinates
  • Postal code boundary data
  • GPS tracking systems
  • Geofencing applications
  • Location-based services
  • Legacy systems requiring large JSON files

Not ideal for:

  • Unique, non-patterned coordinates
  • Real-time dynamic location data
  • Small datasets (< 100 records)
  1. Save the city grid example to geo.jsson
  2. Run: jsson -i geo.jsson -o geo.json
  3. Open geo.json — you’ll see 10,000 coordinate records!
  4. Want millions? Change 0..9999 to 0..999999

Generate massive datasets with minimal code! 🗺️