Skip to content

Commit 4503303

Browse files
Daniel BerthereauDaniel Berthereau
authored andcommitted
Updated readme.
1 parent d20099c commit 4503303

4 files changed

Lines changed: 84 additions & 30 deletions

File tree

README.md

Lines changed: 77 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,26 @@ Data type Geometry (module for Omeka S)
55
> are available on [GitLab], which seems to respect users and privacy better
66
> than the previous repository.__
77
8-
[Data type Geometry] is a module for [Omeka S] that adds three new data types for
9-
the properties: `coordinate`, `geometry` and `geography`. It allows to manage
10-
points and areas on images and maps.
8+
[Data type Geometry] is a module for [Omeka S] that adds five new data types for
9+
the properties: `geography`, `geometry`, `geography:coordinates`, `geometry:coordinates`,
10+
`geometry:position`. It allows to manage points and areas on images and maps.
1111

12-
The datatype "Coordinates" uses the standard latitude/longitude, that is called
13-
nowadays "GPS" or even "Google coofdinates". The two other data types are
14-
managed with the standard [WKT] format.
12+
The datatype for geographic coordinates uses the standard latitude/longitude,
13+
that is called nowadays "GPS" or even "Google coordinates".
14+
15+
The data types are managed with the standard [WKT] format.
16+
17+
The geometric position and geometric coordinates are similar, but the first uses
18+
the top left corner as base and allows only integer values, so it is adapted to
19+
describe images by pixel, and the second use the arithmetic plane with the
20+
bottom left corner as base and allows floats.
1521

1622
It is used by the module [Annotate Cartography], that allows to point markers
1723
and to highlight images and maps. This module can be used independantly too.
1824

1925
It can be used with the module [Mapping]: a batch edit is added to convert
2026
literal data into geographical coordinates and vice-versa, so you can store
21-
markers as standard rdf data.
27+
markers as a standard rdf data in a property.
2228

2329
It can use an external database for performance.
2430

@@ -48,25 +54,36 @@ the module to `DataTypeGeometry`, go to the root of the module, and run:
4854
composer install --no-dev
4955
```
5056

57+
### Unsupported geographic queries
58+
59+
MySql does not support all geographic queries, for example to [search a point in a polygon for a sphere],
60+
so it is disabled by default in the config.
61+
62+
Queries are limited to geographic data, not geometric ones for now.
63+
64+
Because MariaDB [supports only geometric queries], search is disabled when it is used.
65+
5166
### Omeka database or external database [work in progress]
5267

5368
The geometries can be saved in Omeka database or in an external one. It’s useful
5469
to share them with other GIS systems. It allows to do advanced search and to
5570
browse quicker too.
5671

72+
By default, related to minimal database versions, Omeka support spatial search,
73+
but not spatial indexing.
74+
75+
To support searches of geometries, (distance around a point, geometries contained
76+
inside another geometry), the version of should be minimum [mySql 5.6.1] (2011-02)
77+
or [mariaDB 5.3.3] (2011-12-21). Note that the minimum Omeka version are [mySql 5.6.4]
78+
(2011-11-20, and [MariaDB 10.2.20] (2013-11-07)). For a precise support of
79+
geometry, see the [spatial support matrix].
80+
5781
So the database must support spatial indexing. It must be equal or greater than
5882
[MariaDB 10.2.2] (2016-09-27) or [mySql 5.7.5] (2014-09-25), for the engine
5983
InnoDB. Prior database releases can support spatial index too, but only with the
6084
engine MyIsam (that does not support referential integrity and is not used by
6185
Omeka). The choice between InnoDB and MyIsam is done automatically.
6286

63-
To support searches of geometres, (distance around a point, geometries contained
64-
inside another geometry), the version of should be minimum [mySql 5.6.1] (2011-02)
65-
or [mariaDB 5.3.3] (2011-12-21). Note that the minimum Omeka version is [mySql 5.5.3]
66-
(2010-03-24, equivalent to [MariaDB 5.5.20] (2012-02-25)), so some releases of
67-
mySql are below the minimum requirement of this module. For a precise support of
68-
geometry, see the [spatial support matrix].
69-
7087
You may prefer to use an external database. To config it, set the parameters in
7188
the file `config/database-cartography.ini`, beside your main `config/database.ini`.
7289
See the file `config/database-cartography.ini.dist` for more information. The
@@ -116,19 +133,22 @@ the Earth, in particular when the distances are longer than some dozen of
116133
kilometers.
117134

118135
Most of the time, the srid is [`4326`], because it’s the Mercator projection
119-
used by default in many geographic systems and by OpenStreetMap, the most truely
120-
open layer used for the web geolocation and by the module [Annotate Cartography].
136+
used by default in many expert geographic systems, included GPS. It is not the
137+
one used by OpenStreetMap and derivative web maps, that uses [`3857`]. The
138+
module [Annotate Cartography] uses 4326 too.
139+
121140
Another value can be set in the main settings, and each value can set a specific
122141
one with the ewkt format: `SRID=4326; POINT (2.294497 48.858252)`. It is not
123142
recommended to set it when it is the default one.
124143

125-
**Warning**: The data type `Geography` doesn’t support complex geometries (
126-
multipoint, multiline and multipolygon). In that case, it’s recommended to use
144+
**Warning**: The data type `Geography` doesn’t support complex geometries
145+
(multipoint, multiline and multipolygon). In that case, it’s recommended to use
127146
collections.
128147

129148
### Geographic coordinates
130149

131150
A geographic point is the latitude and longitude coordinates: `48.858252,2.294497`.
151+
132152
In the user interface, this value is composed with two decimal values (`xsd:decimal`),
133153
separated by a `,`. In the database, it is stored the same and as a geographic
134154
WKT point. In the api, the value is an object with the two keys (see below),
@@ -142,13 +162,34 @@ point is `Point(longitude latitude)`. The geographic point data type uses
142162
historical data, in "coordinates GPS", in OpenStreetMap coordinates or in "Google
143163
map".
144164

165+
### Geometric coordinates
166+
167+
A geometric point is a `x,y` pair: `2.294497,48.858252`.
168+
169+
In the user interface, this value is composed with two decimal values (`xsd:decimal`),
170+
separated by a `,`. In the database, it is stored the same and as a geometric
171+
WKT point. In the api, the value is an object with the two keys (see below),
172+
that can be used with the w3c geolocation api. The values are presented as
173+
strings to avoid issues with json implementations of clients.
174+
175+
### Geometric position
176+
177+
A geometric position is a `x,y` pair: `2,48`.
178+
179+
In the user interface, this value is composed with two positive integer values,
180+
separated by a `,`. In the database, it is stored the same and as a geometric
181+
WKT point. In the api, the value is an object with the two keys (see below),
182+
that can be used with the w3c geolocation api. The values are presented as
183+
strings to avoid issues with json implementations of clients.
184+
145185
### JSON-LD and GeoJSON
146186

147187
According to the [discussion] on the working group of JSON-LD and GeoJSON, the
148188
GeoJson cannot be used in all cases inside a JSON-LD. So the representation uses
149189
the data type `http://www.opengis.net/ont/geosparql#wktLiteral` of the [OGC standard].
150190
The deprecated datatype `http://geovocab.org/geometry#asWKT` is no more used.
151-
For coordinates, the data type is the api one, `geometry:geography:coordinates`.
191+
For coordinates and positions, the data type is the api one, `geography:coordinates`,
192+
`geometry:coordinates`, `geometry:position`.
152193

