Bu sayfada, GeoJSON'da coğrafi verilerin nasıl oluşturulacağı gösterilmektedir
biçimi, GMUGeoJSONParser kullanılarak,
GMUGeometryRenderer ile bağlantılı. GeoJSON popüler bir
biçim olarak kullanabilirsiniz.
Tam kod örneği için örnek uygulamalara bakın
açık
GitHub'ı tıklayın.
GeoJSON verilerini oluşturma
Haritada GeoJSON verilerini görüntülemek için şunlarla bir GMUGeoJSONParser oluşturun:
bir GeoJSON kaynağına giden yolu (GeoJSON_sample.kml
örneğine bakın). Ardından, bir GMUGeometryRenderer oluşturun ve
GMUKMLParser örneği. Son olarak,
GMUGeometryRenderer.render() Aşağıdaki kod örneği,
GeoJSON verilerini haritada oluşturma:
Swift
import GoogleMapsUtils
class GeoJSON {
private var mapView: GMSMapView!
func renderGeoJSON() {
guard let path = Bundle.main.path(forResource: "GeoJSON_sample", ofType: "json") else {
return
}
let url = URL(fileURLWithPath: path)
let geoJsonParser = GMUGeoJSONParser(url: url)
geoJsonParser.parse()
let renderer = GMUGeometryRenderer(map: mapView, geometries: geoJsonParser.features)
renderer.render()
}
}
[[["Anlaması kolay","easyToUnderstand","thumb-up"],["Sorunumu çözdü","solvedMyProblem","thumb-up"],["Diğer","otherUp","thumb-up"]],[["İhtiyacım olan bilgiler yok","missingTheInformationINeed","thumb-down"],["Çok karmaşık / çok fazla adım var","tooComplicatedTooManySteps","thumb-down"],["Güncel değil","outOfDate","thumb-down"],["Çeviri sorunu","translationIssue","thumb-down"],["Örnek veya kod sorunu","samplesCodeIssue","thumb-down"],["Diğer","otherDown","thumb-down"]],["Son güncelleme tarihi: 2024-09-05 UTC."],[[["This page demonstrates how to render geographic data in GeoJSON format on Google Maps using the `GMUGeoJSONParser` and `GMUGeometryRenderer`."],["GeoJSON is a commonly used format for displaying geographic data like points, lines, and polygons."],["You'll need to set up the Maps SDK for iOS Utility Library before using `GMUGeoJSONParser`."],["The provided code examples show how to render GeoJSON data on a map in both Swift and Objective-C."]]],["The document explains how to render GeoJSON data on a map using the `GMUGeoJSONParser` and `GMUGeometryRenderer` from the Maps SDK for iOS Utility Library. First, a `GMUGeoJSONParser` is created with the GeoJSON resource path. Then, a `GMUGeometryRenderer` is initialized with the map view and the parser's features. Finally, the `GMUGeometryRenderer.render()` method is called to display the GeoJSON data, such as points, lines, and polygons, on the map.\n"]]