I am trying to add a marker to the left/right of a point I have from a GeoJson object. I am trying to take my coord and subtract 0.00001 from it, but it errors out my code when I try to run it. I figured if it is essentially a JSON obj, I would be able to pull it and do math on it and save it as another variable. Any ideas?
code:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.js"></script>
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<style>
#my-map {
width: 1700px;
height: 900px;
}
</style>
</head>
<body>
<div id="my-map"></div>
<script>
window.onload = function () {
var basemap = L.tileLayer("http://{s}.tile.osm.org/{z}/{x}/{y}.png", {
maxZoom: 19,
minZoom: 5,
});
$.getJSON("geocode-output.geojson", function (data) {
var geojson = L.geoJson(data, {
onEachFeature: function (feature, layer) {
layer.bindPopup(
feature.properties.address +
"<p><b> Location Address: " +
feature.properties.address +
"</b></p>" +
"<p><b> Crit Flow: " +
feature.properties.crit_flow +
"</b></p>" +
"<p><b> Peak Hr: " +
feature.properties.peak_hr +
"</b></p>" +
"<p><b> Lat_test: " +
feature.geometry.coordinates[0] +
"</b></p>"
);
},
});
var googleSat = L.tileLayer("http://{s}.google.com/vt/lyrs=s&x={x}&y={y}&z={z}", {
maxZoom: 20,
subdomains: ["mt0", "mt1", "mt2", "mt3"],
});
var map = L.map("my-map").fitBounds(geojson.getBounds());
// .setView([0.0,-10.0], 2);
let lat_test = feature.geometry.coordinates[0] - 0.00001;
let lng_test = feature.geometry.coordinates[1];
var marker = L.marker([37.7858, -122.401], { title: "My marker" }).addTo(map);
basemap.addTo(map);
googleSat.addTo(map);
geojson.addTo(map);
});
};
</script>
</body>
</html>
Code output without arithmetic: