# Slices of Slices of Slices in Go

DevFeed: [Slices of Slices of Slices in Go](<https://devfeed.tech/articles/slices-of-slices-of-slices-in-go-22075.md>)

Original publisher: [Read original article](<https://www.ardanlabs.com/blog/2013/09/slices-of-slices-of-slices-in-go.html>)

Published: 2013-09-10T00:00:00Z

Content type: tutorial

Language: en

Sources: [William Kennedy](<https://devfeed.tech/sources/william-kennedy.md>)

Topics: [Go Language](<https://devfeed.tech/topics/go-language.md>), [MongoDB](<https://devfeed.tech/topics/mongodb.md>), [Data structures](<https://devfeed.tech/topics/data-structures.md>), [Code](<https://devfeed.tech/topics/code.md>), [data](<https://devfeed.tech/topics/data.md>)

Tags: [ardan-labs](<https://devfeed.tech/tags/ardan-labs.md>), [blog](<https://devfeed.tech/tags/blog.md>), [code](<https://devfeed.tech/tags/code.md>), [data-structure](<https://devfeed.tech/tags/data-structure.md>), [geospatial](<https://devfeed.tech/tags/geospatial.md>), [go](<https://devfeed.tech/tags/go.md>), [go-programming](<https://devfeed.tech/tags/go-programming.md>), [golang](<https://devfeed.tech/tags/golang.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [mongodb](<https://devfeed.tech/tags/mongodb.md>), [programming](<https://devfeed.tech/tags/programming.md>), [slices](<https://devfeed.tech/tags/slices.md>)

## AI overview

This tutorial explains how to model nested Go slices for storing marine forecast polygons in MongoDB. It defines polygon, polygon-ring, and marine-station structures, including the nested coordinate representation required for MongoDB geospatial searches.

## Source excerpt

I am working on building code to load polygons for the different Marine Forecast areas in the United States. These polygons need to be stored in MongoDB and there is a special way that needs to be done. It would not have been a big deal if it wasn't for this fact. There isn't just one polygon for each area. There is an external polygon and then zero to many interior polygons that need to be stored in relationship. After staring at the problem for a bit I realized that I needed to create a slice of Marine Forecast areas, each of which contained a slice of polygons. To store each polygon ring I needed a slice of geographic coordinates. Finally each coordinate needed to be stored in a two dimensional array of floats. A picture is worth a thousand words: