ยูทิลิตีตัวเข้ารหัส Polyline เชิงโต้ตอบ
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
Google Maps สามารถสร้างเส้นหลายส่วนแบบง่ายจากพิกัดละติจูด/ลองจิจูด 2 พิกัดขึ้นไป
ดูข้อมูลเพิ่มเติมเกี่ยวกับ
การเข้ารหัส Polyline
Polyline แบบง่าย
และ
Polyline ที่ซับซ้อน
ยูทิลิตีนี้ช่วยให้คุณสร้างการเข้ารหัส Polyline
แบบอินเทอร์แอกทีฟบนแผนที่หรือโดยการป้อนพิกัดได้
นอกจากนี้ คุณยังถอดรหัสเส้นหลายเส้นเป็นพิกัดได้
โดยใช้เครื่องมือนี้ในทางกลับกัน
อย่างไรก็ตาม หากคุณมีเส้นหลายจุดที่เข้ารหัสอยู่แล้วหรือรายการพิกัดเป็น
GeoJSON Linestring
และต้องการดูเส้นหลายจุดบนแผนที่ ให้ใช้
เครื่องมือถอดรหัสเส้นหลายจุดแบบอินเทอร์แอกทีฟ
สร้างเส้นหลายส่วนแบบอินเทอร์แอกทีฟบนแผนที่
- ป้อนที่อยู่ รหัสไปรษณีย์ สถานที่ หรือจุดสังเกตเพื่อจัดกึ่งกลางแผนที่
แล้วคลิกค้นหา
- คลิกแผนที่เพื่อวางเครื่องหมายที่แสดงตำแหน่งเริ่มต้นของ
เส้นหลายเหลี่ยม
- พิกัดของเครื่องหมายจะแสดงในช่องละติจูด
และลองจิจูด
- คลิกปุ่มเพิ่มสถานที่ตั้ง
ซึ่งจะเป็นการเพิ่มพิกัดลงในรายการสถานที่
และสร้างการเข้ารหัสในช่องเส้นหลายส่วนที่เข้ารหัส
- วางเครื่องหมายบนแผนที่ต่อไปเพื่อเพิ่มสถานที่ทั้งหมดในเส้นหลายเส้น
ลงในรายการสถานที่และเส้นหลายเส้นที่เข้ารหัส
การแก้ไขพิกัด
- หากต้องการลบตำแหน่ง ให้เลือกตำแหน่งในรายการตำแหน่ง แล้วกด
ลบตำแหน่งที่เลือก
- หากต้องการลบสถานที่ตั้งทั้งหมดและเริ่มต้นใหม่ ให้คลิกลบสถานที่ตั้งทั้งหมด
- คุณแก้ไขตำแหน่งไม่ได้ หากต้องการแก้ไขตำแหน่ง ให้ลบแล้วเพิ่มอีกครั้ง
หากตำแหน่งไม่ได้อยู่ท้ายรายการ
ให้ลบตำแหน่งและตำแหน่งทั้งหมดที่ตามมา
สร้างเส้นหลายส่วนโดยป้อนพิกัด
- หากมีรายการพิกัดอยู่แล้ว คุณสามารถป้อนละติจูดและลองจิจูดในช่องที่เกี่ยวข้องด้วยตนเองแทนการวางเครื่องหมาย
ถอดรหัสโพลีไลน์เป็นพิกัด
- ป้อนเส้นประกอบลงในช่องเส้นประกอบที่เข้ารหัส
- หากเส้นประกอบมีอักขระที่กำหนดเป็นอักขระหลีก
ให้คลิกช่องทำเครื่องหมายเพื่อยกเลิกการกำหนดเป็นอักขระหลีก
- คลิกถอดรหัส Polyline
พิกัดจะแสดงในรายการตำแหน่ง
และเส้นจะวาดบนแผนที่
ยูทิลิตี้นี้ใช้ Maps JavaScript API กล่าวคือ
การเข้ารหัสและถอดรหัสเส้นทางจะได้รับการจัดการโดยเมธอดแบบคงที่ encodePath()
และ decodePath()
ในเนมสเปซ google.maps.geometry.encoding
ดูข้อมูลเกี่ยวกับรูปแบบการเข้ารหัสได้ที่รูปแบบอัลกอริทึมของ Polyline ที่เข้ารหัส
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-08-29 UTC
[null,null,["อัปเดตล่าสุด 2025-08-29 UTC"],[],[],null,["# Interactive Polyline Encoder Utility\n\nGoogle Maps can generate a simple polyline from two or more latitude/longitude coordinates.\nLearn more about\n[polyline encoding](/maps/documentation/utilities/polylinealgorithm),\n[simple polylines](/maps/documentation/javascript/examples/polyline-simple),\nand\n[complex polylines](/maps/documentation/javascript/examples/polyline-complex).\n\nWith this utility, you can generate polyline encodings\ninteractively on a map or by entering coordinates.\nYou can also decode polylines into coordinates\nby using this tool in reverse.\n\nHowever, if you have an existing encoded polyline or a list of coordinates as a\n[GeoJSON linestring](https://geojson.org/)\nand want to view the polyline on a map, use the\n[Interactive polyline decoder utility](/maps/documentation/routes/polylinedecoder).\n\n**Create a polyline interactively on the map**\n\n1. Enter an address, zip code, location, or landmark to center the map and click **Search**.\n2. Click the map to place a marker that represents the start location of your polyline.\n3. The coordinates of your marker show in the **Latitude** and **Longitude** boxes.\n4. Click the **Add Location** button. This adds the coordinates to the **Location list** and generates an encoding in the **Encoded Polyline** box.\n5. Continue to place markers on the map to add all locations on your polyline to the **Location list** and the **Encoded polyline**.\n\n**Editing coordinates**\n\n- To delete a location, select it in the **Location list** and press **Delete Selected Location**.\n- To delete all locations and start over, click **Delete All Locations**.\n- You cannot edit locations. To edit a location, delete and re-add it. If the location is not at the end of your list, delete the location and all the ones following.\n\n**Create a polyline by entering coordinates**\n\n- If you have an existing list of coordinates, instead of placing markers, you can manually enter the latitudes and longitudes in their respective boxes.\n\n**Decode a polyline into coordinates**\n\n1. Enter your polyline into the **Encoded Polyline** box.\n2. If your polyline contains escaped characters, click the checkbox to unescape them.\n3. Click **Decode Polyline** . The coordinates show in the **Location list**, and the line is drawn on the map.\n\n\u003cbr /\u003e\n\n|--------------------------------------------|----------------------------------------------------------------------------------------------------------------------|\n| Input an address to center the map: Search | |------------|---| | Latitude: | | | Longitude: | | | | | || \u003cbr /\u003e **Locations list** |\n| |-------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | | **Warning**: Special characters in the encoded polylines returned in JSON responses are escaped. To use these polylines here you must unescape them. | | Encoded Polyline: | |---------------------------------------------------------------------------------| | | | Unescape special characters in the encoded polylines returned in JSON responses | | | || ||\n\nThis utility uses the Maps JavaScript API. Specifically,\nencoding and decoding of paths are handled by the static methods `encodePath()`\nand `decodePath()` in the `google.maps.geometry.encoding` namespace.\nSee the [Encoded Polyline Algorithm\nFormat](/maps/documentation/utilities/polylinealgorithm) for information about the encoding scheme."]]