153194
```json
154195
{
@@ -159,7 +200,7 @@ For coordinates, the data type is the api one, `geometry:geography:coordinates`.
159200

160201
},
161202
{
162-
"@type": "geometry:geography:coordinates",
203+
"@type": "geography:coordinates",
163204
"@value": {
164205
"latitude": "48.858252",
165206
"longitude": "2.294497"
@@ -178,7 +219,11 @@ TODO
178219
- [ ] Add a button "select on map" in resource form to specify coordinates directly.
179220
- [ ] Add a js to convert wkt into svg icon (via geojson/d3 or directly).
180221
- [ ] Upgrade terraformer to terraformer.js (need a precompiled js).
181-
- [ ] Rename api keys to "geometry", "geography", "geography:coordinates" for Omeka S v4?
222+
- [x] Rename api keys to "geometry", "geography", "geography:coordinates" for Omeka S v4.
223+
- [ ] Support complex forms (multipoint, multiline, multipolygon)
224+
- [ ] Improve support of various srid for geography and enable search for geometry.
225+
- [ ] Store the srid in geography directly.
226+
- [ ] Fix parsing check for doctrine and terraformer, for example with an open polygon.
182227

183228

184229
Warning
@@ -236,30 +281,33 @@ Copyright
236281

237282
* See `asset/vendor/` and `vendor/` for the copyright of the libraries.
238283
* Some portions are adapted from the modules [Numeric data types] and [Neatline].
239-
* Copyright Daniel Berthereau, 2018-2021, (see [Daniel-KM] on GitLab)
284+
* Copyright Daniel Berthereau, 2018-2023, (see [Daniel-KM] on GitLab)
240285

241286
This module was built first for the French École des hautes études en sciences
242-
sociales [EHESS]. The improvements were developed for the future digital library
243-
of the [Campus Condorcet].
287+
sociales [EHESS]. The improvements were developed for the digital library of the
288+
[Campus Condorcet].
244289

245290

246291
[Data type Geometry]: https://gitlab.com/Daniel-KM/Omeka-S-module-DataTypeGeometry
247292
[Omeka S]: https://omeka.org/s
248293
[WKT]: https://wikipedia.org/wiki/Well-known_text
249294
[Annotate Cartography]: https://gitlab.com/Daniel-KM/Omeka-S-module-Cartography
250295
[Installing a module]: https://omeka.org/s/docs/user-manual/modules/#installing-modules
251-
[MariaDB 10.2.2]: https://mariadb.com/kb/en/library/spatial-index/
252-
[mySql 5.7.5]: https://dev.mysql.com/doc/relnotes/mysql/5.7/en/news-5-7-5.html#mysqld-5-7-5-innodb
253-
[mySql 5.5.3]: https://dev.mysql.com/doc/relnotes/mysql/5.5/en/news-5-5-3.html
254-
[MariaDB 5.5.20]: https://mariadb.com/kb/en/library/mariadb-5521-release-notes/
255296
[mySql 5.6.1]: https://dev.mysql.com/doc/relnotes/mysql/5.6/en/news-5-6-1.html
256297
[MariaDB 5.3.3]: https://mariadb.com/kb/en/library/mariadb-533-release-notes/
298+
[mySql 5.6.4]: https://dev.mysql.com/doc/relnotes/mysql/5.6/en/news-5-6-4.html
299+
[MariaDB 10.2.20]: https://mariadb.com/kb/en/library/spatial-index/
257300
[spatial support matrix]: https://mariadb.com/kb/en/library/mysqlmariadb-spatial-support-matrix/
301+
[MariaDB 10.2.2]: https://mariadb.com/kb/en/library/spatial-index/
302+
[mySql 5.7.5]: https://dev.mysql.com/doc/relnotes/mysql/5.7/en/news-5-7-5.html#mysqld-5-7-5-innodb
258303
[`data_type_geometry`]: https://gitlab.com/Daniel-KM/Omeka-S-module-DataTypeGeometry/-/blob/master/data/install/schema.sql#L1-10
259304
[`data_type_geography`]: https://gitlab.com/Daniel-KM/Omeka-S-module-DataTypeGeometry/-/blob/master/data/install/schema.sql#L11-20
260305
[DataTypeGeometry.zip]: https://gitlab.com/Daniel-KM/Omeka-S-module-DataTypeGeometry/-/releases
261306
[doctrine2-spatial]: https://github.com/creof/doctrine2-spatial/blob/HEAD/doc/index.md
307+
[search a point in a polygon for a sphere]: https://dev.mysql.com/doc/mysql-errors/8.0/en/server-error-reference.html
308+
[supports only geometric queries]: https://mariadb.com/kb/en/st_srid
262309
[`4326`]: https://epsg.io/4326
310+
[`3857`]: https://epsg.io/3857
263311
[discussion]: https://github.com/json-ld/json-ld.org/issues/397
264312
[OGC standard]: https://www.ogc.org/standards/geosparql
265313
[module issues]: https://gitlab.com/Daniel-KM/Omeka-S-module-DataTypeGeometry/-/issues
@@ -270,6 +318,6 @@ of the [Campus Condorcet].
270318
[Numeric data types]: https://github.com/omeka-s-modules/NumericDataTypes
271319
[Neatline]: https://github.com/performant-software/neatline-omeka-s
272320
[EHESS]: https://www.ehess.fr
273-
[Campus Condorcet]: https://campus-condorcet.fr
321+
[Campus Condorcet]: https://bibnum.campus-condorcet.fr
274322
[GitLab]: https://gitlab.com/Daniel-KM
275323
[Daniel-KM]: https://gitlab.com/Daniel-KM "Daniel Berthereau"

src/DataType/AbstractDataType.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ public function getJsonLd(ValueRepresentation $value)
9595
/**
9696
* Convert a wkt string (with or without srid) into a geometry array.
9797
*
98+
* @todo Check doctrine and terraformer parser for valid wkt (exemple: open polygon).
99+
*
98100
* @param string $value
99101
* @return array|null
100102
*/

src/DataType/Geography.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ class Geography extends AbstractDataType
1111
/**
1212
* The default srid.
1313
*
14+
* This is used in GPS and Google Earth and expert tools.
15+
* 3857 is used in web maps like OpenStreetMap and derivative like Google Maps, OpenStreetMap, Bing, ArcGIS, ESRI.
16+
*
1417
* @link http://www.opengis.net/def/crs/OGC/1.3/CRS84
18+
* @link https://epsg.io/3857
1519
* @link https://epsg.io/4326
1620
*
1721
* @var int

src/Form/ConfigForm.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function init(): void
2323
'options' => [
2424
'label' => 'Spatial reference id (Srid) for Locate', // @translate
2525
'info' => 'The Srid allows to take the curvature of the Earth into account for map.
26-
Recommended: 0 or 4326.
26+
Recommended: 3857 (OpenStreetMap and web maps) or 4326 (default, used by gps and expert tools).
2727
It is displayed in the json-ld output.', // @translate
2828
],
2929
'attributes' => [

0 commit comments

Comments
 (0)