Snap to roads & speeding report

Web services

Snap to road API documentation, available via HTTP-JSON/XML service.

URL base service:

* API KEY. Same KEY used in maps API js

HTTP requests in GET or POST
Response in JSON / XML format

Get a route polyline from a GPS track (snap to roads) and speeding report

Request:

Example:

&cmd=geomtrack&TRACK=[2.825850,41.969279@0,45@@70@@@A],[2.822355,41.965995@0,45@@10@@@A],[2.828963,41.968589@0,45@@10@@@B],[2.828278,41.965013@0,45@@10@@@B]&SPEEDING=true&SPEEDTOLERANCE=10&SRS=EPSG:4326


Where:

TRACK

List of ordered points, separated by commas, limited to a maximum of 5,000 points. Each point has the following format:

[coord{@<compass>}{@@speed}{@@@atribute}]

Where:

  • coord: list of coordinates, separated by commas, limited to a maximum of 5,000 points
  • compass: Optional element that identifies the heading of the vehicle. Format: @tolerance angle, direction tolerance
    • tolerance angle: corresponds to heading (in degrees). Possible values: 0-360
    • direction tolerance: corresponds to the tolerance (in degrees) with respect to the indicated heading. Possible values: 0-180
  • speed: Optional element that indicates the speed of the vehicle at the point indicated in Km / h.
  • atributo: Attribute by which the sections are separated in the response. It can be numeric or text.

SRS

Coordinate system of the list of points. Use EPSG: 4326 for geographic coordinates.

WEIGHT

Route type (default: distance)

NET

Country net used (optional)

GEOMETRYSRS

Coordinate system of the resulting polyline. By default use the same as the SRS parameter. Ex: EPSG: 4326

GEOMETRYTOLERANCE

Indicates the geometry tolerance (simplification) in meters

POINTS

Obtain the original coordinates of the GPS track displaced on top of the returned route (optional)

SPEEDING

Boolean value. If true, it returns the separated route sections for which the speed is exceeded and those which are not.

With an integer value, speeding sections are divided into zones. For example, with a value of 5 km/h it will create different sections when it exceeds the maximum speed of 5 km/h, 10 km/h, etc. This parameter also affects the speed tolerance parameter. For example, if speedtolerance=10, first two speed zones will never appear.

SPEEDTOLERANCE

Tolerance in Km / h on the maximum speed of the section. Speeding will only be considered if the vehicle speed exceeds the speed of the section by more than SpeedTolerance km / h. By default 0.

Low-level control parameters:

ONLYTRACK

If true it returns a multipoint geometry with the points of the route. Default: false

MAXDIRECTIONSEARCHDISTANCE

Maximum deviation that can exist between a point on the track and a point on the network that respects the orientation of the point. Default: 10

If no point is found, we proceed to search for it regardless of orientation.

MAXSEARCHDISTANCE

Maximum deviation that can exist between a point on the track and a point on the net regardless of orientation. Default: 20

If no point is found on the network that meets the distance, the point is added in a straight line to the result.

FACTOR

Factor between the distance in route and the line between two points. If this factor is exceeded, the route is ignored and the straight line is preferred. Default: 2

RESPONSE:

<cercalia cmd="geomtrack" version="1">
	<track>
		<geometry speeding="true" speedinglevel="2" distance="123">
			<wkt>
			LINESTRING (-3.7102887167967693 40.42997776054614, -3.7091707575880277 40.42986535088826, -3.7089192293084743 40.429844756839465, -3.708748549404491 40.42983789215513, -3.7077514194391186 40.42973492180528, -3.707419042783995 40.42971432771623, -3.706754289473746 40.42965941011441, -3.706305131831686 40.42961822188338, -3.706161401386227 40.429590763048566)
			</wkt>
		</geometry>
		<geometry speeding="false" distance="123">
			<wkt>
			LINESTRING (-3.7058110584254202 40.42954271006045, -3.7054517323117726 40.42948092759633, -3.705379867089043 40.42947406287456, -3.704751046390159 40.429398550888514, -3.703717983813422 40.429220067672745, -3.7033047587827275 40.429137690642925, -3.7024064434986075 40.42898666582415, -3.7023615277344017 40.428972936278214, -3.701984235315071 40.42892488284522, -3.701409313533235 40.42880131671579, -3.7005109982491153 40.42861596709264, -3.6999360764672793 40.428485535567766, -3.6994150536024897 40.42838942796525, -3.698436860020802 40.428197754472336)
			</wkt>
		</geometry>
		<points>
			<point>
				<from x="-3.074694" y="43.352639"/>
				<to x="-3.0746008408859975" y="43.35254856142673"/>
			</point>
		</points>
	</track>
	<server>http://cercalia-tomcat-lbs-instance3:8080</server>
</cercalia>


Where:

  • geomtrack= route polyline in WKT format (linestring / multilinestring)
  • speeding= 
    • "true" -> in this road section the maximum speed has been exceeded, taking into account the tolerance indicated.
    • "false" -> in this road section the maximum speed has not been exceeded, taking into account the tolerance indicated.
  • speedinglevel= only reported if speeding = "true". Provides the speeding zone for this section, linked to the speed value indicated in the &speeding= parameter. For example, with a &speeding= value of 10 km/h and without speedtolerance, if a vehicle drived at 55 km/h in a section limited to 50 km/h, the speedinglevel value will be 1, while if it was circulating at 67 km/h, then will be 2.
  • distance= provides the distance of every track, in meters. It helps for generating a statistic of sections, with a differenciation of speeding value.

 

Polyline visualization:

Snap to road