Skip to content

Instantly share code, notes, and snippets.

@GusGA
Last active December 27, 2015 09:58
Show Gist options
  • Save GusGA/7307222 to your computer and use it in GitHub Desktop.
Save GusGA/7307222 to your computer and use it in GitHub Desktop.
Método de clase para generar el contenido con formato geojson para crear puntos en el mapa
def self.to_geojson
{ type: "FeatureCollection",
features:
self.all.map do |local|
{
type: "Feature",
geometry: { type: "Point", coordinates: local.coordinates},
id: local.id,
properties: { prop1: local.val1,
prop2: local.val2,
prop3: local.val3,
prop4: local.val4
}
}
end
}
end
# según las especificaciones de http://geojson.org/geojson-spec.html#point
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment