OSM, CORS, and PaperJS


I’ve often wondered why anyone would use OpenStreetMap (OSM) rather than Google Maps. The Google Maps API has so many bells and whistles and it’s so easy to use. Well, as I’ve been playing PaperJS recently, I wanted to explore some of its raster capabilities. Google has a static maps API, so I thought I’d load one of those images and play with its pixels. But wait! Apparently, Google Maps does not allow Cross Origin Resource Sharing (CORS), and according to the W3C wiki, they are not planning on enabling this any time soon (*). OpenStreetMap is CORS-enabled, though, so score one for open source. My example loads an OSM tile, converts it to a PaperJS raster and resamples it to a lower resolution.

*Note: apparently the Google Street View Panorama library is CORS-enabled, as displayed in this example (not my work).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s