# Public Transportation

The public transportation service searches for buses and subway lines, and when you enter your departure and destination, you search for buses, trains, buses and subway lines. Currently, only Korea provides services, and the region will gradually expand.

<table><thead><tr><th width="215.66666666666666">Method</th><th width="430">Request</th><th>Response</th></tr></thead><tbody><tr><td>GET</td><td>https://maps.mogoscorp.com/api/v2/route</td><td>json, xml</td></tr></tbody></table>

### Request

<table><thead><tr><th width="214.66666666666666">Parameter (Required)</th><th width="372">Description</th><th>Remark</th></tr></thead><tbody><tr><td>key</td><td>Your API key.</td><td>string</td></tr><tr><td>origin</td><td>Start location<br>(Longitude, Latitude)</td><td>string</td></tr><tr><td>destination</td><td>Destination location<br>(Longitude, Latitude)</td><td>string</td></tr><tr><td>rpoption</td><td><p>Path search result sorting method</p><p>0: Recommended path </p><p>1: sorted by type </p><p>e.g. subway, bus, bus+subway,    </p><p>       subway+bus, bus+subway+bus<br>(Default : 0)</p></td><td>int</td></tr><tr><td>cartype</td><td>Type of vehicle.<br><br><mark style="color:blue;">251: Public Transportation</mark></td><td>int</td></tr><tr><td>reqtype</td><td><p>Type of route request.</p><p>(Default :0 only)</p></td><td>int</td></tr><tr><td>carspeed</td><td>Speed of vehicle.<br>(Default :0 Only)</td><td>int</td></tr><tr><td>angle</td><td>Angle of vehicle's direction.<br>(Default : 0 only)</td><td>int</td></tr><tr><td>unixtime</td><td>Time requested for search route</td><td>string</td></tr><tr><td>gmtoffset</td><td>Timezone</td><td>string</td></tr></tbody></table>

<table><thead><tr><th width="214.66666666666666">Parameter (Optional)</th><th width="393">Description</th><th>Remark</th></tr></thead><tbody><tr><td>lang</td><td><p>Select Result Language </p><p>0: Korean</p><p>1: English</p><p>2: Japanese </p><p>3: Chinese (simplified) </p><p>4: Chinese (traditional)  </p><p>5: Vietnamese (support only in the metropolitan area)</p><p>(Default : 0)</p></td><td></td></tr><tr><td>output</td><td><p>Output format (json or xml) </p><p>(Default : json)</p></td><td></td></tr><tr><td>SearchType</td><td>Select Intercity or In-City Movement.<br>A search is performed for intra-city movement or intercity movement. </td><td></td></tr><tr><td>SearchPathType</td><td><p>Specify the route means within the city.<br>0: All</p><p>1: Subway </p><p>2: Buses<br>(Default : 0)</p></td><td></td></tr></tbody></table>

### Example

```typescript
// Some code
```

###

### Response

