>> Hey friends, you may be familiar with
websites that can show you a map with
houses for sale within
a given area and you wondered, "How do they do that?"
Well, Azure Maps enables you
to find the latitude and longitude,
the geocode for thousands of addresses in
one call and search locations within
the boundaries of a specific geographical area,
like a city or a postal code.
Julie is here to show us how
that works today on Azure Friday.
Hey folks, I'm Scott Hanselman and it's
another episode of Azure Friday.
I'm here with Julie Kohler who's going to
talk to me about Azure Maps.
We've got a couple of things today.
We got batch geocoding and
some cool polygon stuff with administrative areas.
Let's talk about batch geocoding first.
>> Yeah. So, batch geocoding really lets you pass up
to 10,000 different geocoding calls in a single call.
>> Seriously?
>> Yes.
>> That's quite a batch.
>> Yeah. It's quite a large batch.
Depending on how many pass it will
take a different amount of time,
but we do support up to 10,000 because it's not extremely
slow to pass that many geocoding calls.
So, what you can do is if you say have
tons of addresses that you want to
get the latitudes and longitudes for,
you can pass those in a single batch call.
We will charge by transaction,
so if there were a 1,000, there would be
the cost of a 1,000 transactions.
But that runs in the background,
and so you can wait for that to complete.
You can make other calls,
do other API calls that you need to do,
or go about your business.
Then, you check on that later and you'll have all of
those thousand calls come back
to you with that information all at one time.
>> Geocoding is something that is reversible?
>> Yes. So, we have geocoding
and we have reverse geocoding,
and we batch both of those.
>> So, which one is which?
>> So, geocoding is when you pass an address.
>> Okay.
>> And you get back the latitude, longitude.
The reverse is passing latitude and longitude and getting
back the address information or the location information.
>> I see. So, I can see where I'm going to go in
populated map like we say with houses for sale,
I pass you a bunch of addresses
and I need the latitude and longitude to put pins down.
>> Exactly.
>> Or graphics with
little houses and money on top, right?
Then, the address one is like
I'm driving and I'm passing latitude and longitude.
My GPS is telling me where I'm at,
you tell me the address of the house I'm looking at.
>> Yes.
>> Or the house or houses,
is there a fuzziness to reverse geocoding?
>> Yeah. You can get back more than that.
You can even get back street addresses like
cross streets and things like that in reverse geocoding.
>> Can you think of a reason I would want to
send 10,000 or something in?
>> Yeah, for the example that you said.
Maybe you want to map a bunch of houses
on a map and you know they're for sale,
and you want to show pins where they are.
You send us a 1,000, we'll give you a 1,000 results back.
Or even something like I want to show all of
my stores in the State of Washington on a map.
>> Oh, that's a good point.
>> You pass us their location or
their addresses and we will put
the pin or you can put
the pin for the location on the map.
>> There's two things that are
interesting that you said that I think
maybe the audience doesn't realize how useful it is,
is you can do these calls and keep doing other calls.
So, basically, Azure Maps scales for you.
>> Yes.
>> You're being paid per transaction,
but you're not thinking about
the fact that you gave it a huge job.
It just handles that huge job.
>> Yeah.
>> There's no slider bar
for how big of an Azure Maps thing that you want, right?
>> You're not blocked from doing anything else.
You don't need to worry about scaling.
You don't need to worry about how much time it's
going to take before you can do the next thing.
So, we handle that all for you.
>> That's super cool. Then, the second thing
is when you make these long acting calls,
you don't block at the HTTP level.
You don't make my app wait.
You say, "Come back later."
>> Yeah. You get a 202 back and you
can just come back and get the results when you're ready.
>> That's so cool. You got a demo for me?
>> I do. So, let me show you a batch geocode first.
>> Okay.
>> So, all I've passed here is
my subscription key and in the Body,
I've passed a number of queries.
In this case, I've done five different queries that
I want to know the location for.
So, I've done some things in Seattle,
I've had one in New York.
It can be anywhere really
that you're searching for in this batch.
It does not have to be even a single geographic location.
>> Before you start, you've got a couple of parameters I
don't recognize like the limit equals three is one.
I think I understand why
radius would be there, but what are the limits for?
>> Limit says I only want three results back.
So, you can get points of interest
back and things like that along with your result.
If you want to limit it and say I
don't want a ton of information about this,
I just want the latitude,
longitude and give me maybe three possible results,
that's what that means.
>> I see. Okay, cool.
So, can we run that one?
>> Yeah, let's run this.
>> So, here is
five different ones and that comes back pretty fast.
Is this one going to return a 202 as well?
>> This will. This one might take a little bit longer,
so I'm going to show you the reverse one as well.
Very similar, but again,
I just have my subscription key
here and in the Body, I've got my queries.
These are simply latitudes, longitudes.
This one has given a radius as well and
a limit because that's possibilities as well.
So, we'll also do this call
and I'm going to go back to the
original one in the batch geocode.
I'm going to take this location that it
passed me back, very simple.
After I got my 202,
I can now make this call.
Simply post or paste this into the GET,
and I've got my results back.
It was that quick. So, here's my results back.
I've got the address.
>> I noticed at the top it
said number of requests
and number of successful requests.
>> Yeah.
>> So, why would a request not be successful?
Because of a vague address?
>> It could be something like that.
It could be a bad value that was passed in or maybe,
we weren't able to find the
thing that you were looking for.
>> Invalid latitude and longitude, out of range.
>> Any potential errors and that'll
let you know what the errors were.
>> Okay. So, that one came
back and it gave you all the stuff you wanted.
You pointed out you can pass
in additional things like
points of interest or anything that you want.
>> Yeah.
>> All the different things that Azure Map supports,
can be batched up like this.
>> Yeah, anything that we support in
a typical geocode call.
You can do in this batch as well.
>> Very cool.
>> We can check on the results of
the reverse geocode as well.
>> You know that there's probably people who have built
solutions on Azure Maps
that are watching this and going, "Oh,
I'm going to go back right now and I'm going to refactor
my code because some poor person out
there has a four loop that they're doing and 10,000 or
something and now they're going to be thrilled to be able
to refactor by subtraction."
>> This will greatly simplify things.
>> Simplify things and make their life a lot better.
>> This one got results back as well.
Also, five requests.
Then, I get my search results back.
>> Interesting. That one shows query time as well too.
>> Yeah.
>> This works anywhere.
I see you have France and Redmond,
so this is a global thing.
It's an important thing to remember.
>> Global service, yes.
So, that's what I wanted to talk about for batch.
The second topic for today is
talking about being able to get,
we are calling an administrative area back.
>> Administrative area.
>> Yes.
>> Is this very official?
>> It's an official mapping term.
What it really means is
a geographical boundary that's defined by man.
So, when you say something like
King County or the City of Seattle,
it's a boundary that we've defined administratively.
So, we recognize that these are the boundaries on a map,
but really, they're not things
that exist in the physical world.
>> Okay. But those are administrative things like
a county or a state that everyone pretty much agrees on.
But my cousin sells pet food and he has
his sales region that only his company cares about.
Can he make an administrative region?
>> If it was created inside of our services,
maybe, but we don't support that today.
>> Okay. So, that's possibly something for the future.
>> Something for the future that we could consider.
>> So, this would be known public administrative areas.
>> Yes.
>> So, counties, and states,
and zip codes, and things like that.
>> Yes.
>> Cool.
>> So, I'll show you how to do this.
I'll first show you on Postman and then I
have a visible demo as well.
>> Okay.
>> So, the first thing you want to do is you want to make
a search call to get that geometry back.
>> Okay.
>> So, what I've done here is I've done
a query for Bellevue, Washington.
I'm going to send that query
and then when I get back in the results,
you're going to see something.
Scroll down here.
>> Is there a thing that you can click up
here at the top which is authorization
that would make this have more room?
>> Possibly.
>> I think there's a slider?
I'm just wondering if headers might make that less tall.
>> I found what I was looking for.
>> Okay. So, that's the idea of the geometry?
>> Yeah. So, we have this object data sources geometry,
and then within there is the ID.
So, this is the ID of
the geometry that we're giving you
back for your search results,
so for Bellevue, Washington.
So, I'm going to take this ID and I'm going to copy this.
Then, we have an additional method
that you call click "Get Polygon."
Here, I'm going to paste the ID
of the geometry that I want back.
>> It says geometries so you could have comma.
>> You could do multiples here.
>> Okay, cool.
>> Then, I'm going to send that in.
Now, I've gotten my results back.
So, this actually will give
me the coordinates and points that
define that entire geometry for Bellevue, Washington.
>> I see, and then that would be easy for me to
then draw the polygon on top of
a map control and visualize
that geometry within my business application.
>> Exactly. I will show you
an example of doing exactly that.
>> Oh, I see. Now, it's just showing off. That's cool.
>> So, what we have here,
I did exactly what you said.
So, behind the scenes,
when you type in what you're searching for here,
and for an example, let's just do Seattle.
So, behind the scenes, I do a search call,
then I get that geometry ID back,
and then I draw it on the map
based on what it returns to me.
>> Very cool. Can you do zip codes?
>> Yes, I can do zip codes as well.
>> Where are we? 98052?
>> We are, 98052.
I'm going to give it
a little bit of additional information,
so it understands where I'm
looking and we've got a zip code as well.
>> That's a complicated polygon.
There's a lot going on there.
Administrative areas are non-trivial.
They're not usually squares.
>> It is. If you notice, this was up pretty fast.
>> It was effectively instantaneous.
>> Yeah. So, we did the search, we got the area,
we called for the additional data,
and got that geometry ID.
>> You're right. There were multiple calls
there and it still was instantaneous.
>> Multiple calls and you can draw it very fast.
I can also do things like let's look for Detroit.
Then, we support other countries
as well, so let's do Windsor.
This is interesting because a lot of people don't
realize Canada is actually South of Detroit, yeah.
>> Canada is South of Detroit?
>> In this part, it is.
>> Wow. Oh, I've actually been
there and looked across
the river and said, "That's Canada over there."
>> That's right.
>> That's awesome.
>> So, if you notice, this is a pretty complex polygon.
There's parts that dipped down in a complex shape,
but we got all that back very
quickly and we're able to draw that on the map.
>> Yeah. It was basically in the time it took you
to push the button on the up of the button.
Two calls to pin the polygon.
>> We even zoomed in the map to the exact location.
>> Right. That speaks to what
we said before when we were talking about
batch geocoding is Azure Maps are scaling for you.
So, as a business user,
you simply stop thinking about scale in this context and
you really think about the mapping
that you want to do, which is really cool.
>> Yeah, and anybody could build this demo today.
We simply used our map control
and the APIs that I just demoed,
and we were able to put this together pretty quickly.
>> It's probably [inaudible]
>> Yeah, it's really not that much.
>> So, where can people go and learn more about this?
>> Yeah. So, please go to our documentation.
Say we have documentation about all of our REST APIs.
We have additional articles,
but you can go here at docs.microsoft.com
and learn about Azure Maps.
>> Very cool. I'm learning all about batch geocoding
and polygons for admin areas here on Azure Friday.