MapQuest Developer Blog

Archives for Antony Pegg

  • Javascript and ActionScript SDKs updated in Beta

    .picture { background-color: #F9F9F9; border: 1px solid #CCCCCC; padding: 3px; font: 11px/1.4em Arial, sans-serif; } .picture img { border: 1px solid #CCCCCC; vertical-align:middle; margin-bottom: 3px; } .right { margin: 0.5em 0pt 0.5em 0.8em; float:right; } .left { margin: 0.5em 0.8em 0.5em 0; float:left; }

    I'm going to try to keep this post short and sweet, since the platform teams are starting to deliver features faster than I can find time to write about them.

    Before the New Year We updated both the ActionScript and Javascript SDKs in Beta

    First - the AS3 / Flex SDK:

    FlashBuilder 4 Support
    We've made the necessary changes so that the SDK works with both FlexBuilder 3 and FlashBuilder 4. The SDK should also work with both Flash Player 9 and Flash Player 10. Please let us know on the forums if anything does not work in any of those scenarios.
    All SWCs have been compiled into one file, MapQuestAPI.swc
    We've consolidated all the different .swc files into one single .swc. Our developers sat me down and explained how I was being an idiot asking for separate .swcs, how it didnt save anything for the final application compile size, that everything will still work everywhere, and that all I was doing was making our users' lives painful instead of helping them. Mea Culpa!
    Object Model overhaul to remove unecessary getter/Setter functions
    Most explicit object.setProperty(value) functions have been removed from the SDK, in favor of a more AS3-friendly object.property = value. Returning these values using object.getProperty() has also been changed to object.property. This is a BIG CHANGE! Be prepared for application code refactoring.
    Shapes and ShapeCollection Overhaul
    The code has been overhauled to be simpler, and use a new internal drawing engine. by doing this we have now been able to add a couple of other new cool features...
    Overlay cutout functionality added.
    You can now add child overlays to a main overlay, and these child overlays will act as clipping masks to punch holes in your polygons, rectangles, ellipses, and circles. So now you can do donut polygons! yay!
    Overlay Cutouts
    You can use any shape overlay to cut holes.
    geodesic Lineoverlays
    LineOverlay now has a geodesic option that when set will render a curved line that follows the shape of the earth.
    User Guide overhaul
    All the user guide documentation has been consolidated into a single user guide that follows our new format - we will be continuing to flesh this out over subsequent betas.

    And now the Javascript SDK:

    Overview map control bug fixes
    Several bug fixes along with removing the dependency on vector shapes for the area highlight - so you no longer need to have the overlays module loaded to use the control.
    Added a Carousel Control
    Modeled after our mapquest.com Biz Locator control, this lets you easily add shapecollections to a control on the map that your users can use to toggle the collections on and off.
    Documentation Upgrade
    Added Shape Collections documentation including Basics of Shape Collections, Remote Collections: GeoRSS, KML, and added more materials to the API Reference.

    As always more to follow soon - in this case VERY soon, as I committed the cardinal sin of taking vacation, and returned to find a huge pile of updates on my desk that the teams did while I was gone!

  • Address Point Data now in the Beta Geocoding Service

    .picture { background-color: #F9F9F9; border: 1px solid #CCCCCC; padding: 3px; font: 11px/1.4em Arial, sans-serif; } .picture img { border: 1px solid #CCCCCC; vertical-align:middle; margin-bottom: 3px; } .right { margin: 0.5em 0pt 0.5em 0.8em; float:right; } .left { margin: 0.5em 0.8em 0.5em 0; float:left; }

    Last week we added new data to the geocoding service that resolves addresses down to their exact location

    This means that we are now able to return two latitude / longitude pairs per address - one that represents the middle of the address land parcel (for Display), and one for where the address connects to the road network.

    Fortunately, this is one of those features where a picture is worth a thousand words, so I will stop trying to explain it and just show some differences

    Red star is old known location, blue and green stars are the new known location
    Address Point Geocoding difference
    The red star shows where a regular geocoding data set would place the address
    The blue star shows where we now tell you the center of the address parcel
    The green star shows where we know the address connects to the road network

    In the screenshot above, the red star represents where a regular interpolated geocode would place the address on the road. Regular geocoding data does not actually contain every single address on a road. instead, it normally contains the length of the road, and the range of house numbers along the length or the road (e.g: 1-99 Main Street). So if you looked for 50 Main Street, math would be used to work out the approximate location of where #50 probably is between #1 and #99

    However, with the new Address Point data, we know the actual physical location of each particular house. So, in the screenshot above, the blue star shows us the center of the physical land parcel - as you can see, its a LOT more accurate!. Then the green star shows where the actual address connects to the road network, so we can really deliver you right to the doorstep of the location you are trying to get to.

    Here is where we need your help, faithful reader. Adding Address Point Data represents a massive increase in the size of the data we are using in our geocoding service, and we are load-testing before we roll out to full production. Please take the time to hit our Beta geocoding service at http://platform.beta.mapquest.com/geocoding as much as possible.

    when using the service the response will inform you if it has resolved to a Point in two different ways.
    Firstly, the GeocodeQuality node contains a pure text description like this (JSON): geocodeQuality: "Point"
    Secondly, the GeocodeQualityCode will start with a "P1" for the granularity value - like this: geocodeQualityCode: "L1AAA"

    For a full understanding of the geocodequalitycode value and what the different response values mean, the GeocodeQualityCode page in the documentation breaks it all down

    Lets finish this post with some more screenshots that show the accuracy difference of address point versus interpolated geocoding

  • Static Map Service launched

    I'll start by saying a belated Happy Thanksgiving to everyone. We hope you all had a great Turkey-Day.

    Last week we released the Static Map Service live into Production at http://www.mapquestapi.com/staticmap. We've been blogging about the features of it as they've rolled out into Beta, but the Production Launch seems like a good time to give a nice summary of them all.

    Get A Map
    Embed a printer-friendly MapQuest Map image on your web page without requiring any code, by accepting querystring parameters on the image URL.Basic parameters are center point, zoom level, height, width, and whether or not you want any POI icons on it
    Put a route highlight on your static map by passing in a sessionID from the Directions Service, or by providing the line co-ordinates
    http://www.mapquestapi.com/staticmap/v3/getmap?key=YOUR_KEY_HERE&center=40.044600,-76.413100&zoom=7&size=400,200&pois=1,40.098579,-76.398703
    A basic map, with a POI on it
    http://www.mapquestapi.com/staticmap/v3/getmap?key=YOUR_KEY_HERE&center=40.044600,-76.413100&zoom=7&size=400,200&pois=1,40.098579,-76.398703
    Auto Best Fit
    If you provide POIs without providing a zoom level and a map center, we will return a map that fits all your POIs on it, as zoomed in as possible
    http://www.mapquestapi.com/staticmap/v3/getmap?key=YOUR_KEY_HERE&size=400,200&pois=1,40.098579,-76.398703|orange-100,40.069116,-76.401178|green,40.098088,-76.346092|yellow-s,40.069607,-76.352282
    A best-fitted map
    http://www.mapquestapi.com/staticmap/v3/getmap?key=YOUR_KEY_HERE&size=400,200&pois=1,40.098579,-76.398703|orange-100,40.069116,-76.401178|green,40.098088,-76.346092|yellow-s,40.069607,-76.352282
    Map Styles
    get Street, Aerial, and hybrid maps. Also get street maps in a variety of other styles including black & white or european or classic MapQuest - Check the documentation for the full list.
    http://www.mapquestapi.com/staticmap/v3/getmap?key=YOUR_KEY_HERE&center=40.044600,-76.413100&zoom=7&size=400,200&type=hyb
    A hybrid map
    http://www.mapquestapi.com/staticmap/v3/getmap?key=YOUR_KEY_HERE&center=40.044600,-76.413100&zoom=7&size=400,200&type=hyb
    http://www.mapquestapi.com/staticmap/v3/getmap?key=Dmjtd|lu612007nq%2C20%3Do5-50zah&center=40.044600,-76.413100&zoom=7&size=400,200&style=european
    European style map
    http://www.mapquestapi.com/staticmap/v3/getmap?key=Dmjtd|lu612007nq%2C20%3Do5-50zah&center=40.044600,-76.413100&zoom=7&size=400,200&style=european
    Draw lines on the map
    pass in raw or compressed shapepoints to draw polylines on the map.
    http://www.mapquestapi.com/staticmap/v3/getmap?key=YOUR_KEY_HERE&size=400,200&center=40.0378,-76.305801&shapeformat=cmp&shape=uajsFvh}qMlJsK??zKfQ??tk@urAbaEyiC??y]{|AaPsoDa~@wjEhUwaDaM{y@??t~@yY??DX&zoom=7
    Map with a line drawing on it, using compressed format
    http://www.mapquestapi.com/staticmap/v3/getmap?key=YOUR_KEY_HERE&size=400,200&center=40.0378,-76.305801&shapeformat=cmp&shape=uajsFvh}qMlJsK??zKfQ??tk@urAbaEyiC??y]{|AaPsoDa~@wjEhUwaDaM{y@??t~@yY??DX&zoom=7
    Declutter
    Either set declutter=true for an automatic decluttering of overlapping POIs, or manually specify an X/Y pixel offset for each icon
    http://www.mapquestapi.com/staticmap/v3/getmap?key=YOUR_KEY_HERE&center=40.044600,-76.413100&zoom=3&size=400,200&pois=1,40.098579,-76.398703|orange-100,40.069116,-76.401178|green,40.098088,-76.346092|yellow-s,40.069607,-76.352282&declutter=true
    An auto-decluttered map
    http://www.mapquestapi.com/staticmap/v3/getmap?key=YOUR_KEY_HERE&center=40.044600,-76.413100&zoom=3&size=400,200&pois=1,40.098579,-76.398703|orange-100,40.069116,-76.401178|green,40.098088,-76.346092|yellow-s,40.069607,-76.352282&declutter=true
    getPlacemap single-line address function
    the very convenient /getPlaceMap?location= function takes a single line address and optionally a single icon, to provide a short-cut method of getting a static map for a location without needing to have the geocoded lat/lngs first.
    http://www.mapquestapi.com/staticmap/v3/getplacemap?key=YOUR_KEY_HERE&location=Lancaster,PA&size=400,200&zoom=7&showicon=green-1
    A map generated using an address or location
    http://www.mapquestapi.com/staticmap/v3/getplacemap?key=YOUR_KEY_HERE&location=Lancaster,PA&size=400,200&zoom=7&showicon=green-1
    Custom Icons
    Provide the URL for your own custom icon to use for a POI. We'll grab the icon, cache it for performance, and use it on the map. If you change the icon there's a function to flush it from our cache and grab the updated version.
    http://www.mapquestapi.com/staticmap/v3/getmap?key=YOUR_KEY_HERE&size=400,200&center=40.024600,-76.413100&zoom=6&xis=www.mapquestapi.com/media/images/money_sign.jpg,1,c,39.980237,-76.21054
    A map with a custom icon
    http://www.mapquestapi.com/staticmap/v3/getmap?key=YOUR_KEY_HERE&size=400,200&center=40.024600,-76.413100&zoom=6&xis=www.mapquestapi.com/media/images/money_sign.jpg,1,c,39.980237,-76.21054
    Add Traffic to the map
    You can specify incidents, construction, traffic flow, or all together, to be shown on the map. Point to note - the traffic is Real-Time, so whoever is looking at the map will see the state of traffic at the time they are looking, not the state of traffic you saw when you made the map.
    http://www.mapquestapi.com/staticmap/v3/getmap?size=400,300&center=40.720409,-73.994637&zoom=7&key=YOUR_KEY_HERE&traffic=1
    Traffic map with incidents, construction, and traffic flow
    http://www.mapquestapi.com/staticmap/v3/getmap?size=400,300&center=40.720409,-73.994637&zoom=7&key=YOUR_KEY_HERE&traffic=1
    Multiple Image Formats
    Support for jpg, png, gif image output formats. no real need to show images of this - just tell us the image format that works best for your application.

    Don't forget to check out the full documentation at http://www.mapquestapi.com/staticmap/

    Stay tuned - it's not Christmas yet! we've got a few updates left in us before the end of the year...

  • Time Dependent Routing and Path From Route added to Directions Service Beta

    .picture { background-color: #F9F9F9; border: 1px solid #CCCCCC; padding: 3px; font: 11px/1.4em Arial, sans-serif; } .picture img { border: 1px solid #CCCCCC; vertical-align:middle; margin-bottom: 3px; } .right { margin: 0.5em 0pt 0.5em 0.8em; float:right; } .left { margin: 0.5em 0.8em 0.5em 0; float:left; }

    We have two new features for the Directions Web Service Beta today. One of which is awesome and cool, and is rather obvious in what it does - That would be Time Dependent Routing. The second is incredibly powerful and complex, and is going to take a little time to explain, and that is Path From Route.

    Time Dependent Routing

    We've added new parameters to the Route function that let you tell us what time, and on what day, you want to start your directions. "Why would that matter?" I hear you ask. Well, the road network can change depending on the time of day. Sometimes a road is open, and sometimes it is not. Sometimes you can turn left at an intersection, and sometimes you can't. There's usually a sign at these lights telling you the hours you are allowed to turn left, and the hours you aren't. You normally only get to see them at the wrong time of day, sitting in a left turn lane with your indicator blinking, wondering how you are going to get back into traffic and what to do now you can't use the road you thought you could. We try to avoid giving people directions that would leave them stranded like that. However, now, by telling us when you plan to travel, we can take this into account and provide better directions that could get you there faster than if we didn't know when you were traveling.

    Make sense? good! ok, here's an example...

    restricted turn
    Because you cannot turn left at certain times, normally we have to route you round the block to make sure you aren't stuck at a left turn you can't make
    unrestricted turn
    But if you tell the directions service that you are travelling at 4 PM on a saturday, we know you can turn left.

    You can see an interactive example in the documentation, by following this link. Details on the parameters are found here

    Path From Route

    OK, this could be hard to explain, so bear with me. If you have a bunch of points or places, and you have a route you are going to be traveling, this function takes them both, and will tell you how far away from your route each point is, and how long it will take to drive to each point from the nearest point on your route where you could actually leave it AND tells you the Lat/Lng of where you would leave your route to go to each place.

    Again, lets see if an example would help.

    Lancaster - Hershey, plus a bunch of random locations
    1. Lets assume we are driving from Lancaster, PA to Hershey, PA. We have a bunch of Gas Stations (note: these are not real, but randomly generated for the example), and we want to know which ones are accessible within five driving minutes from our route
    Locations filtered for those which are with 5 minutes drive off of the route.
    2. So we tell the PathFromRoute function to compare these gas stations to our route. We also tell it that we are only interested in gas stations that we can get to in 5 minutes (we could also have said 5 miles, for a different result). the service will provide the necessary information to filter the gas stations.
    Showing the details that are returned by PathFromRoute
    3. If we examine three of the points returned within 5 minutes of our route, we can see that for each point we receive the driving distance and time, as well as the latitude & longitude of where to leave our original route to detour to the gas station. Using that Lat/Lng as a starting point, we can then generate the detour directions to the gas station.

    Still with me? Great!. Further details on the PathFromRoute function, as well as an interactive sample, can be found here.

  • Web 2.0 Geocoding Service Launched!

    Today we are very proud to announce that our new Geocoding Service has left Beta and has gone live to Production at www.mapquestapi.com/geocoding

    This is our third web service we have pushed to Beta, iterated, and then released to production, since we first pushed out the Beta of the Directions Web Service on July 20th. When you consider that we also have the Static Map Service as well as version 6 of the JavaScript and ActionScript SDKs in Beta, I think that is a rather incredible pace we are maintaining!

    I'm not much of one for flowery words, so I'll let the product speak for itself.

    The MapQuest Platform: Geocoding Web Service allows you to access MapQuest geo-location data directly over HTTP without having to go through a language-specific SDK. Requests can be submitted as Key-Value pairs, JSON, XML and more. Responses do not have to match the request-type; mix-and-match to fit your development needs. Full documentation, forums, and other resources are available on the Developer Network

    Features

    Address Geocode function
    Provide either a single line address, or an address broken down into its component parts (5-line) and receive back potential addresses and lat/lngs, in order of confidence
    Here's an example of just how easy it is:
    http://www.mapquestapi.com/geocoding/v1/address?key=YOUR_KEY_HERE&location=Lancaster&format=xml
    will return a result you can view here
    or, if you want to be particularly impressed by how easy it is to use, try out the little geocoding form I built right into the blog post! now THATS COOL!! I've deliberately picked a default town name that returns ambiguities - did you even know there were four towns in Georgia all named Four Points? Why don't you give your town name a try, but without entering the state, just to see how many other towns with the same name exist in the country.

    (Results will be displayed below)

    Reverse Geocode function
    Provide a Latitude and Longitude, and receive back the known address information of that location.
    Batch Geocode function
    Geocode up to 100 locations at once in a single batch function call. You can also receive the output in a delimited-text file for easy importing into Excel or a database.
    Reflected User-provided values
    Add your own data into the location object on your request, and receive it back in the response. Great for helping you maintain state in your application, and for keeping your own information about the location packaged together for your application.
    ViewPort Biasing
    If you provide a Map Bounds as part of your geocode call, ambiguity results within the map bounds will be moved to the top of the results list. So if you have someone already staring at a map, this greatly improves the chance that the place they are looking for is the top result
    ccTLD Biasing (Country Code Domains)
    If you don't provide a country for the address, the country will default to the domain of the web address making the geocoding request. For example, if you make a request from http://www.myAwesomeSite.co.fr, we will default the country to France unless you tell us differently.
    Thumbnail Ambiguity maps
    Each ambiguity result can return a static map URL that provides a thumbnail image of the ambiguous location, if you wish to display these to end-users for some context when disambiguating.
    Delimited File Output
    For any of the geocoding service functions, you can specify outFormat=file and a delimiter=of Comma(,) Pipe(|) Colon(:) or semi-colon(;). The service will then return a delimited text file including a header row. This should be especially useful for the batch geocoding function

    Stay Tuned for more updates

    More updates to Beta, and more Production roll-outs to come before the end of the year - we're not done yet

    Please remember to subscribe to the RSS feed, follow MapQuest on Twitter, or become a Fan of MapQuest on Facebook by clicking the links at the top-right of the page. Thanks!