[php]
/*
Plugin Name: Distance
Plugin URI: http://bokeconsulting.com/programming/plugins/distance/
Description: Calculates distance between two map coordinates.
Version: 0.1
Author: Bruce Duggan
Author URI: http://bokeconsulting.com
Copyright: Bruce Duggan 2014
Acknowledgement:
The code used in this plugin is based on Martin Stoeckli's code
found at http://stackoverflow.com/users/575765/martinstoeckli,
who in turn based his code on the Vincenty formula.
License: GPL
This program is free software: you can redistribute it and/or modify
it under the terms of the latest version of the GNU General Public License
as published by the Free Software Foundation. It is distributed in the hope
that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
add_shortcode('distance','distance_func');
function distance_func($atts){
extract( shortcode_atts(array(
'vals' => '0',
), $atts ) );
$coordinates = explode(',', $vals);
$latitudeFrom = $coordinates[0];
$latitudeTo = $coordinates[1];
$longitudeFrom = $coordinates[2];
$longitudeTo = $coordinates[3];
$earthRadius = 6371;
$latFrom = deg2rad($latitudeFrom);
$lonFrom = deg2rad($longitudeFrom);
$latTo = deg2rad($latitudeTo);
$lonTo = deg2rad($longitudeTo);
$lonDelta = $lonTo - $lonFrom;
$a = pow(cos($latTo) * sin($lonDelta), 2) + pow(cos($latFrom) * sin($latTo) - sin($latFrom) * cos($latTo) * cos($lonDelta), 2);
$b = sin($latFrom) * sin($latTo) + cos($latFrom) * cos($latTo) * cos($lonDelta);
$angle = atan2(sqrt($a), $b);
$distance = $angle * $earthRadius;
$rounded = round($distance,-1);
$roundedMore = round($distance,-2);
$roundedMost = round($distance,-3);
$roundedLess = round($distance);
if ( is_user_logged_in() ) {
if ($distance > 1900) {
return number_format($roundedMost);
} elseif ($distance > 190) {
return number_format($roundedMore);
} elseif ($distance > 19) {
return number_format($rounded);
} else {
return number_format($roundedLess);
}
}
}
/*End Of File*/
[/php]
[text-blocks id="table-section-line"]
|
product |
amount |
|
form |
location |
distance |
price |
buy |
▲ |
Wood Pellet |
1,000 |
tons |
pellets |
Indonesia ⋅ AL |
|
US$115 |
/ ton |
|
|
Details |
|
source material: |
wood - processing residue |
|
|
|
primary uses: |
fuel for heat, fuel for electricity generation |
|
secondary uses: |
fuel for heat, fuel for electricity generation |
|
|
|
not suitable for: |
|
|
|
|
Does seller deliver? |
yes |
|
Is delivery included in price? |
no |
|
|
|
Augerable? |
|
|
|
|
Storable? |
|
|
|
|
calorific value: |
avg: 4,600 Kcal/kg |
|
|
|
moisture content: |
avg: 5.51% |
|
|
|
ash residue: |
avg: 1.35% |
|
|
|
note to potential buyer: |
**Wood Pellet Specifications** - **Material**: Premium Hardwood - **Thickness**: 8 mm - **Length**: 30-50 mm - **Ash Content**: 1.35% - **Sulfur Content**: 0.04% - **Chlorine Content**: 0.13% - **Density**: 675 kg/m³ - **Calorific Value**: 4600 kcal/kg (GAR) - **Packaging**: Jumbo Bags (700 kg to 1 MT) - **Minimum Order Quantity**: 1 FCL (20 feet, 20 MT) - **HS Code**: 44013100 **Contact Information**: - **Contact Person**: Mr. Tri Widodo - **Email**: sales@indostock.com - **Phone**: +6281218328118 - **WhatsApp**: +6281218328118 |
|
|
[text-blocks id="table-section-line"]
Don't see the biomass you need at the price you want? Sign In or Join and add a want-to-buy listing.
[text-blocks id=fine-print-trade-show]