<table><thead><tr><th width="205">Parameter</th><th width="372.66666666666663">Description</th><th width="111.33333333333337">Remark</th></tr></thead><tbody><tr><td>result</td><td>Top node</td><td>node</td></tr><tr><td>searchType</td><td><p>Result classification (via city or city direct or intercity transfer)</p><p>0: In-City, </p><p>1: City Direct, </p><p>2: City Transfer</p></td><td>int</td></tr><tr><td>outTrafficCheck</td><td><p>Intercity "direct" navigation results (Transfer X) </p><p>0: False, </p><p>1: True</p></td><td>boolean</td></tr><tr><td>busCount</td><td>Number of bus results</td><td>int</td></tr><tr><td>subwayCount</td><td>Number of subway results</td><td>int</td></tr><tr><td>subwayBusCount</td><td>Number of "Bus + Subway" results</td><td>int</td></tr><tr><td>pointDistance</td><td>Straight distance (meters) between origin (SX, SY) and destination (EX, EY)</td><td>double</td></tr><tr><td>startRadius</td><td>The radius of the originate point</td><td>int</td></tr><tr><td>endRadius</td><td>The radius of the destination point</td><td>int</td></tr><tr><td>path</td><td>Result List Extension Node</td><td>node</td></tr><tr><td>pathType</td><td><p>Result Type </p><p>1: subway, </p><p>2: bus, </p><p>3: bus+subway</p></td><td></td></tr><tr><td>info</td><td>Summary Information Extension Node</td><td>node</td></tr><tr><td>trafficDistance</td><td>Total distance traveled except on foot</td><td>double</td></tr><tr><td>totalWalk</td><td>Total walking distance</td><td>int</td></tr><tr><td>totalTime</td><td>Total time required</td><td>int</td></tr><tr><td>payment</td><td>A total charge</td><td>int</td></tr><tr><td>busTransitCount</td><td>Bus transfer count</td><td>int</td></tr><tr><td>subwayTransitCount</td><td>A subway transfer count</td><td>int</td></tr><tr><td>totalDistance</td><td>A total distance</td><td>double</td></tr><tr><td>subPath</td><td>Transportation Information Extension Node</td><td>node</td></tr><tr><td>trafficType</td><td><p>Types of transportation (walk, bus, subway) </p><p>1: subway, </p><p>2: bus, </p><p>3: walk</p></td><td>int</td></tr><tr><td>distance</td><td>A travel distance</td><td>double</td></tr><tr><td>sectionTime</td><td>A time to travel</td><td>int</td></tr><tr><td>stationCount</td><td>Number of stops moving to and from (required for subways and buses only)</td><td>int</td></tr><tr><td>lane</td><td>Transportation Information Extension Node</td><td>node</td></tr><tr><td>name</td><td><p>Name of subway line </p><p>(required only for subways)</p></td><td>string</td></tr><tr><td>busNo</td><td>Bus number (required only for buses)</td><td>string</td></tr><tr><td>busType</td><td>Bus type (required only for buses)</td><td>int</td></tr><tr><td>busID</td><td>Bus code (required only for buses)</td><td>int</td></tr><tr><td>busLocalBlID</td><td>Bus route ID for each region (required only for BIS-provided areas)</td><td>string</td></tr><tr><td>busCityCode</td><td>Transportation company approved city code (required only for buses)</td><td>int</td></tr><tr><td>busProviderCode</td><td>BIS code (required only for BIS delivery areas)</td><td>int</td></tr><tr><td>subwayCode</td><td>Subway line number (required only for subways)</td><td>int</td></tr><tr><td>subwayCityCode</td><td>Subway city code (required only for subways)</td><td>int</td></tr><tr><td>startName</td><td>A stop or station name</td><td>string</td></tr><tr><td>startX</td><td>Boarding stop or station location Longitude</td><td>double</td></tr><tr><td>startY</td><td>Boarding stop or station location Latitude</td><td>double</td></tr><tr><td>endName</td><td>A stop or station name</td><td>string</td></tr><tr><td>endX</td><td>Leaving stop or station location Longitude</td><td>double</td></tr><tr><td>endY</td><td>Leaving stop or station location Latitude</td><td>double</td></tr><tr><td>way</td><td>Directional information (required only for subways)</td><td>string</td></tr><tr><td>wayCode</td><td><p>Directional information code (required only for the first route of the subway) </p><p>1: up</p><p>2: down</p></td><td>int</td></tr><tr><td>door</td><td>Rapid subway transfer location (required only for subways)</td><td>string</td></tr><tr><td>startID</td><td>Departure stop or station code</td><td>int</td></tr><tr><td>startStationCityCode</td><td>Departure stop city code (required only for buses)</td><td></td></tr><tr><td>startStationProviderCode</td><td>Departure stop BIS code (required only for BIS-provided areas)</td><td>int</td></tr><tr><td>startLocalStationID</td><td>Departure stop ID for each region (required only for BIS-provided areas)</td><td>string</td></tr><tr><td>startArsID</td><td>Unique number of each local departure stop (required only for BIS-provided areas)</td><td>string</td></tr><tr><td>endID</td><td>Arrival stop or station code</td><td>int</td></tr><tr><td>endStationCityCode</td><td>Arrival stop city code (required only for buses)</td><td>int</td></tr><tr><td>endStationProviderCode</td><td><p>Arrival stop BIS code </p><p>(required only for BIS-provided areas)</p></td><td>int</td></tr><tr><td>endLocalStationID</td><td><p>Arrival stop ID for each region </p><p>(required only for BIS-provided areas)</p></td><td>string</td></tr><tr><td>endArsID</td><td>Unique number of each local arrival stop (required only for BIS-provided areas)</td><td>string</td></tr><tr><td>startExitNo</td><td>subway exit number (Used only for subways, but may not have that tag.)</td><td>string</td></tr><tr><td>startExitX</td><td><p>Exit X coordinates for subway entry </p><p>(only used for subways but may not have the corresponding tag)</p></td><td>double</td></tr><tr><td>startExitY</td><td><p>Exit Y coordinates for subway </p><p>(only used for subway but may not have the corresponding tag)</p></td><td>double</td></tr><tr><td>endExitNo</td><td><p>Exit number of the subway </p><p>(only used for subways but may not have the corresponding tag)</p></td><td>string</td></tr><tr><td>endExitX</td><td>Exit X coordinates of subway exit (only used for subway but may not have the corresponding tag)</td><td>double</td></tr><tr><td>endExitY</td><td>Exit Y coordinates of subway exit (only used for subway but may not have the corresponding tag)</td><td>double</td></tr><tr><td>passStopList</td><td>Route Detail Section Information Extension Node (available in Korean only)</td><td>node</td></tr><tr><td>stations</td><td>Stop Information Group Node</td><td>node</td></tr><tr><td>index</td><td>The order of stops</td><td>int</td></tr><tr><td>stationID</td><td>Station ID</td><td>int</td></tr><tr><td>stationName</td><td>Station Name</td><td>int</td></tr><tr><td>stationCityCode</td><td>Stop city code (required only for buses)</td><td>int</td></tr><tr><td>stationProviderCode</td><td><p>BIS code </p><p>(required only for BIS delivery areas)</p></td><td>int</td></tr><tr><td>localStationID</td><td><p>Local stop ID </p><p>(required only for BIS-provided areas)</p></td><td>string</td></tr><tr><td>arsID</td><td><p>Unique number of each local stop </p><p>(required only for BIS-provided areas)</p></td><td>string</td></tr><tr><td>x</td><td>Station location Longitude</td><td>string</td></tr><tr><td>y</td><td>Station location Latitude</td><td>string</td></tr><tr><td>isNonStop</td><td>Unstalled stop Y/N (required only for buses)</td><td>string</td></tr></tbody></table>

