Use bing maps for geofencing. #221
This commit is contained in:
parent
b2e394d1b2
commit
00f2bb86fa
3 changed files with 12 additions and 20 deletions
|
|
@ -16,6 +16,7 @@ APP_SECRET=b344cd6cd151ae1d61403ed55806c5ce
|
||||||
DATABASE_URL=mysql://db_user:db_password@127.0.0.1:3306/db_name
|
DATABASE_URL=mysql://db_user:db_password@127.0.0.1:3306/db_name
|
||||||
###< doctrine/doctrine-bundle ###
|
###< doctrine/doctrine-bundle ###
|
||||||
GMAPS_API_KEY=insertgmapsapikeyhere
|
GMAPS_API_KEY=insertgmapsapikeyhere
|
||||||
|
BINGMAPS_API_KEY=insertbingmapsapikeyhere
|
||||||
|
|
||||||
# rising tide sms gateway
|
# rising tide sms gateway
|
||||||
RT_USER=rt_user
|
RT_USER=rt_user
|
||||||
|
|
|
||||||
|
|
@ -4,3 +4,4 @@ twig:
|
||||||
strict_variables: '%kernel.debug%'
|
strict_variables: '%kernel.debug%'
|
||||||
globals:
|
globals:
|
||||||
gmaps_api_key: "%env(GMAPS_API_KEY)%"
|
gmaps_api_key: "%env(GMAPS_API_KEY)%"
|
||||||
|
bingmaps_api_key: "%env(BINGMAPS_API_KEY)%"
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@
|
||||||
<div class="m-portlet__body">
|
<div class="m-portlet__body">
|
||||||
<div class="form-group m-form__group row">
|
<div class="form-group m-form__group row">
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
<div id="m_gmap" style="height:600px;"></div>
|
<div id="m_bingmap" style="height:600px;"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id = "area-rows" class="form-group m-form__group row">
|
<div id = "area-rows" class="form-group m-form__group row">
|
||||||
|
|
@ -83,21 +83,16 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
<script src="//maps.google.com/maps/api/js?key={{ gmaps_api_key }}" type="text/javascript"></script>
|
<script type='text/javascript' src='http://www.bing.com/api/maps/mapcontrol?callback=GetMap&key={{ bingmaps_api_key }}' async defer></script>
|
||||||
<script src="/assets/vendors/custom/gmaps/gmaps.js" type="text/javascript"></script>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// BEGIN google maps stuff
|
|
||||||
|
|
||||||
var polygons = new Array();
|
var polygons = new Array();
|
||||||
|
|
||||||
initMap();
|
function GetMap()
|
||||||
|
{
|
||||||
function initMap() {
|
var map = new Microsoft.Maps.Map('#m_bingmap', {
|
||||||
var map = new google.maps.Map(document.getElementById('m_gmap'),
|
center: new Microsoft.Maps.Location(14.6091, 121.0223),
|
||||||
{
|
mapTypeId: Microsoft.Maps.MapTypeId.road,
|
||||||
center: {lat: 14.6091, lng: 121.0223},
|
|
||||||
mapTypeId: 'roadmap',
|
|
||||||
zoom: 13
|
zoom: 13
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -106,20 +101,17 @@ function initMap() {
|
||||||
var pointsArray = new Array();
|
var pointsArray = new Array();
|
||||||
|
|
||||||
{% for point in obj.getCoverageArea.getRing(0).getPoints() %}
|
{% for point in obj.getCoverageArea.getRing(0).getPoints() %}
|
||||||
var polylatlng = new google.maps.LatLng(
|
var polylatlng = new Microsoft.Maps.Location(
|
||||||
{{ point.getLatitude }},
|
{{ point.getLatitude }},
|
||||||
{{ point.getLongitude }});
|
{{ point.getLongitude }});
|
||||||
|
|
||||||
pointsArray.push(polylatlng);
|
pointsArray.push(polylatlng);
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
var coveredarea = new google.maps.Polygon({
|
var coveredarea = new Microsoft.Maps.Polygon(pointsArray, {
|
||||||
paths: pointsArray,
|
|
||||||
fillColor: "#FF0000",
|
fillColor: "#FF0000",
|
||||||
fillOpacity: .5,
|
|
||||||
mapTypeId: 'roadmap'
|
|
||||||
});
|
});
|
||||||
coveredarea.setMap(map);
|
map.entities.push(coveredarea);
|
||||||
|
|
||||||
polygons[{{ obj.getID}}] = coveredarea;
|
polygons[{{ obj.getID}}] = coveredarea;
|
||||||
|
|
||||||
|
|
@ -127,8 +119,6 @@ function initMap() {
|
||||||
{% endif %}
|
{% endif %}
|
||||||
}
|
}
|
||||||
|
|
||||||
// END google maps stuff
|
|
||||||
|
|
||||||
$('tr td').click(function(e) {
|
$('tr td').click(function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue