Skip to content

Instantly share code, notes, and snippets.

View mousebird's full-sized avatar

Steve Gifford mousebird

View GitHub Profile
// Add a marker for each point in a list of vectors
private void insertClusteredMarkers(List<VectorObject> vectors, MaplyBaseController inController)
{
// The markers will be 32x32 pixels
Point2d size = new Point2d(32, 32);
List<ScreenMarker> markers = new ArrayList<>();
Bitmap icon = BitmapFactory.decodeResource(getActivity().getResources(), R.drawable.sticker);
// For each vector object, add a marker in the middle
for (VectorObject v : vectors) {
static public CoordSystem MakeBNGCoordSystem(Activity activity, boolean displayVersion)
{
String projStr = "+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +units=m +no_defs";
Proj4CoordSystem coordSys = new Proj4CoordSystem(projStr);
// Set the bounding box for validity. It assumes it can go everywhere by default
Mbr bbox = new Mbr();
bbox.addPoint(new Point2d(1393.0196,13494.9764));
bbox.addPoint(new Point2d(671196.3657,1230275.0454));
@mousebird
mousebird / Sticker.swift
Last active November 7, 2016 18:19
Smiley Face Stickers
func addStickers (_ arrayComp: NSArray , baseViewC: MaplyBaseViewController) {
// Pick up a smiley face image
let startImage = UIImage(named: "Smiley_Face_Avatar_by_PixelTwist")
var stickers = [MaplySticker]()
// Add a sticker for each input point
for object in arrayComp {
let sticker = MaplySticker()
let center = (object as! MaplyVectorObject).center()
<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor version="1.0.0" xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd" xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<NamedLayer>
<Name>openstreetmap buildings</Name>
<UserStyle>
<Name>normal</Name>
<FeatureTypeStyle>
<Rule>
<MinScaleDenominator>0</MinScaleDenominator>
<MaxScaleDenominator>13000</MaxScaleDenominator>
struct VertexArgBufferA {
const device Uniforms *uniforms [[ id(WKSUniformArgBuffer) ]];
const device UniformDrawStateA *uniDrawState [[ id(WKSUniformDrawStateArgBuffer) ]];
};
// Vertex shader for simple line on the globe
vertex ProjVertexA vertexLineOnly_globe(
VertexA vert [[stage_in]],
const device VertexArgBufferA & vertArgs [[buffer(WKSVertexArgBuffer)]])
{
@mousebird
mousebird / maplibre_native_metal.md
Last active September 14, 2022 16:51
Stamen's Proposal for MapLibre Native Rendering Support

Who

Stamen is a design/technology company known for its data visualization and open work (e.g. Stamen Watercolor). SteveG consults for Stamen now and then on mobile and is known for another open source map toolkit (WhirlyGlobe-Maply) which made the transition to Metal years ago.

What

We're floating a proposal with some of Stamen's clients to upgrade MapLibre Native to:

  • Open up the rendering subsystem in MapLibre Native
  • Implement a Metal rendering module for iOS / MacOS