### Example

```typescript
{
	"result": {
		"searchType": 0,
		"outTrafficCheck": 0,
		"busCount": 7,
		"subwayCount": 1,
		"subwayBusCount": 5,
		"pointDistance": 24046,
		"startRadius": 700,
		"endRadius": 700,
		"path": [
			{
				"pathType": 3,
				"info": {
					"trafficDistance": 29882,
					"totalWalk": 1316,
					"totalTime": 89,
					"payment": 1650,
					"busTransitCount": 1,
					"subwayTransitCount": 1,
					"mapObj": "1123:1:43:52@11:2:137:116",
					"firstStartStation": "구로디지털단지역",
					"lastEndStation": "방학",
					"totalStationCount": 31,
					"busStationCount": 9,
					"subwayStationCount": 22,
					"totalDistance": 31198,
					"totalWalkTime": -1
				},
				"subPath": [
					{
						"trafficType": 3,
						"distance": 592,
						"sectionTime": 9
					},
					{
						"trafficType": 2,
						"distance": 4082,
						"sectionTime": 17,
						"stationCount": 9,
						"lane": [
							{
								"busNo": "5531",
								"type": 12,
								"busID": 1123,
								"busLocalBlID": "100100265",
								"busCityCode": 1000,
								"busProviderCode": 4
							}
						],
						"startName": "구로디지털단지역",
						"startX": 126.90256,
						"startY": 37.484078,
						"endName": "대방역",
						"endX": 126.92635,
						"endY": 37.512554,
						"startID": 126473,
						"startStationCityCode": 1000,
						"startStationProviderCode": 4,
						"startLocalStationID": "120000001",
						"startArsID": "21-001",
						"endID": 103278,
						"endStationCityCode": 1000,
						"endStationProviderCode": 4,
						"endLocalStationID": "119000022",
						"endArsID": "20-108",
						"passStopList": {
							"stations": [
								{
									"index": 0,
									"stationID": 126473,
									"stationName": "구로디지털단지역",
									"stationCityCode": 1000,
									"stationProviderCode": 4,
									"localStationID": "120000001",
									"arsID": "21-001",
									"x": "126.90256",
									"y": "37.484078",
									"isNonStop": "N"
								},
								{
									"index": 1,
									"stationID": 126478,
									"stationName": "동작상떼빌아파트",
									"stationCityCode": 1000,
									"stationProviderCode": 4,
									"localStationID": "119000001",
									"arsID": "20-001",
									"x": "126.904537",
									"y": "37.486503",
									"isNonStop": "N"
								}
							]
						}
					}
				]
			}
		]
	}
}
```

*The MOGOS Maps API requires an API Key, which can be obtained from the* [***MOGOS Console***](https://console.mogoscorp.com) *website* *or contact* [***sales@mogoscorp.com***](mailto:sales@mogoscorp.com)***.***
