Skip to content

Instantly share code, notes, and snippets.

@brianherbert
Forked from dkobia/gist:849945
Created March 1, 2011 22:32
Show Gist options
  • Save brianherbert/850031 to your computer and use it in GitHub Desktop.
Save brianherbert/850031 to your computer and use it in GitHub Desktop.
$(document).ready(function(){
var ci_styles = new OpenLayers.StyleMap({
"default": new OpenLayers.Style({
pointRadius: "10", // sized according to type attribute
fillColor: "${fillcolor}",
strokeColor: "${strokecolor}",
strokeWidth: 2,
graphicZIndex: 1
},
{
context:
{
fillcolor: function(feature)
{
},
strokecolor: function(feature)
{
},
}
}),
"select": new OpenLayers.Style({
fillColor: "#66ccff",
strokeColor: "#3399ff",
graphicZIndex: 2
})
});
var checkinLayer = new OpenLayers.Layer.Vector('Checkins', {styleMap: ci_styles});
map.addLayers([checkinLayer]);
$.getJSON("<?php echo url::site()."api/?task=checkin&action=get_ci&mapdata=1&sqllimit=1000&orderby=checkin.checkin_date&sort=DESC"?>", function(data) {
$.each(data["payload"]["checkins"], function(key, ci) {
var cipoint = new OpenLayers.Geometry.Point(parseFloat(ci.lon), parseFloat(ci.lat));
cipoint.transform(proj_4326, proj_900913);
var checkinPoint = new OpenLayers.Feature.Vector(cipoint, {strokecolor: "#FF44FF"});
checkinLayer.addFeatures([checkinPoint]);
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment