<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Hector Castro on Medium]]></title>
        <description><![CDATA[Stories by Hector Castro on Medium]]></description>
        <link>https://medium.com/@hcastro?source=rss-297c10842423------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ODVp70BKKX4QzuS3bNmfAA@2x.jpeg</url>
            <title>Stories by Hector Castro on Medium</title>
            <link>https://medium.com/@hcastro?source=rss-297c10842423------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 14:08:23 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@hcastro/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Laying Tiles Without Grout and Mortar]]></title>
            <link>https://medium.com/@hcastro/laying-tiles-without-grout-and-mortar-270914f9788b?source=rss-297c10842423------2</link>
            <guid isPermaLink="false">https://medium.com/p/270914f9788b</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[earth-observation]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[geospatial]]></category>
            <category><![CDATA[apache-spark]]></category>
            <dc:creator><![CDATA[Hector Castro]]></dc:creator>
            <pubDate>Tue, 21 Mar 2017 16:02:02 GMT</pubDate>
            <atom:updated>2017-05-03T18:58:23.751Z</atom:updated>
            <content:encoded><![CDATA[<h4>On minimizing the latency of serving painted raster tiles</h4><p>When we started building Raster Foundry, a platform that promises the ability to quickly edit and publish satellite and aerial web maps, we knew that serving painted raster tiles (think PNGs) as fast as possible was going to be a necessity. We also knew that the dynamic nature of our tile access patterns would nullify many of the traditional strategies for serving map tiles at scale. In this post, I’ll provide a brief overview of web map tile serving, along with a breakdown of the tools and techniques we use to combat the challenges of serving dynamic map tiles at every layer of our application.</p><h3>Web Map Tile Serving Overview</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R3UN3Jl-p80z2YZ1pLjM_Q.png" /><figcaption>A tiled web map with visible spacing between each map tile.</figcaption></figure><p>As you can see from the image above, the map is sliced into a set of tiles that are stitched together at the seams to provide a unified view. In a basic web map, interactions that change the zoom level or pan around lead to new map tile requests. In the case of zooming, an entirely new set of tiles is requested to increase (zoom in) or decrease (zoom out) the level of detail. For panning, new tiles are requested only at the edges of the panning direction.</p><p>For Raster Foundry’s web map, new tiles are served when users zoom and pan, but we also support a handful of other interactions that require a refresh of all visible map tiles. As an example, our color correction functionality allows you tweak the brightness and contrast values for all tiles currently visible on the map.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pQKVqGsK0uSyMhYGfg2z_w.gif" /><figcaption>Animation that shows the impact of a change in imagery brightness on a web map in Raster Foundry.</figcaption></figure><p>Since each map tile corresponds to an HTTP request, a significant amount of the stress placed on tile serving backends has traditionally been mitigated with a combination of aggressive HTTP caching and content delivery networks (CDNs). The high level strategy being, render tiles once and cache them for a while, or cache them indefinitely but have a plan for invalidating them later if the underlying data changes.</p><p>For Raster Foundry, solutions that involve HTTP caching have much less impact because many of our supported interactions invalidate all map tiles, or support too many parameters to produce effective cache/hit ratios. To put it succinctly, the Raster Foundry tile server is often forced to serve map tile requests in a fully dynamic fashion, and that’s <em>not easy</em>.</p><h3>Channeling Bob Vila</h3><p>Considering the challenges summarized above, below are some of the steps we’ve taken to provide a sturdy dynamic tile serving backend for Raster Foundry.</p><h4>Load Balancing and HTTP/2</h4><p>Raster Foundry is deployed on cloud-native, best-of-breed Amazon Web Services (AWS) architecture. Thus, we make use of Amazon’s current generation Application Load Balancer (ALB) service as the gateway into our tile servers. For users with current generation browsers, ALB supports the HTTP/2 protocol. This allows us to multiplex multiple map tile requests and responses over a single TCP connection, which reduces the roundtrip overhead of multiple connections handshakes and eliminates head-of-line request blocking.</p><p>By allowing the browser to load all of the map tiles in parallel, end-user perceived latency is minimized, and network pane waterfall diagrams start looking less like the left and more like the right:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/827/1*UGRuQ2y3edxhg9yPQXBiig.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/699/1*A2Y34anrIi16aRy_RMcspg.png" /><figcaption>The network pane from Chrome DevTools showing multiple connections to an HTTP/1 (left) and HTTP/2 (right) origin server.</figcaption></figure><p>Furthermore, the ALB load balances all inbound HTTP requests evenly across a number of backend servers. The backend servers are part of a scalable fleet of stateless Amazon Elastic Compute Cloud (EC2) virtual machines tuned for the Docker container engine. Because the tile service and all of its dependencies are completely encapsulated in Docker container images, as each EC2 instance registers its available resources with the Amazon Container Service (ECS) scheduler, tile service instances can be rapidly instantiated across the EC2 fleet with minimal coordination overhead.</p><h4>Preprocessed Tile Data and GeoTrellis</h4><p>Raw imagery added to Raster Foundry goes through an <em>ingest </em>process, which is just a fancy way of saying we preprocess the raw raster data to make it easier for us to operate on later. This process consists of:</p><ul><li>Reprojecting the imagery into a uniform geographic coordinate system (for the web, this is almost always <a href="https://en.wikipedia.org/wiki/Web_Mercator">Web Mercator</a>)</li><li>Tiling the imagery and indexing it with a <a href="https://en.wikipedia.org/wiki/Space-filling_curve">space-filling curve</a></li><li>Resampling groups of tiles into lower resolution tiles that present a zoomed out view of the imagery’s original resolution</li><li>Persisting the tiled output (and some metadata) in a configurable GeoTrellis storage backend, which in our case is Amazon’s Simple Storage Service (S3)</li></ul><p><a href="http://geotrellis.readthedocs.io/">GeoTrellis</a>, a Scala library and framework used to interact with raster data via Apache Spark, powers this preprocessing workflow in a parallelizable fashion, and also provides an interface to efficiently query the data afterwards.</p><h4>Intermediate Tile Data Caching</h4><p>All of this information is relevant because it helps surface an opportunity for <em>caching</em>. While there isn’t a very high cache/hit ratio for rendered tiles due to the wide range of input parameters, there is some benefit to caching the underlying data (data coming from the GeoTrellis S3 storage backend) used to assemble the painted tile. We see value in caching these intermediate data tiles inside of a lower latency distributed in-memory cache. In our case, that cache is provided by Amazon ElastiCache, which supports a multi-node managed Memcached cluster with client-aware automatic discovery.</p><p>As an example, let’s assume that a fully rendered tile is the grid below resulting in a <em>green</em> cell, and the grids with <em>yellow</em> and <em>blue</em> are preprocessed data tiles housed in S3. The series of operations and input parameters that lead <em>yellow</em> and <em>blue</em> to become <em>green</em> are vast, so caching the resulting tile may not have much value. But, if we cache the <em>yellow</em> and <em>blue</em> tiles, then future operations for the same location can reuse the cached <em>yellow</em> and <em>blue</em> tiles instead of having to refetch them from S3.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/1*QpNWaE_0Wah2G_iUq6Wk-w.gif" /><figcaption>Animation to demonstrate a raster data operation across multiple tiles.</figcaption></figure><h3>Conclusion</h3><p>When we demo Raster Foundry to people for the first time, there are three key moments that really help drive home the value of our platform:</p><ul><li>When they get to see <em>their imagery</em> on a modern web map</li><li>When they get to <em>adjust parameters</em> and see the results of those adjustments <em>immediately</em></li><li>When they realize that all of the parameters and operations at their disposal happen <em>dynamically</em></li></ul><p>Amazon’s cloud computing platform, strategic indexing and caching of raster data, and GeoTrellis help us make all of the points above possible. Collectively, they are Raster Foundry’s equivalent of grout and mortar.</p><p><em>This post is about the architecture and tooling behind Raster Foundry. Raster Foundry is a platform that helps you find, combine, and analyze earth imagery at any scale. Supported, in part, by grants from NASA (NNX16CS04C) and the US Dept. of Energy (DE-SC0013134). Sign up for a </em><a href="https://www.rasterfoundry.com/#beta-signup"><em>live demo</em></a><em> today!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=270914f9788b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>