PHP UK Conference 2013

Usando OpenStreetMap en la web

Derick Rethans  · 

Presentación

PDF (pincha para descargar)

Vídeo

Transcripción

Extracto de la transcripción automática del vídeo realizada por YouTube.

alright welcome after lunch do you all have a cup of coffee or tea with you because if people start snoring all make fun of you a lot and don't don't think that never happens because it does people snoring loudly in the back I will make fun of you

alright and i'll be talking with austin about openstreetmap for the web whether that should be an uppercase F or lowercase F I debated about five minutes then went to the pub and this slides will be online through this year all over here that's also

where you can leave feedback the link to the slides is an extra link to the slides it's a link to a page that has all the resources on there so don't bother trying to write them down just go to link and have them all there so you don't have to

copy all right so what am I talking about him first a little bit about myself I'm Derek and I've been speaking at conferences for so I'll hear something like that I'm Dutch vera leaf in London I work as one of the PHP mongodb drive maintain

is I also hack on lots of order PHP extensions you might have heard of this thing called XD book it's also something that I've done all right and i absolutely love maps maps is a bit of a hobby for me an Open Street Map combines two very interesting

things it combines walking around cities or countryside maps as well as pups and that's always great thing good combination if you ask me so let's talk a little bit about Bob maps actually are well you know that the earth is the is falling away but

the earth is actually not really square on my Mac and now I can't actually but that's right no don't worry too much about is the if it's only the theme messing number around right so yeah the earth is not really sphere right it is a bit elongate

it is a bit wider than it is high and there's a bit of a pear shape and yeah not quite like that there's no stamp for it but this creates quite a lot of interesting difficulties because in order to approximate the shape of the earth you use it differently

depending on where on earth you're so most mapping solutions that will try to create a reference ellipsoids an ellipsoid is basically what was fear but a bit longer than water and they try to match that to the size of the earth or to do how do you call

it the how do you looks like and there's different ways of doing that and use and this is some this is like that I don't have outside of UK because it's not really necessary but if you do anything with maps in the UK every coordinates that will

be provided for you will be a voc be done in a system called osg be 36 and that coordinate system is not the same as what you find on almost on my graphing applications so what Google Maps uses what openstreetmap use we use wgs84 which is the same thing that

GPS uses fairly useful whereas in the UK they tend to use osg be 36 because that is a better-fitting shape to how the earth looks like for the UK right so that is sort of important but after you have figured out which shape fits best you still need to define

two things you need to well northern sound is quite simple because that's your poles but where do you put your meridian right and that is also not really that simple I mean how many of you have here been here to the Royal Observatory in Greenwich and how

how many of you have used a GPS on that line right I know what happens then because it doesn't show zero you actually need to walk 170 meters this way and end up on the blue line which is the GPS meridian and it has changed a little bit so this is something

that you need to keep in mind if you see coordinates in UK because almost everything will be using oh she beat 36 cornet luckily you can convert it but I don't have the mods for that ball now after you have created your coordinate system you still need

to map a spherical or an ellipsoid to a plane but because usually I don't have a globe in my pocket but the map is a lot easier to do and it's different ways how you can do that so here we have I don't even actually this equivalent projection fairly

useful for North America but if you in India pretty useless because as you can see here is always squished to the Android there's the Australian variant that likes putas draw in the top middle again probably not a world filled at you often see but I mean

if you miss girl yet might make some sense animal I think this is looks really really weird myself all the things that exact or exaggerate certain shapes right so this is a petersville pipe is horrible projection it's a projection because it's the

length of Africa and the length of say what Australia is not nearly as high as a third of Africa right and it's really difficult to see anything useful to serve as many different protections what most online things use including openstreetmap is the wgs

84 system anyway now a little bit about openstreetmap I've told to about maps but openstreetmap is actually not about maps it is about geographical data stored in an enormous database this all owner free license you can download everything I have some

example of that later and you can use it as much as you want providing that you get an attribute bution that you're using openstreetmap and as if you all are points that you can have to look at if you look at a license but the basic idea is that your credit

openstreetmap and don't intermix it with with your own personal data or your company's data to create a new database so it's a bit of a copy copy leftish license but that shouldn't really be a problem so opens free map is both this database

business a few other points as well there's api's to art and read the data and it's also a social platform for improving a map and that is how I Walton to openstreetmap am I don't know some another PHP developer can guess I'm not sure any

of you know him he introduced me to openstreetmap because i hope next thing you remember why don't remember why but it's been all his fault that i spent way too much time napping now alright so of course you want to show a map if you have the data

for it right so this is an API code leaflet so if you if you speak about Google Maps API you think about an API from bearing a map in your website right the OpenStreetMap ABI is the API for adding and reading data openstreetmap doesn't provide a embeddable

mapping tool for your website where it is very many different variants that allow you to that I tend to use something called leaflets and leaflets is is fairly simple to use I mean this is probably the most simple way of doing it you get to zoom around here

from a mouse blender and zoom in and stuff like that I means this simple space you can do and there's some controls or so now setting this up is not more than to click that it's about this much I mean there's not even PHP involved right it's

just a bit of JavaScript and a map library that unity includes all right so that's a showing the map but it's all of course different API is a chicken and then this is a fairly simple one interesting they seem to be I know that they recently push the

new stealth suit like last week or so and now all the tube stops are showing up a lot better than they used to be before which I definitely like okay so this map automatically sends it on London and London is basically a 12 square there's actually a little

dot on Trafalgar Square you can find it and doing finding the coordinates for that is fairly simple there's a service called nominative normal item is a bit of a sister party openstreetmap openstreetmap itself like I said is the data but there's lots

of side projects such as leaflet and nominate same here and yeah it's really really simple to find coordinates for things like that what is basically returns is a big JSON document or actually I told her to return JSON so that's why returning case

in otherwise of the six and upwards it returns quite a lot of information here a lot more than I put in because i put in london UK the UK is sort of important because otherwise it's sometimes returns long in Ontario which is not quite where we are at the

moment and yeah you get quite a lot of stuff back the place that isn't interesting you get to see the osm type which can either be a note away our relation its ID again not very interesting but what is interesting that you get a bounding box back for the

object as o in a bounding box is basically a demarcation of London in this case as well as here we have the center points and it also expands the name so it expands long run into also again is that it's gotten a bit ridiculous lately its long-run great

[ ... ]

Nota: se han omitido las otras 4.309 palabras de la transcripción completa para cumplir con las normas de «uso razonable» de YouTube.