Documentation
¶
Index ¶
- func GetAreaFilterStr(id int, ids ...int) string
- func GetAroundFilterStr(radius float64, coordinates [][]float64, inputSetName ...string) string
- func GetBoundingBoxFilterStr(south float64, west float64, north float64, east float64) string
- func GetIDFilterStr(id int, ids ...int) string
- func GetPolygonFilterStr(coordinates [][]float64) string
- func GetRecurseFilterStr(elementRecurseType ElementRecurseType) string
- func QueryOverpass(query string, maxAttempts ...int) (response string, err error)
- func QueryOverpassBytes(query string, maxAttempts ...int) (response []byte, err error)
- type DifferenceStatement
- type ElementFilter
- type ElementFilterType
- type ElementRecurseType
- type ElementStatement
- type ElementType
- type OutStatement
- type OutType
- type RecurseStatement
- type RecurseType
- type SetStatement
- type Setting
- type SettingType
- type SettingsStatement
- type StackStatement
- func (s *StackStatement) Append(statements ...Statement)
- func (s *StackStatement) Execute(maxAttempts ...int) (string, error)
- func (s *StackStatement) ExecuteAndExport(filename string, maxAttempts ...int) (string, error)
- func (s *StackStatement) GetCompiled() string
- func (s *StackStatement) GetSetName() string
- type Statement
- type TagFilter
- type TagFilterType
- type UnionStatement
- type VebosityType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAreaFilterStr ¶
func GetAroundFilterStr ¶
Input coordinates for the polygon are in GeoJSON polygon format i.e. [[lon1, lat1], [lon2, lat2], ...] OSM expects string format "lat1,lon1,lat2,lon2, ..."
func GetBoundingBoxFilterStr ¶
func GetIDFilterStr ¶
func GetPolygonFilterStr ¶
Input coordinates for the polygon are in GeoJSON polygon format i.e. [[lon1, lat1], [lon2, lat2], ...] OSM expects string format "lat1 lon1 lat2 lon2 ..."
func GetRecurseFilterStr ¶
func GetRecurseFilterStr(elementRecurseType ElementRecurseType) string
func QueryOverpass ¶
Specify maxAttempts tp retry when rate limited, defaults to 1 Returns string
Types ¶
type DifferenceStatement ¶
type DifferenceStatement struct {
SetName string `default:"_"`
FirstStatement Statement
SecondStatement Statement
// contains filtered or unexported fields
}
func NewDifferenceStatement ¶
func NewDifferenceStatement(resultSetName string, firstStatement Statement, secondStatement Statement) *DifferenceStatement
func (*DifferenceStatement) GetCompiled ¶
func (s *DifferenceStatement) GetCompiled() string
func (*DifferenceStatement) GetSetName ¶
func (s *DifferenceStatement) GetSetName() string
type ElementFilter ¶
type ElementFilter struct {
ElementFilterType ElementFilterType
FilterStr string
}
func NewElementFilter ¶
func NewElementFilter(elementFilterType ElementFilterType, args ...interface{}) *ElementFilter
Returns a pointer to a new ElementFilter, this constructor will also compile the filter string needed for the final query.
The args of this function depends on the elementFilterType, the signature should match:
BoundingBoxFilter: GetBoundingBoxFilterStr(south float64, west float64, north float64, east float64) string RecurseFilter: GetRecurseFilterStr(elementRecurseType ElementRecurseType) string IDFilter: GetIDFilterStr(id int, ids ...int) string AroundFilter: GetAroundFilterStr(radius float64, coordinates [][]float64, inputSetName ...string) string PolygonFilter: GetPolygonFilterStr(coordinates [][]float64) string AreaFilter: GetAroundFilterStr(radius float64, coordinates []float64, setName ...string) string
type ElementFilterType ¶
type ElementFilterType string
const ( BoundingBoxFilter ElementFilterType = "BoundingBoxFilter" // The bounding box query filter selects all elements within a rectangular bounding box, (south,west,north,east), e.g. node(50.6,7.0,50.8,7.3); RecurseFilter ElementFilterType = "RecurseFilter" // The recurse filter selects all elements that are members of an element from the input set or have an element of the input set as member, depending on the given parameter, e.g. node(w) IDFilter ElementFilterType = "IDFilter" // The id-query filter selects the element of given type with given id AroundFilter ElementFilterType = "AroundFilter" // The around filter selects all elements within a certain radius in metres around the elements in the input set PolygonFilter ElementFilterType = "PolygonFilter" // The third variant selects all elements that have a tag with a certain key and a value that matches some regular expression AreaFilter ElementFilterType = "AreaFilter" // The pivot filter selects the element of the chosen type that defines the outline of the given area )
type ElementRecurseType ¶
type ElementRecurseType string
const ( W ElementRecurseType = "w" // Forward from ways, e.g. node(w); select child nodes from ways in the input set R ElementRecurseType = "r" // Forward from relations, e.g. node(r); select node members of relations in the input set BN ElementRecurseType = "bn" // Backward from nodes, e.g. way(bn); select parent ways for nodes in the input set BW ElementRecurseType = "bw" // Backward from ways, e.g. rel(bw); select relations that have way members in the input set BR ElementRecurseType = "br" // Backward from relations, e.g. rel(br); select parent relations from relations in the input set )
type ElementStatement ¶
type ElementStatement struct {
ElementType ElementType
TagFilters []TagFilter
ElementFilter *ElementFilter
// contains filtered or unexported fields
}
func NewElementStatement ¶
func NewElementStatement(elementType ElementType, tagFilters []TagFilter, elementFilter ...*ElementFilter) *ElementStatement
func (*ElementStatement) GetCompiled ¶
func (s *ElementStatement) GetCompiled() string
func (*ElementStatement) GetSetName ¶
func (s *ElementStatement) GetSetName() string
type ElementType ¶
type ElementType string
const ( Node ElementType = "node" Way ElementType = "way" Relation ElementType = "relation" Area ElementType = "area" )
type OutStatement ¶
type OutStatement struct {
VebosityType VebosityType
// contains filtered or unexported fields
}
func NewOutStatement ¶
func NewOutStatement(verbosityType VebosityType) *OutStatement
func (*OutStatement) GetCompiled ¶
func (s *OutStatement) GetCompiled() string
func (*OutStatement) GetSetName ¶
func (s *OutStatement) GetSetName() string
type RecurseStatement ¶
type RecurseStatement struct {
RecurseType RecurseType
// contains filtered or unexported fields
}
func NewRecurseStatement ¶
func NewRecurseStatement(recurseType RecurseType) *RecurseStatement
func (*RecurseStatement) GetCompiled ¶
func (s *RecurseStatement) GetCompiled() string
func (*RecurseStatement) GetSetName ¶
func (s *RecurseStatement) GetSetName() string
type RecurseType ¶
type RecurseType string
const ( RecurseDown RecurseType = ">" // All nodes that are part of a way which appears in the input set; plus all nodes and ways that are members of a relation which appears in the input set; plus all nodes that are part of a way which appears in the result set RecurseDownRelations RecurseType = ">>" // Continues to follow the membership links including nodes in ways until for every object in its input or result set all the members of that object are in the result set as well. RecurseUp RecurseType = "<" // All ways that have a node which appears in the input set; plus all relations that have a node or way which appears in the input set; plus all relations that have a way which appears in the result set RecurseUpRelations RecurseType = "<<" // Continues to follow backlinks onto the found relations until it contains all relations that point to an object in the input or result set )
type SetStatement ¶
type SetStatement struct {
SetName string
// contains filtered or unexported fields
}
func NewSetStatement ¶
func NewSetStatement(setName string) *SetStatement
func (*SetStatement) GetCompiled ¶
func (s *SetStatement) GetCompiled() string
func (*SetStatement) GetSetName ¶
func (s *SetStatement) GetSetName() string
type Setting ¶
type Setting struct {
Key SettingType
Value string
Options string
}
func NewSetting ¶
func NewSetting(key SettingType, value interface{}, options ...string) *Setting
type SettingType ¶
type SettingType string
const ( Out SettingType = "out" // The out setting defines the output format used to return OSM data, default value is xml, see OutType Timeout SettingType = "timeout" // The timeout: setting has one parameter, a non-negative integer. Default value is 180 Maxsize SettingType = "maxsize" // The maxsize: setting has one parameter, a non-negative integer. Default value is 536870912 (512 MB) GlobalBoundingBox SettingType = "bbox" // The 'bounding box' defines the map area that the query will include Date SettingType = "date" // date is a global setting which modifies an Overpass QL query to examine attic data, and return results based on the OpenStreetMap database as of the date specified Diff SettingType = "diff" // The diff setting lets the database determine the difference of two queries at different points in time )
type SettingsStatement ¶
type SettingsStatement struct {
Settings []Setting
// contains filtered or unexported fields
}
func NewSettingsStatement ¶
func NewSettingsStatement(settings ...Setting) *SettingsStatement
func (*SettingsStatement) GetCompiled ¶
func (s *SettingsStatement) GetCompiled() string
func (*SettingsStatement) GetSetName ¶
func (s *SettingsStatement) GetSetName() string
type StackStatement ¶
type StackStatement struct {
Statements []Statement
// contains filtered or unexported fields
}
func NewStackStatement ¶
func NewStackStatement(statements ...Statement) *StackStatement
func (*StackStatement) Append ¶
func (s *StackStatement) Append(statements ...Statement)
Append statements and recompiles the query string
func (*StackStatement) Execute ¶
func (s *StackStatement) Execute(maxAttempts ...int) (string, error)
Executes the query string Specify maxAttempts to retry when rate limited, defaults to 1
func (*StackStatement) ExecuteAndExport ¶
func (s *StackStatement) ExecuteAndExport(filename string, maxAttempts ...int) (string, error)
Executes the query string and exports the data to file on disk, e.g. ./test.osm Specify maxAttempts to retry when rate limited, defaults to 1
func (*StackStatement) GetCompiled ¶
func (s *StackStatement) GetCompiled() string
func (*StackStatement) GetSetName ¶
func (s *StackStatement) GetSetName() string
type TagFilter ¶
type TagFilter struct {
TagFilterType TagFilterType
Key string
Value string
}
func NewTagFilter ¶
func NewTagFilter(tagFilterType TagFilterType, key string, value ...string) *TagFilter
type TagFilterType ¶
type TagFilterType string
const ( Equals TagFilterType = "=" // The most common variant selects all elements where the tag with the given key has a specific value NotEquals TagFilterType = "!=" // The most common variant selects all elements where the tag with the given key does not have a specific value Exists TagFilterType = "" // The second variant selects all elements that have a tag with a certain key and an arbitrary value NotExists TagFilterType = "!" // This variant selects all element, that don't have a tag with a certain key and an arbitrary value RegexMatch TagFilterType = "~" // The third variant selects all elements that have a tag with a certain key and a value that matches some regular expression RegexNotMatch TagFilterType = "!~" // The third variant selects all elements that have a tag with a certain key and a value that does not matche some regular expression )
type UnionStatement ¶
type UnionStatement struct {
SetName string `default:"_"`
Statements []Statement
// contains filtered or unexported fields
}
func NewUnionStatement ¶
func NewUnionStatement(resultSetName string, statements ...Statement) *UnionStatement
func (*UnionStatement) Append ¶
func (s *UnionStatement) Append(statements ...Statement)
Append statements and recompiles the query string
func (*UnionStatement) GetCompiled ¶
func (s *UnionStatement) GetCompiled() string
func (*UnionStatement) GetSetName ¶
func (s *UnionStatement) GetSetName() string
type VebosityType ¶
type VebosityType string
const ( Ids VebosityType = "ids" // Print only the ids of the elements in the set IdsNoIds VebosityType = "ids noids" // The modificator noids lets all ids to be omitted from the statement Skel VebosityType = "skel" // Print the minimum information necessary for geometry (nodes: id and coordinates, ways: id and the ids of its member nodes, relations: id of the relation, and the id, type, and role of all of its members) SkelNoIds VebosityType = "skel noids" // The modificator noids lets all ids to be omitted from the statement Body VebosityType = "body" // Print all information necessary to use the data. These are also tags for all elements and the roles for relation members BodyNoIds VebosityType = "body noids" // The modificator noids lets all ids to be omitted from the statement Tags VebosityType = "tags" // Print only ids and tags for each element and not coordinates or members TagsNoIds VebosityType = "tags noids" // The modificator noids lets all ids to be omitted from the statement Meta VebosityType = "meta" // Print everything known about the elements. meta includes everything output by body for each OSM element, as well as the version, changeset id, timestamp, and the user data of the user that last touched the object. Derived elements' metadata attributes are also missing for derived elements MetaNoIds VebosityType = "meta noids" // The modificator noids lets all ids to be omitted from the statement Geom VebosityType = "geom" // Add the full geometry to each object. This adds coordinates to each node, to each node member of a way or relation, and it adds a sequence of "nd" members with coordinates to all relations BB VebosityType = "bb" // Adds only the bounding box of each element to the element. For nodes this is equivalent to "geom". For ways it is the enclosing bounding box of all nodes. For relations it is the enclosing bounding box of all node and way members, relations as members have no effect Center VebosityType = "center" // This adds only the center of the above mentioned bounding box to ways and relations. Note: The center point is not guaranteed to lie inside the polygon ASC VebosityType = "asc" // Sort by object id QT VebosityType = "qt" // Sort by quadtile index; this is roughly geographical and significantly faster than order by ids (derived elements generated by make or convert statements without any geometry will be grouped separately, only sorted by id) Count VebosityType = "count" // prints only the total counts of elements in the input set by type (nodes, ways, relations, areas). It cannot be combined with anything else )