Polygon definitions
Contents
Page description
This is an admin/moderator page to which only specific users have access. The page is used to create rules used when importing polygon data from OpenStreetMap into Project-GC. The data is then used for calculations regarding placing geocaches in their correct region/county. The data is also used for rendering maps, as for example the maps in Profile stats.
Country selector
The country selector lists every country available in the Geocaching LIVE api. By selecting a new entry the country is automatically loaded, allow it 1-2 seconds to retrieve its data.
Data shown
In the first section there is basic metadata about the country shown, like the name of the country, and the ID in the [[Geocaching LIVE api|API]. Then it shows who has created the last definitions of rules and when. On the right side there is a list of region names used by Geocaching.com.
The region names in Project-GC **must** match those of Geocaching.com. Use relevant rule options to make this happen.
Source site
Project-GC uses OSM-boundaries.com as a source when importing its polygon data. This site is also a great source to use when building the import rules.
Rules
For Project-GC to know where a country (or region/county) exists in the world it needs the borders. In the most simple cases we can just match a country with an ID in the OpenStreetMap database and it's done. However it's not always that simple, especially for countries. For example the polygon for Finland includes Aland Islands while Aland Islands is its own country according to Geocaching.com. In this case we need to make more advanced rules defining and calculating new polygons in Project-GC.
All import rules are created as a JSON-string. Note that while keys that are positive integers don't have to be quoted, negative integers must.
Valid:
{-123: []}
Invalid:
{-123: []}
Valid:
{"-123": []}
You can look at already defined definitions to get an overall understanding how the definitions should look.
Country rules
All countries **must** be defined in Project-GC. This is primarily used when rendering maps for Profile stats, but they would look a bit funny if a country was missing.[1]
Country rules supports two kinds of keys only:
- includeIds - List of integer IDs from OSM-Boundaries.com. These are IDs of polygons that will be included in the country.
- subtractIds - List of integer IDs from OSM-Boundaries.com. The IDs listed here will be subtracted from the includeIds. For example in the case of Finland, the ID of Finland can be chosen as the country and then Aland Island can be subtracted.
Rather use one big polygon as include and a few subtract than a lot of includes. For example, USA either requires including the whole USA and then subtracting 3-5 polygons, or making a list of ~50 polygons for inclusion. There are two good reasons to rather include the whole country and then make a few subtracts.
- It's faster during the import phase.
- It makes a more readable definition.
Example of how to define Norway:
{"includeIds":[-2978650],"subtractIds":[-2425963,-1337126,-1337397]}
Region rules
County rules
Notes
This is a free-text form where you have the option to leave some notes. If there is nothing to say, just leave it empty. But for example when making a subtract it can be worth mentioning what's being subtracted.
Preview data
There is not yet any way to preview the data. Depending on how complex the definitions are it takes hours to calculate new polygons which makes it troublesome to show the moderator some form of preview. Ultimately we should also calculate the number of geocaches included in the polygons, both with old and new definitions - This would be even more expensive.
- ↑ Only true for the upcoming maps of Profile stats.