DEV Community

loading...

Create Routing App Coverage file for apple app store submission

erandakarachchi profile image Eranda Kudalugodaarachchi ・3 min read

If you're an iOS developer who loves creating apps, Somewhere in your development career, you might have developed apps that need to restrict the areas that your app is supporting.

According to apple's AppStore guidelines,
If your app uses location to provide routing information, you must supply a geographic coverage file before submitting your app to App Review.

Now let's find out how to create a Routing App Coverage file. For this, we have to use this awesome tool called http://geojson.io

Step 01

When you first navigate to it, it will look similar to this.

Screenshot 2020-12-06 at 23.26.55.png

Step 02

Then select an area that you want your app to support.

After selecting the area it should look like this.

Screenshot 2020-12-06 at 23.29.47.png

Generated JSON should look likes this.

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {},
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [
              79.508056640625,
              5.8127569137510084
            ],
            [
              82.0458984375,
              5.8127569137510084
            ],
            [
              82.0458984375,
              10.077037154404719
            ],
            [
              79.508056640625,
              10.077037154404719
            ],
            [
              79.508056640625,
              5.8127569137510084
            ]
          ]
        ]
      }
    }
  ]
}
Enter fullscreen mode Exit fullscreen mode

But we don't want all of these. You just need the data inside the geometry object. Extract the geometry object so that your JSON should look as follows.

{
  "type": "Polygon",
  "coordinates": [
    [
      [
        79.508056640625,
        5.8127569137510084
      ],
      [
        82.0458984375,
        5.8127569137510084
      ],
      [
        82.0458984375,
        10.077037154404719
      ],
      [
        79.508056640625,
        10.077037154404719
      ],
      [
        79.508056640625,
        5.8127569137510084
      ]
    ]
  ]
}
Enter fullscreen mode Exit fullscreen mode

Below you can find apple's guidelines for creating a Routing App Coverage file.

Define as specific a region as possible. For example, if your app provides subway route information only for New York, you don’t want it to receive requests to provide directions in London. The more specific the region you define, the more likely your app will appear in the search results.

Keep your regions simple and don’t try to trace precise routes around a given geographic area. It’s recommended that each polygon contain no more than 20 points. Using more coordinates to define a region is possible but is inefficient and usually unnecessary. The system has to determine whether a given point is inside one of your polygons, and it’s cheaper to make that determination against a rectangle or other simple shape than it is against a shape with hundreds of points.

Limit the number of child polygons in your MultiPolygon shape to 20 or fewer.
Use only MultiPolygon shapes in your app’s coverage file. Although the GeoJSON specification supports other types of shapes, only MultiPolygon shapes are supported for routing apps.

Don’t include comments in your coverage file.
Specify all coordinates as a longitude value followed by a latitude value.
Don’t include holes in the polygons in your coverage files. Although holes are supported by the GeoJSON specification, they are not supported in Apple’s map implementation.

According to the above guidelines, we can only have MultiPolygon elements inside our .geojson file. So we need to change the Polygon to MultiPolygon. This allows for multiple geographical areas to support our app.
When we change from Polygon to MultiPolygon, We need to modify our data too.

Our coordinates should be changed as follows,

{
  "type": "MultiPolygon",
  "coordinates": [
    [
      [
        [Polygon 1 data],
        [Polygon 2 data],
        ................
        [Polygon N data]
      ]
    ]
  ]
}
Enter fullscreen mode Exit fullscreen mode

After we modify our data as above, we should have something as follows,

{
  "type": "MultiPolygon",
  "coordinates": [
    [
      [
        [
          79.508056640625,
          5.8127569137510084
        ],
        [
          82.0458984375,
          5.8127569137510084
        ],
        [
          82.0458984375,
          10.077037154404719
        ],
        [
          79.508056640625,
          10.077037154404719
        ],
        [
          79.508056640625,
          5.8127569137510084
        ]
      ]
    ]
  ]
}

Enter fullscreen mode Exit fullscreen mode

Note: The start point and the ending point of the polygon needs to be the same.

Voila

Voila!

Now you can copy this JSON and create a file with the extension .geojson and upload it to the apple app store review.

This was originally published here

Discussion (1)

pic
Editor guide
Collapse
soumyadey profile image
Soumya Dey

Thanks a lot for this detailed guide 😁👌