none
spatial REST api question

    Question

  • I have my code entered but I can get any information back using :

    http://spatial.virtualearth.net/REST/v1/Dataflows/Geocode?Query="1600 Pennsylvania Ave NW Washington DC"&output=xml&dataLocation=&key=<mykey>

    what I get is:

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <Response xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><copyright style="background-color:transparent;color:#000000;display:block;font-family:Verdana;font-size:13.33px;font-style:normal;font-variant:normal;font-weight:700;letter-spacing:normal;orphans:2;padding-text-align:left;text-decoration:none;text-indent:0px;text-transform:none;-webkit-text-stroke-width:0px;white-space:normal;word-spacing:0px;" xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1"><Copyright>Copyright © 2018 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.</Copyright></copyright><brandlogouri style="background-color:transparent;color:#000000;display:block;font-family:Verdana;font-size:13.33px;font-style:normal;font-variant:normal;font-weight:700;letter-spacing:normal;orphans:2;padding-text-align:left;text-decoration:none;text-indent:0px;text-transform:none;-webkit-text-stroke-width:0px;white-space:normal;word-spacing:0px;" xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1"><BrandLogoUri>http://spatial.virtualearth.net/Branding/logo_powered_by.png</BrandLogoUri></brandlogouri><statuscode style="background-color:transparent;color:#000000;display:block;font-family:Verdana;font-size:13.33px;font-style:normal;font-variant:normal;font-weight:700;letter-spacing:normal;orphans:2;padding-text-align:left;text-decoration:none;text-indent:0px;text-transform:none;-webkit-text-stroke-width:0px;white-space:normal;word-spacing:0px;" xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1"><StatusCode>404</StatusCode></statuscode><statusdescription style="background-color:transparent;color:#000000;display:block;font-family:Verdana;font-size:13.33px;font-style:normal;font-variant:normal;font-weight:700;letter-spacing:normal;orphans:2;padding-text-align:left;text-decoration:none;text-indent:0px;text-transform:none;-webkit-text-stroke-width:0px;white-space:normal;word-spacing:0px;" xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1"><StatusDescription>Not Found</StatusDescription></statusdescription><authenticationresultcode style="background-color:transparent;color:#000000;display:block;font-family:Verdana;font-size:13.33px;font-style:normal;font-variant:normal;font-weight:700;letter-spacing:normal;orphans:2;padding-text-align:left;text-decoration:none;text-indent:0px;text-transform:none;-webkit-text-stroke-width:0px;white-space:normal;word-spacing:0px;" xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1"><AuthenticationResultCode>ValidCredentials</AuthenticationResultCode></authenticationresultcode><errordetails style="background-color:transparent;color:#000000;display:block;font-family:Verdana;font-size:13.33px;font-style:normal;font-variant:normal;font-weight:700;letter-spacing:normal;orphans:2;padding-text-align:left;text-decoration:none;text-indent:0px;text-transform:none;-webkit-text-stroke-width:0px;white-space:normal;word-spacing:0px;" xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1"><ErrorDetails><string style="display:block;padding-"><string>The requested resource was not found.</string></string></ErrorDetails></errordetails><traceid style="background-color:transparent;color:#000000;display:block;font-family:Verdana;font-size:13.33px;font-style:normal;font-variant:normal;font-weight:700;letter-spacing:normal;orphans:2;padding-text-align:left;text-decoration:none;text-indent:0px;text-transform:none;-webkit-text-stroke-width:0px;white-space:normal;word-spacing:0px;" xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1"><TraceId>5018dbecfebb426c9a6138d44db575ed|CH10000783|7.7.0.0</TraceId></traceid><resourcesets style="background-color:transparent;color:#000000;display:block;font-family:Verdana;font-size:13.33px;font-style:normal;font-variant:normal;font-weight:700;letter-spacing:normal;orphans:2;padding-text-align:left;text-decoration:none;text-indent:0px;text-transform:none;-webkit-text-stroke-width:0px;white-space:normal;word-spacing:0px;" xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1"><ResourceSets/></resourcesets></Response>

    any sugestions?

    ideally I would supply a Canadian postal code like s7k2n8 and get back a neighbor hood code and lat and long ….can I do this in this API

    Monday, November 26, 2018 1:44 AM

Answers

  • this is what worked for me 

    this will give me the LAT LONG but No neighiborhood

    http://dev.virtualearth.net/REST/v1/Locations/S7K 5S6?inclnb=1&o=xml&key=<BingKey>

    I swithced to using full addr -PC and that yields a neighibiorhood value

    http://dev.virtualearth.net/REST/v1/Locations/134 Primrose Dr, Saskatoon SK?inclnb=1&o=xml&key=<BingKey>

    • Marked as answer by rm99 Tuesday, November 27, 2018 5:47 PM
    Tuesday, November 27, 2018 5:47 PM

