Difference between revisions of "Location"

From AMTech WikiDocs
Jump to: navigation, search
(Edit by map)
 
(11 intermediate revisions by 4 users not shown)
Line 1: Line 1:
location supported property is represented using Well-known text (wkt) format
+
All things and observations have a "location" supported property, represented using an extended Well-Known Text (wkt) format
*[https://en.wikipedia.org/wiki/Well-known_text Well-known text]
+
*[https://en.wikipedia.org/wiki/Well-known_text Well-known text] extended with two more shapes
*observations and things have a location property
+
** RECTANGLE( ''lng1'' ''lat1'', ''lng2'' ''lat2'') rectangle where ''lng1'', ''lat1'' are the south-west point longitude and latitude and ''lng2'', ''lat2'' are the north-east limit coordinates.
**this property can be used to define observer geo-spatial criteria  (See [[Observers|Observers]])  
+
** CIRCLE ( ''lng'' ''lat'', ''r'') circle with center on coordinates ''lng'',''lat'' and radius ''r'' in km. 
**allows a geo-representation of the things  
+
*Observations and things have a location property
 +
**This property can be used to define observer geo-spatial criteria  (See [[Observers|Observers]])  
 +
**Allows a geo-representation of the things  
 
<syntaxhighlight lang="jsonld">
 
<syntaxhighlight lang="jsonld">
 
{
 
{
Line 14: Line 16:
 
}
 
}
 
</syntaxhighlight>
 
</syntaxhighlight>
  Note: It is important to escape the quotation marks (") with \"
+
{{Note|It is important to escape the quotation marks (") with \"}}
  
The value of this field consist on a stringified json object containing a mandatory field "wkt" defining the geometry, and two optional fields "sContext" (holding only "geo" as value to indicate that the wkt is written in geospatial context coordinates) and "hash" containing the [https://en.wikipedia.org/wiki/Geohash geohash] corresponding to the bounding rectangle of the given wkt. The field "hash" is computed internally so any value entered is ignored by the application.  
+
The value of the location field consists on a stringified json object containing a mandatory field "wkt" defining the geometry, and two optional fields "sContext" (holding only "geo" as value to indicate that the wkt is written in geospatial context coordinates) and "hash" containing the [https://en.wikipedia.org/wiki/Geohash geohash] corresponding to the bounding rectangle of the given wkt. The field "hash" is computed internally so any value entered is ignored by the application.  
  
The spatial location fields can be visually edited with the map or by writing the string in an input box
+
The spatial location fields can be visually edited with the map or by writing the string in an input box.
  
==Edit by map==
+
== Edit by map ==
Whenever a spatial field is edited (for instance, the "location" field on things), the map will enable the [[Spatial view#editionControls|edition controls]]. Using them will set the newly defined geometry as the value of the edited field.
+
Whenever a spatial field is edited (for instance, the "location" field on things), the map will enable the [[Spatial view#editionControls|edition controls]]. Using them will set the newly defined geometry as the value of the edited field.  
  
==Edit by input box==
+
{{Note|When a thing type says that it allows only a type of geometry for its instances, the map editor will only allow to edit this kind of geometry. However, it is important to know that the location field will still allow any kind of geometry when set manually (e.g. via REST or as an action result).}}
In some cases, in particular when defining a spatial constraint in an [[observer]], a location based field can be set by writing the whole string in an input.  
+
 
 +
== Edit by input box ==
 +
In some cases, in particular when defining a spatial constraint in an [[Observers|observer]], a location based field can be set by writing the whole string in an input.  
 
For instance, to define a rectangle it should be written  
 
For instance, to define a rectangle it should be written  
 
   {"wkt":"RECTANGLE(-100 19,-98 20)"}
 
   {"wkt":"RECTANGLE(-100 19,-98 20)"}
 
The application itself will escape the quotation marks. Also, once the input loose the focus (clicked outside the input box), the geometry drawn in the map will be updated.
 
The application itself will escape the quotation marks. Also, once the input loose the focus (clicked outside the input box), the geometry drawn in the map will be updated.

Latest revision as of 22:14, 20 October 2016

All things and observations have a "location" supported property, represented using an extended Well-Known Text (wkt) format

  • Well-known text extended with two more shapes
    • RECTANGLE( lng1 lat1, lng2 lat2) rectangle where lng1, lat1 are the south-west point longitude and latitude and lng2, lat2 are the north-east limit coordinates.
    • CIRCLE ( lng lat, r) circle with center on coordinates lng,lat and radius r in km.
  • Observations and things have a location property
    • This property can be used to define observer geo-spatial criteria (See Observers)
    • Allows a geo-representation of the things
{
    ...
    "location": "{
                    \"sContext\" : \"geo\", 
                    \"wkt\" : \"POINT(-99.16297853 19.42359932)\"
                 }",
    ...
}

Note: It is important to escape the quotation marks (") with \"

The value of the location field consists on a stringified json object containing a mandatory field "wkt" defining the geometry, and two optional fields "sContext" (holding only "geo" as value to indicate that the wkt is written in geospatial context coordinates) and "hash" containing the geohash corresponding to the bounding rectangle of the given wkt. The field "hash" is computed internally so any value entered is ignored by the application.

The spatial location fields can be visually edited with the map or by writing the string in an input box.

Edit by map

Whenever a spatial field is edited (for instance, the "location" field on things), the map will enable the edition controls. Using them will set the newly defined geometry as the value of the edited field.

Note: When a thing type says that it allows only a type of geometry for its instances, the map editor will only allow to edit this kind of geometry. However, it is important to know that the location field will still allow any kind of geometry when set manually (e.g. via REST or as an action result).

Edit by input box

In some cases, in particular when defining a spatial constraint in an observer, a location based field can be set by writing the whole string in an input. For instance, to define a rectangle it should be written

 {"wkt":"RECTANGLE(-100 19,-98 20)"}

The application itself will escape the quotation marks. Also, once the input loose the focus (clicked outside the input box), the geometry drawn in the map will be updated.