# Areas beta

# GeoJSON format

GeoGuess uses GeoJSON format to specify maps where you are playing.

In FeatureCollection > Feature<Polygon>

# Area Details

A feature must have one property.

{"type":"FeatureCollection","features":[
    {
      "type": "Feature",
      "properties": {
        "name": "New York",
      },
      "geometry": {
        "type": "Polygon",
        ...
      }
    }
]}

# Areas list

You can add your custom area mode to the homepage in the JSON file on the Github Maps Repo, under areas.

{
    "name": string | object,
    "description": string | object,
    "author":  string,
    "imageUrl": urlString (width = 500 & heigth = 230),
    "data": AreasModeObject
}

# AreasModeObject

{
    "data": {
        "urlArea": urlGeoJSON,
        "bbox": Array<Number>,
        "pathKey": string,
        "type": "nominatim" | "polygon" ,
        ...
    }
}
  • urlArea: url of the areas GeoJSON
  • pathKey: path of the property key
    • Examples :
      {
          "type": "Feature",
          "properties": {
              "name": "New York", // 'name'
              "state":{
                  "name": "New York", // "state.name"
              }
          },
      }
      
  • bbox (optional): bounding box of the area mode. Player aren't allow to play outside.

# Type: nominatim

Use Reverse Geocoding of Nominatim.org, to determine the area of the random latitude, longitude.

  1. Define query params of the request with nominatimQueryParams
fetch(
    `https://nominatim.openstreetmap.org/reverse?lat=${latLng.lat()}&lon=${latLng.lng()}&format=json&${new URLSearchParams(nominatimQueryParams)}`
)
  1. Get the key in the response with nominatimResultPath

Example:

"nominatimQueryParams": {
  "zoom": "5",
  "addressdetails": "1",
  "accept-language": "en"
},
"nominatimResultPath": "address.state",

# Type: polygon

Check if the random location is in the GeoJson Feature<Polygon> automatically.

"data": {
   "urlArea": "https://raw.githubusercontent.com/GeoGuess/GeoGuess-Maps/main/areas/continents.json",
   "pathKey": "continent",
   "type": "polygon"
}

# Example

{
  "name": "US States",
  "author": "BilelJegham",
  "data": {
    "bbox": [
      -171.79111060289117, 18.916190000000142, -66.96466, 71.35776357694175
    ],
    "urlArea": "https://raw.githubusercontent.com/martynafford/natural-earth-geojson/master/110m/cultural/ne_110m_admin_1_states_provinces.json",
    "type": "nominatim",
    "pathKey": "name",
    "nominatimResultPath": "address.state",
    "nominatimQueryParams": {
      "zoom": "5",
      "addressdetails": "1",
      "accept-language": "en"
    }
  }
},