We're sorry but this page doesn't work properly without JavaScript enabled. Please enable it to continue.
Feedback

Cooking with PostGIS

00:00

Formal Metadata

Title
Cooking with PostGIS
Title of Series
Number of Parts
295
Author
Contributors
License
CC Attribution 3.0 Germany:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal purpose as long as the work is attributed to the author in the manner specified by the author or licensor.
Identifiers
Publisher
Release Date
Language

Content Metadata

Subject Area
Genre
Abstract
The ingredients are existing data that may or may not have a spatial component, your understanding of said data at your disposal and finally PostGIS and the bevvy of functions that it ships with. No need to venture into the kitchen or even ignite your stove; 'Cooking' here refers to the practice of using select bits of data from an experiment to get results that you should be getting, even if your experiment is going awry. There are times when you need spatial data for a given purpose, but sending a team out into the field is not practical given existing constraints. In cases where accuracy need not be sub decameter then there are ways and means to generate spatial data for visualization purposes that can be just good enough. PostGIS has a plethora of functions to help you get to that point of having spatial data that is just good enough, especially for visualization. In this talk, I will show how, for real instances, PostGIS was used to generate the data needed and how in some cases, the data was spatially accurate to within 10 meters.
Keywords
129
131
137
139
Thumbnail
28:17
Electronic mailing listGoodness of fitTwitterLecture/Conference
Connected spaceMathematical analysisAreaRight angleUtility softwareQuery languageComputer animationDiagram
Wrapper (data mining)Level (video gaming)Endliche ModelltheorieSocial classPhysicalismBitComputer animation
Right angleUtility softwareWell-formed formulaVideo gamePoint (geometry)Real numberNumberDrop (liquid)Form (programming)Proper mapQuicksort
Power (physics)Data transmissionUniform resource locatorNumberProduct (business)Right anglePower (physics)Coordinate systemInsertion lossMetreLevel (video gaming)Exception handlingArithmetic meanGreen's functionCuboidInformationCore dumpSound effectMachine visionAssociative propertyLocal ringRow (database)WeightComputer animation
Frequency
Student's t-testComputer worm40 (number)Computer animation
MappingArithmetic meanResultantTable (information)Lecture/ConferenceComputer animation
MetreTable (information)Uniform resource locatorNumberUniqueness quantificationInformationAddress spaceReading (process)
TimestampNumberInformationUniform resource locatorTable (information)Address spaceMetreReading (process)GeometryRow (database)Uniqueness quantificationAreaRight angleNeighbourhood (graph theory)Block (periodic table)RootBitComputer animation
Dot productRoutingRootLecture/Conference
Network topologyMultiplication signMetreGeometryRight angleSource code
CuboidField (computer science)RootPoint (geometry)Right anglePlanningRoutingMereologyMultiplication signLevel (video gaming)Uniform resource locatorCovering spaceZoom lensMaxima and minimaTimestampAreaMetreLecture/Conference
Uniform resource locatorMultiplication signInternetworking
String (computer science)Point (geometry)Line (geometry)Lecture/Conference
Wave packetElectronic mailing listRoutingPoint (geometry)RootQuery languageRight angleMultiplication signGeometrySource code
String (computer science)Query languagePoint (geometry)Multiplication signSingle-precision floating-point formatDigitizingAreaRoutingRight angleLine (geometry)Greatest elementGoodness of fitComputer animation
Line (geometry)Point (geometry)Multiplication signDevice driverMetreTotal S.A.LengthString (computer science)CASE <Informatik>Right angleImpulse responseSurjective functionAreaRootTexture mappingDot productDerivation (linguistics)InterpolationBitLinearizationQuery languageSource code
Level (video gaming)Point (geometry)CASE <Informatik>NumberRight angleInsertion lossLecture/Conference
Insertion loss
Presentation of a groupData miningMultiplication signAddress spaceBitOpen setAreaLevel (video gaming)NumberLocal ringControl flowAutomatic differentiationWebsiteEntire functionSquare numberNetwork topologyLecture/Conference
Multiplication signControl flowPresentation of a groupComputer animationLecture/Conference
Lecture/Conference
Transcript: English(auto-generated)
Good morning, everyone. How are you all doing? Great, all right cool. I'm Reese. This is cooking with post jus
Yeah So I am an infrequent tweeter and an even more infrequent co-contributor, but I am on GitHub and Twitter as Reese Alistair I along with two other folks are the Entirety of a small company called Octinome and we specialize in data connection and analysis especially for
utilities alright, so Cooking what do I mean when I say cooking?
Can I Do this is this I think can I select and I have my stove magically concoct some nice nice dishes You know I'm not speaking about that by the way who can identify what is wrong with this query anyone
No, is it either correct? I'm disappointed. It's missing That It's a subquery so you have to have a in the back, but yeah still I'm not speaking about cooking like this Although it would be very cool. If there was kind of a
culinary FDW No I May be appearing in our that's probably food How many of you did chemistry or physics at high school level show of hands Yeah, all right cool
How many of you had to do? Laboratory laboratory works or experiments to reinforce the models you learned in the class Okay, and how many of those experiments always worked? All Right so when I say cooking I'm really speaking about Fudging the numbers so if you have like a titration you're doing for example and
You're doing the little drops from the pipettes And it's not really working out how it should be working out at some point We start counting three drops as one four drops as one just to make sure that your your formula works out properly So that's what cooking really is, but then you wouldn't cook in real life
Would you like if you're a company? What would be the purpose of putting the numbers? Let's find out believe a very short story for utility company in Jamaica Electricity theft was a big deal and
First of all how many people they can steal lights or steal the power no one Yeah And so how do you quantify the theft of electricity? Well you know much poorer generating at the power plant and
You know how many meters you have or you know customer meters and customer locations so basically you add up the number of the consumption data You compare it to the production data, and it should be approximately equal right no more than say 2%
In Jamaica we were finding that we were losing about a quarter of the poll was being stolen So that was money down the drain or I guess a while So How do you come at this? One of the things we well we need to speak at a national level right to know that at the national level there were
That large amount of theft, but to come at it. We needed more localized information No luckily Luckily The power doesn't go directly from the power plant to your house. There is some infrastructure in between and
This green box right here is called a substation and each customer is connected to one substation So that was a way to localize the loss we can now calculate the losses at the substation level So it does the art for each of for each substation. We're delivering x amount of power
And we can now calculate for all the customers on that substation the poor consumed and Get the figure except that we had no idea where the customers were located Meaning we had no coordinates. No nothing at all. We neither were there. They were being built. They were collecting they were
Paying you know what some of them were paying money somewhere stealing So what you do when you don't know where people are you go and map them So in a two-month period Was a decade ago We mapped approximately a half a million customers and
All was well with the world Or so we thought because the reality was you can't map a half a million customers in two months using students Especially in the Caribbean when in in the middle of hurricane season So we were left with a problem because we only mapped about 400,000 of the half a million customers so we had a shortfall of a little over a hundred and forty thousand and
The funding for mapping was out. So we have to try other means Hence we tried to cook so we have the ingredients so We try some tables. I'll show you shortly and I'll get the whole cooking thing now. So
we have customers and We have people that go to every customer and read the meter Every month, so I'm going to show you three tables that we're using to the cooking today it's info location and MRI data the location table basically contains each customer's premises number that's a unique ID and
a location or coordinate The info table contains the same unique ID and then name address And some other information and in my data consists of the data that the meter reader
Collected you know what the meter reader is by the way Someone that actually goes and physically reads your your poem meter So you like walk from place to place go to one house another house and read each meter I'm going to show you what those tables look like. This is the location table So that first column with premises is the unique ID G is the geometry column
You notice that the second record the G is null. So this is a customer for which you have no location The MRI data table contains The time stamp of when the meter was read the actual meter reading and the premises number for our purposes
We're interested in the premises number, which again is unique ID and the time stamp and The last table is the info table, which I don't think I use quite a bit but this one contains address information and the premises number It's important to note that the meters are right in what are called roots. So
each meter reader would Have about 250 to 300 different houses to go to through their meters They were usually in a very small area like a small neighborhood like three or four or five streets what you might call a block So these areas were very localized, so this is what the customer
Do where did that picture go there should be a picture of the customer base right here. All right, so
There are no pictures. All right, I'm going to ask you to imagine Jamaica with dots on it So Our first step is to basically get an idea for each route
how many customers there are and How many customers have no geometry and also at the same time? We're gonna basically see on this day the meter reader started That's right this works I can highlight it. All right, so for each room right here
At the route ID there were 260 customers with a location and 304 customers
Overall in that route that's about 86 percent coverage Let me scroll to my right and then min and max are when he started the route the route that day and when he finished We're gonna zoom in on a particular route
By the way, this SQL making sense to you people. Can you all see it? No, that sucks They should be another picture what I oh Here it is so this is the base map I was telling you earlier with the points that we knew about and
Okay, so this is These are the boning boxes of the roots clearly some boxes are very very big because there is us very poor data in there to begin with and We would ignore all these boxes for these roots For the smaller boxes are the roots we be concentrating on because that those roots are in a very small area and we can get good
data from that Alright, so what would the actual plan so we know the meter reader guy or girl walks a Certain path right he goes to every house and collects data with a timestamp. So the thinking was alright cool. He does that
He's also collecting data at Hoses for which you don't know the location and a small side note. It's like a decade ago before like They were ubiquitous GPS. So he didn't he could have at a time gone and collected our location, but the Devices he used didn't do that. So he just got the timestamp alone. So we're thinking alright, he goes around he walks each house
Walk to each house and rather data what if we were to build a Line string using the other points to get a routing of where he went We could have that so
And you can't have a stop, right? So this this query basically ordering all the points in a given route by time And you can see here That there is a blank a blank geometry right here a couple of them in the actual lists, but this route had about 15 I think empty
We're gonna build a line string By doing this, so this is Another query where I am selecting all the points I'm ordering at my time in the sub query and I'm dumping that into ST make line which accepts
Well, one of the incarnations is accepts ordered points to build a line string So when you did that, you'll have gotten this Lovely little Picture right here. So you can set the bottom right hand corner where it does one two and next single digits That's where he started and then he basically went along that area to the top at 184
We have our ordered line string, which is good what the next step and this is The fun bits as far as I'm concerned. All right, they're gonna use linear referencing so
Get the unknown points so using st line interpolate point we can How many of you have or how many of you have used any kind of linear referencing in post this before? One two few, okay So we're basically saying Given this line string of some length. We know what time here at the meter
We know the total length of time taken for the entire roots. We can get a percentage of The actual time and using that percentage derive a point based on where he would have been and But we did that using this query here, this is what the data looks like textually
Which is kind of useless, but then the beauty of it is all these red dots that you're seeing here were the interpolated points and That's what we derived from the line string In some areas of to make likes especially smaller roots you would find that when you actually went back a couple years later to actually
map with GPS The derived points were like right here and the GPS point was like right here. They were the very very accurate in some cases Not all so we actually did that got our Number of customers from the four hundred ten thousand to about five hundred and like
fifteen or five hundred thirty and We solved the problem because Yeah, we saw the problem of not having a customers to know generate the local losses for the company So that is how you get to the British after you've cooked with post this
any questions Well what happened to the customers that was found stealing electricity
If you're a phone stealing electricity depending on who you are and where you live Usually give you a chance we will what's called a back bill you Legally, we can only go back six months
So we will ascertain what you're using now, and then just times it by six and you pay out over time That's what happens to those people Mm-hmm some more questions. I have one question
Just to get to know is open street map data for you. Well you or how is it one more time? You know about open street map data. Can you make use of open street map data? Yeah, we do art the first of all this entire thing was a decade ago It's not anything new. I mean I know we're we have GPS is everything so we can go a map map stuff
We do use home street map data quite a bit at work and When I was giving it when I was preparing this talk a friend of mine said but why didn't you use geocoding for to find addresses to find like customers and The address data in Jamaica is not very good outside of the city, so you'll find like an entire
10 square mile area and everybody's address is literally st. Ants Bay st. Anne and that's it no street no tree number so more questions
Okay, looks like there are no more questions, so thanks Reese for the Presentation and hope you enjoyed the posk is session here and draw the conference everyone and now yes time
It's time for a break