Directory / plugin
Simple Location
v6.3.0 · by David Shanske
Adds geographic location and weather support to WordPress.
About this plugin
Supports adding geo coordinates, a location taxonomy, and a textual location description to a post, comment, user, or attachment. Supports adding weather data to a post or to a widget based on location.
Offers choice of map displays. It supports retrieving location using the HTML5 geolocation API by default. Clicking the location icon or ‘Lookup Location’ will retrieve the location.
As it stores the GeoData in the classic WordPress format, Geodata can also be added from other plugins.
Automatically saves location data from image metadata when uploaded as well.
Offers the opportunity to change the displayed timezone on a per-post basis for those posts from far off locations and set this based on the coordinates of the location.
While Gutenberg compatible, this is not built for Gutenberg.
Privacy and Data Notice
Simple Location stores location and weather data inside posts, attachments, comments, and term meta…optionally other post types. This data respects a public, private or
protected setting. Attachment data is automatically extracted from images if location is present, which could be extracted by any third-party downloading the picture
unless removed. For all other data, it is provided by the user, who decides its ultimate use. Location data is made available through a geolocation provider…the default is currently
HTML5 browser geolocation, for which the user must give consent to share). Other information is secured through use of third-party APIs to identify a
location, calculate elevation, display maps, and weather conditions.
If you choose readings under Fill In Missing Readings, the location of each post whose weather is missing them, including posts at a private location, is sent to Open-Meteo, rounded to about a kilometer, to fill them in.
Locations and Venues
Locations uses WordPress taxonomies to allow you to generate an archive page of all posts from that location and giving it a permalink on your site. Locations are meant to reflect a more general
location…for example, “Here are posts I made in California.”
Locations are divided by administrative areas. The hierarchy for locations is:
* Country
* Region – state, county, or province level.
* Locality – city, town, or village level
You can choose to display the location over the textual address field. There is an option in settings to change this behavior.
The reverse geocoding system attempts to consistently retrieve the country code, region code, and locality for the location and add them to the location taxonomy. This can be potentially problematic, as if the returns
from the locations added aren’t consistent, it will duplicate and explode the list of terms. This is the same issue that has held back venues.
Locations are matched using the country code, region code, and locality field, and therefore, you can edit the displayed name or the region code without issue. Due to matching issues, you may have to make some manual changes and there may be some occasional duplication.
When duplicates are created, such as two localities for the same city, select them in the Locations list and choose Merge. On the next screen, pick the location to keep; the oldest is picked by default. You can merge only locations of the same kind: countries, regions or localities. Their posts and child locations move to the one kept, the others’ names and codes are added to it so future lookups find it instead of creating the duplicate again, and the others are deleted, with their archive addresses redirecting to it.
There is no top level Location page, /location included in the plugin. You can create a page at this location and use a custom template to allow it to show a list of your locations.
Venues
Venues are meant to reflect a specific location, such as a business or point of interest. Venues were originally set up as a taxonomy, and were in the plugin unimplemented for several versions. However,
due to various changes since that was set up, they were switched to a custom post type. Under this setup, each venue is represented by a URL on the site that posts can be linked to. The URL contains
information about the venue. At this time, venues are shared between users and it is not assumed that each user has unique venues, though this may be a consideration in future.
Venues can be set to hide the actual location for privacy purposes, for example ‘Home’.
A venue can also set the visibility of posts made there with “Visibility of Posts Here”, for example Private at home. It applies when a post’s location is looked up in the editor, found in the background, sent by Micropub, or a check-in. A visibility chosen on the post, or sent by a Micropub client, still wins.
A venue is created when you check in, such as from a Micropub client, or with a bulk location lookup of check-ins. Before creating one, Simple Location looks for the venue you already have: the same place at a venue provider, the same website or page, or the same name close by. Checking in again from another provider adds to the venue you have instead of making a second one.
In the post editor, Find Venues lists the venues near the post’s latitude and longitude: those on your site, marked Site venue, and those from your venue providers, marked New venue, each in its own group. Choosing one of your venues sets it as the post’s venue; choosing a provider’s place creates the venue first, or uses the one you already have for it.
A Micropub post whose check-in or location is a place from q=places is linked to that venue: by its page on your site, or by the provider’s identifier it was found with. A location links a venue you already have but never creates one. A private venue is only linked for users who can edit it.
If a venue keeps being matched or listed when it shouldn’t be, check “Leave out of venue lists and check-in matching” on the venue. Find Venues and Micropub clients then won’t list it, and check-ins aren’t matched to it by name, link or identifier. You can still choose it from the Venue list or link to its page, and posts at its location still find it.
Micropub clients can ask for the places near a location with the experimental query q=places, giving lat and lon or a geo URI as uri. It returns places, a list of h-cards in mf2 JSON: your own venues first, then those of your venue providers, without the ones you already have. Each place says where it is from in provider, local for your own. limit sets the most places, and local=1 lists only your own venues. A private venue is only listed for users who can edit it, and a venue whose location is protected is listed without it. This replaces the earlier experimental q=geo query.
A venue’s website is shown on its page. Its pages on other sites, such as OpenStreetMap, Google Maps, Foursquare or Wikipedia, are shown too when the venue’s location is public, since a map link gives away where it is. You can edit both on the venue, under Website and Other Pages.
A new venue gets one of your venue types when one fits, such as Food for a restaurant, but Simple Location doesn’t create types. When a venue has no type, the venue editor offers one, which you can add.
To combine duplicate venues, select them in the Venues list and choose Merge. On the next screen, pick the venue to keep; the oldest is picked by default. Its posts, photos, child venues, links and types then include those of the others, check-ins by the others’ names or links find it, and the others are deleted, with their addresses redirecting to it.
What is kept from venue providers
Venue providers have different terms on what a site may keep. The plugin follows the maintainers’ reading of them, below. It is your site and your decision: if you read a provider’s terms differently, or aren’t comfortable with them, choose another provider.
- OpenStreetMap Overpass, Nominatim, LocationIQ, Geoapify and your own Pelias server – the place’s details are kept: address, phone, categories and links. OpenStreetMap data is under the Open Database License, which allows this with credit to OpenStreetMap contributors; a Pelias server’s other sources, such as Who’s On First and Foursquare’s open places, are open data too.
- Google, Foursquare, HERE, TomTom and Stadia Maps – only the place’s identifier and links are kept, such as its Google Maps or Foursquare link and its own website. The name is the one you checked in with, the coordinates are your own, and the address is looked up with your geocoding providers. Their phone numbers, categories and addresses are not stored.
- A check-in from a Micropub client that doesn’t name a venue provider is your own, and is kept as sent.
A search for venues is remembered for 10 minutes, so a check-in app asking again from the same place doesn’t use up your quota. This applies to the OpenStreetMap-based providers, Geoapify, Pelias and HERE, whose terms allow it, but not to Google, Foursquare, TomTom or Stadia Maps.
Weather
Weather consists of at minimum the current conditions and temperature but includes future parameters for use such as pressure, wind speed, wind direction degree, etc. Weather widgets are available
that can be set to a specific location, a user, station ID, or airport code. Station ID is available from supported providers for weather stations, for example from a Personal Weather Station(PWS).
Stations
Stations allow for using a custom data source for weather data: a URL that returns the station’s current conditions as JSON. When using the Custom Station provider for weather,
it uses the nearest station within 10 km of your location, and the widgets can show any station by its ID. Readings more than an hour old are not used.
Each station has an ID, a URL, and optionally its latitude and longitude, which are read from the station when it gives them, and a credit with a link, shown with its weather.
The JSON should use the current conditions format, version 1, which the weewx-current-json extension writes for WeeWX stations:
{
"format": "current-conditions",
"version": 1,
"time": 1761231600,
"units": "metric",
"station": { "id": "backyard", "name": "Backyard Weather", "latitude": 39.9524, "longitude": -75.1636, "altitude": 12,
"attribution": { "text": "Weather from Backyard Weather", "url": "https://weather.example.com/" } },
"observations": { "temperature": 21.5, "humidity": 61, "pressure": 1015.2, "windspeed": 3.58, "winddegree": 230, "rain": 1.27, "rainrate": 3.05, "code": 503 }
}
timeis when the observations were made, in Unix seconds.unitsismetric(degrees C, hPa, m/s, mm, mm/h, meters) orus(degrees F, inHg, mph, inches, inches per hour, miles).observationshas any of the plugin’s weather properties: temperature, humidity, dewpoint, heatindex, windchill, pressure, cloudiness, windspeed, winddegree, windgust, rain (in the last hour), rainrate, snow, visibility, radiation, illuminance, uv, aqi, and the pollutants pm1_0, pm2_5, pm10_0, co, co2, nh3, o3, pb and so2. Leave out what the station doesn’t measure.codeis a condition code, as listed in the weather settings, andsummaryis text; a known summary such as “Partly Cloudy” also gives a code. Without either, a station that measures solar radiation (or illuminance) gets an estimate of the sky by day: its reading is compared with what a clear sky would give at that time and place, from Clear Sky through Few, Scattered and Broken Clouds to Overcast. It isn’t estimated with the sun low in the sky, or at night.station.attributionis the station’s credit. A credit set in the station settings replaces it.
For a WeeWX station, install weewx-current-json and use the WeeWX weather provider instead. Its stations, under WeeWX Stations on the same tab, only need the URL of the file the extension writes, such as https://weather.example.com/current.json: the station’s ID, name and location are read from it when you save. The extension also estimates the condition, such as rain or partly cloudy, from the station’s sensors, a nearby airport, or the National Weather Service forecast. A condition or cloud cover from an airport is credited to aviationweather.gov, with the airport, and one from the forecast to the National Weather Service. A post from the last day, such as one backdated or sent by Micropub with an earlier time, gets the station’s weather from then, from the history in its file; with the extension’s archives turned on, so does a post from the last week. That history has no wind direction, condition or cloud cover; choose the conditions and cloud cover under Fill In Missing Readings to have Open-Meteo fill them in. The Weather Station widget can also show a WeeWX station’s high and low for the day, the pressure and temperature trend, the storm’s rain, its webcam, and, with weewx-nws, weather alerts; choose them in the widget. Low batteries and a weak signal that the station reports are shown to administrators on the Dashboard, with the provider errors.
JSON without format is read in the earlier format: the weather properties at the top level, in metric units, with wind as wind: { speed, degree, gust }, timestamp for the time, and N/A for missing values.
WordPress GeoData
WordPress Geodata is an existing standardized way to store geodata about a post, user, comment, or term.
It consists of four fields: latitude, longitude, public, and address. This matches up with the HTML5 Geolocation fields. The W3C Geolocation Specification
also provides for properties of altitude, accuracy, altitudeAccuracy, speed, and heading, which may be stored. Map Zoom is also stored as a geodata property.
Timezone is also stored as a property and is derived from the location by default or set manually.
In order to access private location information, the following custom capabilities are added to WordPress:
* ‘read_{$object_type}location’ – Whether or not a user is allowed to read information locations for object types: posts, comments, terms, users. A user is always allowed to read the location from their objects.
* ‘edit{$object_type}_location’ – Whether or not a user is allowed to edit information locations for object types: posts, comments, terms, users. A user is always allowed to read the location from their objects.
Providers
The plugin is designed to be extensible and anyone could write a plugin that would add additional providers.
- Map Providers are services that offer an API to retrieve maps, which are displayed on posts with a location. Providers include MapBox, Google, Mapquest, HERE, LocationIQ, Geoapify, TomTom, and Stadia Maps, as well as your own map server: a custom Static Maps API server, or TileServer GL.
- Geocoding Providers take geo coordinates and look up the actual location/address for textual display. Geocoding Providers include Nominatim, which can use the public OpenStreetMap server, your own server or another host, Photon, HERE, MapQuest, Google, LocationIQ, OpenRoute and Geonames. They also support looking up coordinate for physical addresses. Photon needs no key, and you can use komoot’s public server or run your own
- Venue providers, similar to Geocoding providers, …