Documentation ¶
Index ¶
Constants ¶
const ( DefaultMaxSurfaceTileDim = 5 DefaultDownloadGoroutines = 4 DefaultDownloadRetries = 2 )
defaults for newly created ImageOverlaySurface. See ImageOverlaySurface for more information about these parameters.
Variables ¶
This section is empty.
Functions ¶
func ColorValue ¶
ColorValue takes an image color and the targetColor to compute a value within the [0,1] for the surface. Currently it does a simple ratio of image/base. However, this does not for for black. TODO: improve this!
Types ¶
type Surface ¶
type Surface struct { Surface *geo.Surface SmoothSurface *smoothsurface.LazySmoothSurface // required options SourceURLTemplate string // should be of the form http://host.com/{z}/{x}/{y}.png // The function used to compute the covert the image color to a [0,1] value. // image is the color from the image. targetColor is the same as just above and the color targeted. // Initially set to the ColorValue function below. See that function for more details. ColorValueFunc func(image, targetColor color.Color) float64 // SmoothingStdDev is used to do the smoothing of the surface. // They are in meters and are scaled to match the mercator projection of the final surface // to be able to use the same values for any geo-location. SmoothingStdDev float64 // the standard deviation of the Gaussian in meters // set from defaults, so optional MaxSurfaceTileDim int // represents the max height and width of the surface in tiles, to cap memory usage DownloadGoroutines int // how many goroutines to use when downloading remote tiles DownloadRetries int // number of times to retry when fetching a tile, to absorb network errors // contains filtered or unexported fields }
A Surface reprents a builder and data for a Slide Surface based on overlay tile image data. For example, the "New & Misaligned TIGER Roads" overlay is a tileset for the iD editor where TIGER roads are yellow. This object can build a slidable surface using the yellow roads as target data.
func New ¶
func New( lnglatBound *geo.Bound, sourceURLTemplate string, smoothingStdDev float64, targetColor color.Color, ) *Surface
New creates a new Surface with the given options, plus the others set to the defaults.
func (*Surface) Build ¶
Build goes through the whole process of building the surface:
- figures out the proper zoom and tiles to download
- downloads those tiles
- smooths the surface, per the options
func (*Surface) GradientAt ¶
func (surfacer *Surface) GradientAt(point *geo.Point) *geo.Point
GradientAt provides a pass through to surfacer.SmoothSurface.GradientAt()
func (*Surface) Resmooth ¶
Resmooth takes the data pulled in from the tiles and applies a new smoothing to it based on a potentially updated `SmoothingStdDev`. Basically it clears and resets the LazySmoothSurface.
func (*Surface) SuggestedOptions ¶
func (surfacer *Surface) SuggestedOptions() *slide.SuggestedOptions
SuggestedOptions returns the defaults slide should use for some parameters.