 Before I get started, if you saw me give a similar talk in Mount Ruby about a month ago, there is still time. You'll see what the rock music was about. This is going to be a very similar presentation. There's some more material, but the guts are the same. Second point of order is there's a bit of time at the end for some questions. People who ask questions are going to be first in line to get free t-shirts. So I've got a bunch of t-shirts down the front here, and I'm going to give those away after my talk. So, like I said, my name's Pete Jackson. I work for Intridia, and I'm here to talk about an introduction to geospatial programming. These are the topics I'm going to cover. I'm going to go over what spatial programming is. You talk about some important background terms in the spatial space. Talk about tools in the Ruby and in the Rails spatial stack. And then talk a bit about how to get started with spatial programming. So, spatial programming. In a nutshell, it is exposing space as a first-order programming concept. It is dealing with the distances and the sizes and shapes of things as if it were built into your language. When you do spatial programming, you get rich built-in support for shapes, sizes, and the relationships between things. I'm going to talk about describing things spatially. These are some of the things you can describe spatially. Locations on the earth, geometric equations, shapes of buildings, parts in an assembly, positions of things, where your chess pieces are. Anything that basically breaks the mold of your typical object relational database. We're all pretty familiar with applications where we store things like customer records and orders and warehouses and items and customers have orders and orders and items and so on. That's a very relational concept. But when we start taking a step beyond and asking things like, what warehouse is closest to my customer? What is the route we can take to service the most customers the fastest? Then we start to get into spatial programming. So here's some of the kinds of questions you can answer using spatial programming logic. Find the components of a vehicle close to the fuel line that admit heat. Again, it has to do with the distances between things and the relationships and sizes of objects to other objects. And note that it doesn't necessarily have to be about a place on the earth. It can just be the components of a blueprint. If you feed a blueprint into a spatial logic system, you can ask your system questions like this. The second question is more of a marketing question. You probably run across this one. This is one of the ones you'll run across. If you start applying spatial logic and spatial thinking to your applications. Then the third one is also a marketing and sales type of question. Find competitors within 10 miles of the road where there's an available billboard within 20 miles on that road. These are the types of questions you can ask of a spatial system that are a little bit more difficult to answer when you're thinking relationally. So that's what I mean when I talk about spatial programming. What I want to do now is go through a few background terms that are pretty important to get if you're going to jump into spatial programming and location-based or spatial-based applications. I'm going to go through each of these in terms, so I'm not going to read this to you, but these are the key terms that I'm going to spend some time talking about. First, a GIS system is a system that visually represents data. And there are a number to choose from. There are often desktop applications, but every time you embed a map and a web page and drop a dot on it, you're also building a little TD GIS system. I wanted to throw up some examples here because these are all, for the most part, they're not all, but most of these are open source and freely available, very powerful geographic information system tools. On the top left is a system called GRASS. That's also what's on the bottom left. On the top right is ArcGIS for iPad, which is either free or cheap, but it's a very powerful, very powerful tool you can run with. And the bottom center is another look at ArcGIS, and then on the bottom right is probably the most powerful GIS system that nobody uses. It's the NASA's World Wind GIS package, and it's pretty complicated to use, but you can do an awful lot with it. And just because it's built in, just because the toolkit is built in Java, it's still pretty darn good, so I encourage you to jot those down and maybe check them out. Of course, I think everybody's familiar with the most widely used GIS system, which is the Googles. Google Maps and Google Earth are very popular, and brought GIS technology to the masses, so I think everybody's pretty familiar with the kinds of things that you can display in Google Earth and Google Maps. What I would like to, one of the points of my talk today, just in case you're thinking a little bit further than just dropping a pin on that, then we'll see how to do that a little bit later. Another shot of Google Earth. All right, layering. The next important background to understand if you're going to do spatial programming is the concept of layering. You're going to build a spatial application. One of the important things that you want to think about and learn how to do is build layers of information and put them on top of each other and display them in such a way that you tell a story. So just like in Photoshop, spatial tools let you layer together raster and vector data. Raster data being like a JPEG or a picture, and then vector data being like a shape file or something you can scale out and down. You give me an example of what I mean when I say that you layer things together to tell a story when you're building a spatial application. This is a desktop GIS system called Quantum GIS, and the story that I'm going to tell today is about an epidemiologist. An epidemiologist is someone who's interested in the spread of disease, and the spread of disease is obviously a geographic or location-based question, and if you're trying to do analysis and figure out the story behind the spread of a particular vector or disease, you may use a GIS to tell that story. So on the screen here, we have some cases of the measles, the mumps, and chickenpox. Really hard with the stage over here. I like to look at that. It's like the urge. The mumps are on the top right. The measles are on the bottom left, and there's a case of the chickenpox in the middle. So an epidemiologist may look at this map and say, all right, well, I'd really like to understand what's going on here. So let's layer in talents and see how talents cluster with the cases of disease that we're interested in exploring. It doesn't tell us too much, except that the mumps cases are clustered around Queenstown and the top right. So then we might add in where the schools are. So maybe if some of these childhood diseases are clustered around the schools, it looks like there might be a correlation down on the bottom left with the measles cases. There's a lot of schools in the picture there, so it's hard to get the whole story. So maybe we add in railways to see if anything came through on a train. Maybe we add in a river's layer to see if something came in by boat. These are the kinds of stories you can start to tell by layering rich data on top of your data points, by adding more information to the picture and really thinking hard about how you tell the story you're trying to tell and make a proper analysis. A little bit more than a couple of dots on that. The next item I want to give you a little bit of background about before we dive in is WMS, which is a web mapping service. You'll hear a lot about these once you start diving into custom data sets. And once you start looking for imagery or base map players that are different from your standard Google Bing map backgrounds, you can get tons of base data, tons of stuff to be on the bottom of your map. You just have to go look for it. It's mostly freely available. And the types of information you can get, really you can tailor it to the kinds of applications you're trying to build, the kind of story you're trying to tell and the kind of problem you're trying to solve. So I'm sure some of you have heard of OpenStreetMap. It's a really good place to go if you want a base layer for an application that's going to teach people how to route around Europe by road. That might not be what you're trying to show, though. Maybe what you want to show is the foliage covering the Earth. In that case, you might want to go to NASA use their WMS server to pull back imagery of the Earth taken off of the Landsat satellites. You can do that. If you are building the next navigate around town and show people how to get from place to place application you might grab the Bing base map layer. It's pretty good. You can see buildings. It's pretty multi-tailed. The pin on this map is actually centered on the building from my homeroom user group in DC. There you go. There are other sources, too. You don't have to go to any of the big providers and you don't have to go to the well-known names. You can actually buy pretty good imagery from commercial sources. This is where it gets expensive. But you can get a really good high-resolution picture. This is the 14th Street Bridge. The Bridge connects to the DC to Northern Virginia. One of the many bridges that connects to DC to Northern Virginia. There's a lot out there. You just have to hunt for it to find it. And in some cases, pay for it. But I would urge you to find the free stuff first. So what you want to do is make sure you're choosing the best map service for highlighting your data. Next, I want to go through projection. Projection is a really important concept in spatial programming. It's actually one that most people skip because if you're just dropping pins on a Google map you don't have to deal with it. Taking disparate data sets and disparate raster imagery and disparate vector imagery and putting it all together. Then you really have to think about projection. So I'd like to go take just a couple of minutes to tell you about what projection is and why it's important. Essentially, the earth is roundish. It's not flat, but your computer screams flat and a map made of paper is flat. So there has to be an algorithm for taking that round object and for mapping out all of the points onto a flat surface. And that's called projection. The reason it's called projection is because if you imagine a light bulb at the center of the earth, you can see on the left side there there's sort of a cutaway picture where the sphere of the earth is cut in half and it's got a piece of paper wrapped around it and then there's a light bulb at the center. If you imagine that light bulb and casting a shadow everywhere where there's land mass and then landing on the paper and then maybe it's photo paper so the paper turns light or dark and spots where that shadow landed. If you then unfurl the paper and lay it down, you've got a projection. It's a somewhat accurate representation of what's on a round surface on a flat surface. There's a lot of different ways to do projection. You can put the light bulb at the center of the earth and hold a plane of paper on one side of the earth. There's a polar projection. You can take your light bulb and put it on one side of the earth and shine it through the earth and onto a plane on the other side. You can take your piece of paper and you can wrap it around in a cone and stick it on top of the earth and put your light bulb back in the middle of the earth. Then what you've got is a conic projection. When you unfurl it, you'll have a piece of paper shaped like that one on the right. You've seen the, I guess, imagination map, or there's a map where you're looking down in the northern hemisphere that's one way to do that. And then the type that most people are going to be familiar with is the cylindrical projection where you take a piece of paper and you wrap it around in a cylinder, you put the earth inside of it, you cast your light out onto the paper that wraps the earth, and then you unfurl the paper. That's the one most of you are going to be familiar with because it is the way that Google Maps and most of the ways you come across on the web will project their data. These are two cylindrical projections and I'm going to use them to illustrate why it's really important to understand which projection you're using. If you take the satellite imagery on the left, that's from NASA World Wide Landsat imagery. It's ground covered. It's pretty cool looking. But what it doesn't have, since it's photographic, what it doesn't have is country boundary lines, as a vector file. If you want to superimpose those two on top of each other and they are not the same projection, what will happen is they won't line up and your application will look goofy. So a couple of hints when you're dealing with projections. When we get to the part where we talk about spatial databases, when you see an SRID or a system reference ID, that's roughly equivalent to a pointer to the projection type that amazing. When you're in doubt, one of those two projection types that are listed in the middle of a page, those are the two most common ones that you'll find in the playground we play in. And when you're dealing with projection codes like VPSG4326, try not to be too dyslexic like me and get your numbers in the right order because a lot of times if you get the numbers backwards it'll look right, but it'll be all wrong. Okay, the last bit of information I want to go through before we get into the spatial stack is on the talk about geometry, which is the basic spatial data type. Geometry is that stuff you remember from high school, points, lines, polygons. When you deal with spatial programming there's a reasonably finite set of geometry types. You have a point, a line, a polygon, a curve, a multi-line which is two lines stuck together, a multi-polygon which is two shapes stuck together, and a geometry collection which it is a bunch of shapes all numbered together. Does that make sense? Is it a GIS polygon? The question is, is it true that a GIS polygon is not quite what we think of as a polygon? In my experience, not really, not really true. I mean, if you look at the way that they're encoded, if you peek into a GIS database and look at what's actually stored in the columns, it's just coordinates of where the corners are. I guess when you add in the fact that you're dealing with projected data maybe it's a little different, but ultimately... Sure they can. Absolutely. Yes. So you can have a star with a hole in the middle and that would still be a polygon. That works true. Alright. I want to talk about the spatial stack real quick because we're going to get too soon is how you get started with spatial programming. And in order to do that I understand the tools that are in the spatial stack. I mean, preface all of this by saying there's lots of tools to choose from. I'm showing you the ones that I like. There are more and there are better ones and worse ones than these. So I would encourage you to explore a bit, but this is a good place to get started because this is where the most people play. If you're going to be storing data in a database you need a spatial DBMS. Those are the three frameworks. Post-GIS, Oracle Spatial, and MySQL Spatial. SQL Lite also has a spatial extension as well. If you have your choice of picking any of these I would say you should pick Post-GIS. Spatial adapter. We'll go through a little bit later and actually let me skip through and tell you what each one of these does in turn. The spatial DBMS is how you store coordinate data in your database. Instead of just ints and strings and things like that it allows you to store the geometry data type and it also provides spatial functions like distance, so you can take two columns throw them through the distance function and get miles of kilometers as your results. Again, my recommendation for your spatial DBMS is Post-GIS. Oracle Spatial is pretty common in government work so you've got to do government work and my SQL Spatial is pretty good but you should use Post-GIS. Okay, so when you install your spatial DBMS this is essentially what you get the capability to do. Now, you can't go to the console and fire up my SQL and say select star from states and get this to happen. It would be pretty cool if you did. But in principle, this is what's happened. You're storing an actual shape and a size and a position on the earth in your table right along with a string and integer data. With the polygons, it's any geometry type so you've got lines and point data which you store there too. This is actually not where I'm standing. That's where I usually stand though. Okay, next tool in the spatial stack is GRuby and this is where it starts to get interesting. GRuby is the layer where we start exposing the geometry within the Ruby language. So it is the package that gives you the line type the point type the polygon type and it gives you methods on those types to do interesting spatial things. It also comes with a handful of tools command line tools. You can convert SV shape from data to other things like KML or if you're going to go to the application or GRSS or any number of other formats. Spatial adapter is the next tool in the stack and it is important if you are storing data in a spatial database and then you want to pull it out and do something with it in GRuby. So it translates columns of geometry type into actual GRuby objects. You need to install this if you want to use active record or something like that. It grows out of your database It also supports geometry columns and migrations. It's kind of handy to show you an example of that a little bit later. And just one more note on a spatial adapter if you're going to use PostGIS or MySQL, grab a spatial adapter that's maintained by fragility if you're using Oracle Spatial GrabMyFort which is not all the way complete but it's good enough the URL where you can get it is right at the bottom. Last tool in the stack before we get on to some interesting stuff OpenLayers. It is one of many it is not the only but it is one of many JavaScript visualization libraries for spatial data. If you're building a web application and you want to drop a map on a page this is a great place to start. It supports a lot of the big name WMS services It supports your own custom imagery It supports putting KML into your application if you want to drop it into your application you can put the KML file into your web app and just pull it in with OpenLayers. Here's a couple of examples of some screenshots of OpenLayers pulling in external data This is not stuff provided by OpenLayers You can see we're pulling a Google Maps map here a Yahoo map here and layering in OpenLayers WMS a big map with another kind of set of base layers behind it there's a lot of different possibilities and one of the more important ones for me when I chose OpenLayers was this last one it's got the ability to pull in maps that are not in your normal projection your normal rectangular projection so the applications I was building were I was more interested in having a really good polar view of the map and Google Maps where I didn't really do that so OpenLayers was the solution for my particular needs which is one of the reasons that I like so much alright now before I get on to the nuts and bolts I want to show you the last piece of the stack presentation which is how it all hangs together so I used to be an enterprise architect before I was liberated and became a Ruby hacker and enterprise architects who hide in big organizations and they generally need pictures with three tiers and then be happy about anything you want to do so I've drawn the picture for you if you need to satisfy any kind of enterprise architect or even a guy like me this is how all of those components that are just described hang together it starts down at the bottom where your data sets live it's going to be post-GIS portable spatial, merciful spatial maybe it's every shape files you've got a data layer at the bottom you pull data out of your data store but the spatial adapter the spatial adapter does a little bit of magic hands it over to GeoRuby which wraps it in the Ruby data types then your application, whether it's a Rails app or a Ruby app or whatever it is it does your awesome business logic and then you hand it off to some kind of visualization library to show it on the screen so you don't need a visualization library if you do, that's where you hand it off to the visualization library and present it on screen alright, so in order to get started if you want to walk out in this room and do some spatial programming hacking today what I recommend you do is install post-GIS it's pretty easy, you do this it's a standard tar ball and you can un-tar it and they can make install a couple more commands then you've got your database you can install GeoRuby and spatial adapter again, it's pretty easy, just a couple of gems once you do that you can fire an IRB and do this kind of thing you can create points and if you look at that first line of code you'll see that I've got the system reference ID or the projection type specified when I'm creating my point and then create another point and decide what the distance between them are or have Ruby tell you what the distance is that's your hello world that's how you know you've got all the tools installed but it does a lot, we can do a lot more than just calculate the distance between a couple of points because frankly I can do math, you can do math that's not that interesting GeoRuby can do a ton of other things it can calculate a mounting box around a data set that might be interesting for moving your viewport and making it a certain size when you're drawing something on the screen it can convert your data set into KML it can be interesting if you're trying to publish your applications data in a file format that you want to pop into Google Earth it can convert data into GeoRus and of course it can place nice with spatial data there is more though so why don't we talk about answering really difficult meaningful questions once we've got our spatial dbms installed in a normal relational database it'd be pretty hard to answer this question it's located within five miles of a chemical plant let's assume for a minute that we've got a chemical plant table and a wells table and then they have a geolocation column that has a latitude and longitude in them it's as simple as writing a query like this this is the Oracle Spatial Syntax which I'm most familiar with trust me, most GIS can do it too if you wanted to build that into your Rails application or into a Ruby application so Spatial adapter gives you the rich syntax to be able to do something like this all of a sudden you've got a geometry method for creating a column it's as easy as that and trust me if you're going to do it by hand in Oracle Spatial it's not as easy as that it's a lot of work to actually do a spatial column setup you can also create spatial indexes down at the bottom which are interesting ways to create an index where you tell your database a spatial index which is how you're able to answer questions like what's within 5 miles of you you can also do something like this and create a proximity range finder you can specify conditions that you can expose up to your model that make your model smart enough to know how far you are from other projects which is again adding a rich support in for space it's a first order programming concept a little bit of JavaScript to make the view happen open layers is pretty simple this is not supposed to be instructive just kind of an example of it's pretty easy to drop a map into your application and that's the stack so if you wanted to walk out of this room today and get started spatial programming those are the tools that you could use but there's a problem I'm not that creative I think a lot of people run into this when they're building spatial applications this is about the most creative I can get can you read that so where do we gather our inspiration from we need to get past just putting dots on that so building a spatial application is about finding some interesting data using it to tell a compelling story and then being creative about the way we put it on the street we talk about that first part finding data it's all over the place you just have to look for it in my travels I have three favorites natural art is one it's my favorite place to go to get raster imagery vector imagery demographic data and other stuff data.gov is another great place to go because they have a lot of geocoding stuff and it's in a pretty consistent format easy to get and it's mostly it is all free actually the last one geoconics.com is Closure, they are a client of mine they are a place where you can get community driven data sets and maps and it's all free use free to mix up, mash up, re-use, re-distribute it's a good place to go for inspiration someone knows I'm talking right now in text all you've got is dots on a map think about how maybe the time factor can be introduced into your application use scale to make the dots more interesting maybe integrate real-time data into your application let's look at an example veteran's day as a tribute I've got a map of 2009's wreck casualties it's not it's not a really interesting story when you just put a bunch of dots on a map when you add the temporal slider it's down on the left and you give people the capability to interact with your map and put more or less dots on a map to affect the time frame where you're displaying the data from and maybe play it through as an animated movie then your story gets a little bit more interesting as we shift the temporal slider to the right to see where incidents have occurred relative size of those incidents and sort of shrink it down to a one-week window and hit the play button which will happen in a second I promise you can see it as an animation which is a lot more interesting a way to present your data but that's not the whole story so it's pretty good but it's really not the whole story if you wanted to tell a more compelling story with the map that I just showed you you could layer on more pieces of data and you should it depends on the story that you're trying to tell so go out and find it and infrastructure layer and map roads out maybe you add new stories maybe you start aggregating your data together there's a lot of ways to complete the story it depends on what you're trying to tell another way when you only have dots on a map to display to make it more interesting is to make the data you're displaying relevant because it's timely this is a map created by Kate Chapman from GeoComments what I really like about this map is the number of bikes available on a bike share location this is for DC that's where I hail from what I really like about this map is what Kate's done is taken data that is really just a dot on a map and made it really interesting to me because it's up to date by the minute she's actually pulling in a RSS feed or I'm sorry it's a restful heap guy she uses to figure out what bikes are available on my location and she shrinks or grows the dot based on how many bikes are available it's very easy to see where the availability is on this map when you're trying to burn your inspiration you need to start thinking like a geographer geographers don't think about the positions of individual things they aggregate things they look for things where they overlap and geographers really like to tell stories about people so if you can take those three pieces of information and turn your assumptions on their head you may come up with a better story to tell geographers incidentally also seem to like natural disasters so here's an example we all recognize this this is the people who are arising in the oil platforms position when this disaster occurred over the summer there were tons of maps and we saw how big is the oil slick compared to where you live application that was pretty cool it kind of brought it home to people that was not the story that this particular user wanted to tell what this particular user wanted to tell was how wave heights were affecting the ability to position oil skimmers in the ocean again we're not showing just dots on a map we're showing areas of interest you can see that the story this person is telling that the skimmers had to all be pulled back into our on this particular gate in history the waves were too high like I said geographers they love natural disasters another way you might take free information and build an interesting spatial application is to show areas where things are affected and depending on the story you're trying to tell use shading and the intersection of things to tell your story Pakistan we all remember the flooding that occurred at the end of the summer in Pakistan terrible natural disaster this is a map of Pakistan with the waterways shown there are 5 layers of information on this map most of them are aligned around provinces this one shows you where the most people were rescued you can see that the darkest section of this map is in the middle right corner country this one shows you where the most houses were damaged shows you where people were injured shows you where casualties occurred so what's the story of that map is it infrastructural was it political had something to do with physical geography I'm not sure I would guess that since the data was aligned by province it had something to do with the effectiveness of emergency services on a provincial basis in response to that disaster so if you're going to walk out of this room you're going to get started on spatial programming today these are the 4 things you need to do install your spatial dbms get georubian spatial adapter find some kind of visualization library suggest you use open layers or if you are feeling lazy go over to jay commons and try to use their web based api and then look for some inspiration and get started on spatial that's what I've covered so I think I have about maybe 5 or 10 minutes or so for questions remember if people ask questions first or first in line for the future further so I'm working on a project which helps developers pair with other developers so if you log in and say I want to pair with someone and others can see now we're trying to come up with an optimal solution how we can find out which are the pairing sessions which are close to me so we were looking at post gis but one of the one of the collaborators said it's not supported maybe we are hosting this that's a problem I think that's changed recently hasn't it the question is they are working on a site to help developers pair and pair meaning get together physically and work together or a project and they wanted to use post gis but the challenge was that post gis is not supported on Heroku does anyone know if that's still true? I don't I thought I had heard that not a review that changed I don't know for sure though who would think post gis would be overkill for that might be getting the distance between two points and finding out where two people are it's not too hard with that a gis yeah so that's a good point it's the kind of question where do you want to go with a full blown spatial solution or do you just want to do that because you know how if you have a latitude and a longitude it would be great if you have the latitude and longitude of the location of two people you can run it through a method to figure out how far apart they are when you start going further than that it gets interesting besides sharing two words large how good is most of the projects I work on until you're getting on a development box or something you're using how reasonable is the implementation of sqlite into spatial adapter supporting I think you can get by I so when I was doing really heavy gis development which admittedly was a few months ago when I was doing really heavy gis development I had post gis money I think you're right though most people do start out with sqlite that's more likely on their workstations it's enough to get started I'm thinking at least like I would tend to have like one or two people working on the gis portion and maybe somebody else is doing user interfaces or something and they don't care if it's perfect that kind of thing where I've had other projects where somebody has worked on their box and everybody else is just using sqlite that's pretty common yep what sort of distance functions are available at sqlite post gis and if you have to implement your own distance function we have to implement that the database layer and does the adapter provide any capabilities in that regard so spatial adapter does not have distance functions built in spatial adapter is only doing the conversion of the data types and if you put into your if you put into your query the distance function you'll have the dvms do it obviously I'm not actually sure about how many different ways post gis can do it I know that sdo distance in Oracle is the de facto way to do it if you wanted to implement your own distance function I think you would probably extend it in georuby and then when your objects will pull out and turn into ruby objects you could invoke you could sphere up a distance you could put in a distance or my distance and get your own are there any good tutorials online for you to start there are actually there's times so just at the ruby level I learned quite a bit from higher order which is Ender-Journes law is a really prolific runner there are other lots of other forums if you are interested in learning about open layers there's a pretty active community the documentation isn't too great post gis documentation is fantastic right here so I don't have metrics for you anecdotally I would say I do have an database it's going to be faster it's compiled or two aren't you sure? a couple of years ago I was trying to do some stuff with mysql for polygon intersections things and I read that the implementation of mysql turns all your polygons into bound rectangles it was awesome there was a project that changed that do you know if that ever took hold? I don't think so the question is can multiple projections play nicely with each other inside the dbms the answer is not in the same column when you declare your column you are specifying what the projection the column data is if you want to have things in two different projections put them in two different columns and yeah, they'll play nicely that's another great question the question is a follow up on projections are different projections good for different things you can choose one and over the other so the answer is yes different projections are good when you take a cylindrical projection like a computer projection and you flatten it out that is a really good map for preserving the direction between things north, south, east and west that's why most nautical maps have some kind of variation in this projection it is not a really good way to preserve the sizes of things so if you notice everybody's seen on the Mercator projection map or on the Google maps Greenland looks bigger than Africa now, I'm not sure if you guys know this but Africa is way bigger than Greenland it's because but the direction that you have to travel between Greenland and Africa is accurate on the Mercator projection map if your application has more to do with the relative sizes of things you're going to want a different projection a different way of unfurling depending on exactly what you're trying to preserve you may want some kind of conic or you may want some kind of planar projection so yeah you pick your projection based on the problem you're trying to solve and what you want to remain accurate what about altitude? how does that play in with the clouds the question is how does altitude play in and the answer is that in a spatial system altitude can be another coordinate if you want it to be most GIS systems and certainly GRUB have this concept of with a Z and with a measure so if your coordinates have a Z measurement then you've got a three-dimensional point if you've got a measure measure attribute then that could be something like altitude or the mile marker along the road or some other some other spatial attribute that's not necessarily related directly to the 3D coordinate does that make sense? like a pipeline yeah exactly like a pipeline all the way to the back the question is how does geolocation by IP address fit into this the answer is I'm not really sure I don't know can you create your own coordinate systems and projections yeah it's going to be tough to share data with people and you've got a real lot of implementation ahead of you so there is a library called the GDAL library it's used for translating between your projection and my projection whenever you're working with it's used underneath the covers by a lot of spatial systems spatial TVMSs use it and there's a lot of command line tools you can use to forward data from one projection to another you can define your own stuff in there but you're going to have a lot of implementation ahead of you to do it most of those problems have been solved already unless you discover something new like hey everybody thought the earth was shaped this way and I actually determined through a beautiful observation that it's got a dent in it over here you may not want to go through the trouble yeah is that the question is can you use only for earth or other planets so that's a good question the question is can post-GIS be used for other stuff other than the earth other planets or other shapes yes a geometry is just a geometry it does not have to be a location on the moon if you wanted to represent the shape of this room and store it in a database you could absolutely do it with lines polygons whatever you want if you wanted to pull that into georuby space you could do it you could absolutely do it geometry has a function up top so if you had shapes inside this shape that is not so if you were trying to capture in your database the shape of an amoeba as it moves around that's a good hard question I think you would have to define some kind of resolution and take snapshots I'm not sure that thinking in that fourth dimension just yet yep would you calculate the distance between two points is that with a normal geometry like would you calculate the distance through the earth or would it first project it and then point the distance there are a couple ways to do it so georuby I think on the georuby slide there were two different ways shown the spherical distance and then the Euclidian through the earth distance you can use either you can define your own so one of those ways uses your projection in the other way or the various things can you imagine the georejection doesn't preserve area can you imagine that it's group of distances yeah it does so that's true and I think the answer is is that yeah I'm not really sure how to answer that question I think it's a bad question no it's not a bad question the projection is just how the data is and like when it's doing the calculation when the rates are old and putting it on this like post-ES has like a perfect sphere and it has like a a spherical shape like here so yeah and if you look at the Cartesian projection when you're actually plotting the map right the points are at the top of that at the middle of the map are spaced so you just want to plot them what else guys if I have data such as GPS route for example for example my running route and I want to store it in my web on early benefits in storing that data as compared to just storing some XML file for example just referring to if you want to query against it so if you want to say so it depends on what you want to do with it if you want to query against it at the database level and say you know find all the intersect points of all of my runs over the course of a week where they all intersect one of the places I run past the most then you'd want to store them in your database if you're just you just want to display them on screen stick them in a file what else guys back on the arm so you're talking about geocoding there's some geocoding web services out there and then if you have the Oracle tool set there's a geocoding command line program and there's tons available if you Google for it you'll find a bunch some of it you have to pay for some of it's free there's also a layer of Ruby binary there's like a free version which is a bit older and there's one more fee or breadth version I got time for one more right here what do you think it says yeah Mongo a bunch of them have it I don't play too much in the NoSQL world so it's funny to ask around a little bit alright guys I want you guys to rig my talk if you would please and you're also allowed to steal it and remix it