Add windy.js on leaflet map as a layer - php

i want to add wind data on my leaflet map as a layer
wind data like this https://danwild.github.io/leaflet-velocity/

I've been working on something similar. I found a pretty good looking
and intuitive method being used to represent vector information. Have
a look at the following examples:
http://earth.nullschool.net/
http://hint.fm/wind/
http://air.nullschool.net/
http://googlemapsmania.blogspot.com/2014/07/the-growth-of-slippy-wind-map.html
In my case, I still need to find a suitable format for the wind/ocean
data I want to plot on my Leaflet map. It's certainly not a quick fix,
but man, it looks great!
Maybe this can help you too. I hope to be able to post a working
solution soon.
This plugin takes input data in form of speed in knots (nautical miles
(1.852 km) per hour) and direction in degrees. It then generates the
wind barbs and outputs an icon. This icon can easily be added to a
Leaflet marker.
You can download it here:
https://github.com/JoranBeaufort/Leaflet.windbarb And you can see a
live example here: http://www.geonet.ch/leaflet-windbarb/

Related

Chart plotting algorithms?

I am looking to plot charts using the PHP image create, what kind of algorithms are used to transform my terrible chart:
Into something better like:
and
How can I make the lines of my chart smooth and pretty like the 2 charts above?
edit: I don't want to use any library, I am trying to do this myself.
Try this best think, I use these charts all the time
http://www.highcharts.com
For "smoothing the lines", you have to refer to external sources about antialiasing (or let PHP do this part, see manual)
Then, you need to have an idea how exactly your graph should look like:
axis (scaling, labeling, ...)
grid (with differend line width for major and minor segments?)
representation of data (points, straight lines, smooth lines [getting rather hard again here])
description
And I think each point could be a quite well suited coding exercise. But without more specific questions, I can't help you better.

Generate countries map based on geoip data

I have searched a lot on this topic, and have found no answers.
I have my own statistics package where I'm saving the geoip data of my users (along with a bunch of other data). I'm using the maxmind geoip library to get this information.
So, in my backend I'm visualizing this data as text that have basically two columns, one for the country name and another for the number of visits from the country.
I'd like to generate a map with this data.
something like a world map with the countries I have visits from highlighted.
Heat mapping would be nice, but not required.
I dont really care if it's generated with php (GD image library) or jquery, since I'm already using both those technologies for the statistics backend. But I'd REALLY like to do this without google analytics or their graphing APIs.
I will try to suppose. The way I would try do it ...
Get FullHD (or HighRes world map)
Coordinates I'd keep in WGS84 standard (float values, otherwise it is easy to convert)
I would try to approach real coordinates to the scale of image, but before this ...
The major part in this work is Math. I'm actually not a mathematician, but I know that it should be applied here and why.
Main goal here is to project coordinates on a flat surface, bec. WGS84 uses oblate spheroid as a reference surface (with radius = 6378137 m; flattering = 1/298.257223563), so it is not ideal circumference and it should be taken into account. + image should be GEO binded somehow (you should know coordinates of corner angles of this image #least. it is the easiest case if so).
Calculations for this case are not very massive, everything leads to the elementary plane geometry.
Here is the library that could help you working with geospatial data http://www.gdal.org/.
My advice to you, to consult some specialists in this field if you know nothing about it (maybe SatCom spec. or MobCom spec. in some university/academy) (or try Google if you are familiar enough with math and GEO) and to ask for a math model for projection of GPS coordinates to the flat surface and you will definitely get the answer.
If you don't need very high accuracy, try it yourself maybe you'll have luck.
You can try yourself in MatLab (more applicable in this case) or Mathcad if you know math enough and try yourself to position few points on the raster.
If you will find the answer in the nearest future, I would be glad if you post it here or share with me your solution for the particular case.
i need to finally answer my own question here. for anyone else who stumbles across this:
i have been using the d3js library with the topojson extension.
https://github.com/mbostock/topojson

KML getting viewport LAT-LONG via NETWORK LINK

I've got all my data sorted and formatted in KML using placemark tags.
Because my database is quite large I would like to get the LAT LONG of the top left and bottom right of the users VIEWPORT. Or something like that so I can return an only a small section of my data.
I'm using PHP and guess somehow I can get Google Earth (NOT Google Maps) to GET, POST or PUT something in the Request so that I can process it and return a KML.
I hope thats clear.
Thanks
P.S I've got lost a few times in the docs.
You can use the BBOX parameter in the <ViewFormat> element -- see http://code.google.com/apis/kml/documentation/kmlreference.html#viewformat for specifics and alternatives, and a more detailed example (the one below is simplified to emphasize the <ViewFormat> tag).
<NetworkLink>
<name>NE US Radar</name>
<flyToView>1</flyToView>
<Link>
<href>http://www.example.com/geotiff/NE/MergedReflectivityQComposite.kml</href>
<viewFormat>BBOX=[bboxWest],[bboxSouth],[bboxEast],[bboxNorth]</viewFormat>
</Link>
</NetworkLink>

Getting information from Gmaps like grassland, street, water etc

I'm thinking about a project, where I need such informations as described in the title. Does the Google Maps API provide something like this, or does anyone know how to get these informations?
Project will be done in PHP, HTML and Javascript.
AFAIK Google doesn't provide this information via the API. The only thing I can think of is getting the image, and then detecting the colour. A map of colour hex values against point type might give you what you need.
However, this may well break the Terms and Conditions, depending on what you're doing.

How to Centre & Zoom a Google map V3 on it's markers using PHP (no Javascript!)?

I have a Google map with several markers displayed, typically around six. I want the map scaled and zoomed to fit all six markers and hopefully centred on them too. I am using Google maps V3.
It's not an uncommon problem, even here on Stackoverflow, but all the solutions I've seen employ Javascript. For various reasons I want to use PHP only, not least of which is I have everything working with PHP and it shouldn't be necessary to use another technology for part of the solution; it's messy and difficult to maintain. So for clarity let me repeat, I am looking for a PHP solution here!
Here's a snapshot of what I have right now:
// 1st marker
$lat=$_SESSION['map_lat_1']; // latitude
$lng=$_SESSION['map_lng_1']; // longitude
$isclickable='true';
$title=$_SESSION['map_title_1'];
$info=$_SESSION['map_info_1'];
$icon='mapclass/my-marker.png';
$map->addMarker($lat,$lng,$isclickable,$title,$info,$icon);
// 2nd marker
$lat=$_SESSION['map_lat_2']; // latitude
$lng=$_SESSION['map_lng_2']; // longitude
$isclickable='true';
$title=$_SESSION['map_title_2'];
$info=$_SESSION['map_info_2'];
$icon='mapclass/my-marker.png';
$map->addMarker($lat,$lng,$isclickable,$title,$info,$icon);
So I feed the calls to addMarker with data garnered from numerous variables, some session variables, then I do the call:
echo $map->showmap();
And it all works well. Except I have a very rough 'rule of thumb' algorithm I devised to try to guess at the zoom level etc. It's hit 'n miss at best. I'm sure there must be a PHP way of accessing additional functions to set the framing and zoom factors to whatever's needed for any given case, but what are they and where do they fit into the scheme of things?
Your thoughts would be much appreciated!

Categories