Stay organized with collections Save and categorize content based on your preferences.
This page shows you how to render geographic data in the GeoJSON format, using GMUGeoJSONParser
, in conjunction with GMUGeometryRenderer
. GeoJSON is a popular format for rendering geographic data such as points, lines, and polygons.
GMUGeoJSONParser
is part of the Maps SDK for iOS Utility Library. If you haven't yet set up the library, follow the setup guide before reading the rest of this page.
For the full code sample, see the sample apps on GitHub.
Rendering GeoJSON dataTo render GeoJSON data on a map, create a GMUGeoJSONParser
with the path to a GeoJSON resource (GeoJSON_sample.kml
in this example). Then, create a GMUGeometryRenderer
, passing the GMUKMLParser
instance. Finally, call GMUGeometryRenderer.render()
. The following code example shows rendering GeoJSON data on a map:
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() } }Objective-C
@import GoogleMapsUtils; @implementation GeoJSON { GMSMapView *_mapView; } - (void)renderGeoJSON { NSString *path = [[NSBundle mainBundle] pathForResource:@"GeoJSON_sample" ofType:@"json"]; NSURL *url = [NSURL fileURLWithPath:path]; GMUGeoJSONParser *parser = [[GMUGeoJSONParser alloc] initWithURL:url]; [parser parse]; GMUGeometryRenderer *renderer = [[GMUGeometryRenderer alloc] initWithMap:_mapView geometries:parser.features]; [renderer render]; } @end
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-07-23 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-07-23 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"]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4