All replies

  • Hi RM99,

    You state that you want to use Spatial Data Service but you are not calling the correct API.  For example, check out this "PopulatedPlace" in Canada here https://www.bing.com/api/maps/sdkrelease/mapcontrol/isdk/sdsloadsingleboundary.

    To use the first three characters of a Canadian Postal Code to find the spatial region, cheack out the previous answer given at https://social.msdn.microsoft.com/Forums/en-US/6cc551a9-dc38-4be6-9d21-6542bf8702cd/get-boundaries-demo-with-full-canadian-postal-codes?forum=bingmapsajax

    Sincerely,

    IoTGirl

    Monday, November 26, 2018 8:04 AM
    Owner
  • Hey thanks IoTgirl!

    is there anyway to encode that in the below format

    http://spatial.virtualearth.net/REST/v1/Dataflows/Geocode?Query="1600 Pennsylvania Ave NW Washington DC"&output=xml&dataLocation=&key=<mykey>

    my goal here is to "LOAD" xml data

    like this

    objXML.load("http://geocoder.ca/?latt=" & latt & "&longt=" & longt & "=req10001&geoit=XML")

    http://geocoder.ca/?latt=52.114581&longt=-106.593942&geoit=XML

    this site requires payment but it returns xml exactly like I want can I do this in bing

    <?xml version="1.0" encoding="UTF-8"?>

    -<geodata>

    <latt>52.114713</latt>

    <longt>-106.593942</longt>

    <city>Saskatoon</city>

    <prov>SK</prov>

    <postal>A1A1A1</postal>

    <stnumber>1212</stnumber>

    <staddress>XXXXXX PL</staddress>

    <inlatt>52.114581</inlatt>

    <inlongt>-106.593942</inlongt>

    <distance>0.000</distance>

    <NearRoad>Oake AVE</NearRoad>

    <NearRoadDistance>0.003</NearRoadDistance>

    <betweenRoad1>Charren</betweenRoad1>

    <betweenRoad2>8th</betweenRoad2>

    <neighborhood>College Park</neighborhood>


    -<neighborhoods>

    <neighborhoodname>College Park,Saskatoon SK</neighborhoodname>

    <neighborhoodname>Wildwood,saskatoon</neighborhoodname>

    <neighborhoodname>Greystone Heights,saskatoon</neighborhoodname>

    <neighborhoodname>SASKATOON,SK</neighborhoodname>

    </neighborhoods>

    <TimeZone>America/Regina</TimeZone>

    <AreaCode>306</AreaCode>

    </geodata>

    I was hoping the query

    http://spatial.virtualearth.net/REST/v1/Dataflows/Geocode/?Query="A1A1A1"&output=xml&dataLocation=&key=<mykey>

    might do the trick?

    Monday, November 26, 2018 9:54 PM
  • I guess what i am trying to do is geocode/reverse geocode a Canadian postal code to a LAT and LONG as well as to a nieghiborhood value if that is possible ion BING?
    Tuesday, November 27, 2018 1:57 PM
  • this gives me the lat long

    http://dev.virtualearth.net/REST/v1/Locations/S7J2G2?o=xml&key=<BING KEY>

    any idea how i would request the nieghiborhood as well?

    Tuesday, November 27, 2018 2:21 PM
  • Hi rm99,

    Please look at my first reply.  You can use the first 3 letters of the postal code to get the neighbourhood polygon.

    Sincerely,

    IoTGirl

    Tuesday, November 27, 2018 5:41 PM
    Owner
  • this is what worked for me 

    this will give me the LAT LONG but No neighiborhood

    http://dev.virtualearth.net/REST/v1/Locations/S7K 5S6?inclnb=1&o=xml&key=<BingKey>

    I swithced to using full addr -PC and that yields a neighibiorhood value

    http://dev.virtualearth.net/REST/v1/Locations/134 Primrose Dr, Saskatoon SK?inclnb=1&o=xml&key=<BingKey>

    • Marked as answer by rm99 Tuesday, November 27, 2018 5:47 PM
    Tuesday, November 27, 2018 5:47 PM
  • I think I am trying to do Mine slightly differently thanks you you seem to be posting them via  a webpage.

    I am just brute force throwing them at the XML WS and getting back XML to parse so I can update a database.

    I wish I had and elegant solution but what i am doing now is 

    http://dev.virtualearth.net/REST/v1/Locations/101%2022nd%20Street%20EastSaskatoon,%20SK?inclnb=1&o=xml&key=<MyKey>

    using PC didnt return neighborhood for me??? address did 

    IoT so was that the actiuall VanCity neighiborhood you got back or was it the Forward sorting area for canada cost?

     
    Tuesday, November 27, 2018 5:57 PM
  • Hi rm99,

    The title of this thread is "Spatial Rest API Question" so by neighbourhood I assumed you meant the polygon that defines an area.  That is a spatial result.  Your solutions are not spatial calls but rather point location geocode calls.

    Again, it looks like you did not look at the pictures included with the post at https://social.msdn.microsoft.com/Forums/en-US/6cc551a9-dc38-4be6-9d21-6542bf8702cd/get-boundaries-demo-with-full-canadian-postal-codes?forum=bingmapsajax

    You asked for spatial data so I assumed you were looking for spatial data, aka polygon/area definition.

    Sincerely,

    IoTGirl

    Tuesday, November 27, 2018 6:45 PM
    Owner