DZone
Mobile Zone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone > Mobile Zone > Tip of the day for Windows Phone developers - the Map control is not always necessary

Tip of the day for Windows Phone developers - the Map control is not always necessary

Denzel D. user avatar by
Denzel D.
·
Sep. 02, 11 · Mobile Zone · Interview
Like (0)
Save
Tweet
7.51K Views

Join the DZone community and get the full member experience.

Join For Free

if you look in the windows phone marketplace, you will notice that there is a plethora of applications that are using device-based location and maps. there is the map control that facilitates the use and customization of user's surroundings, but what some developers don't know is that for some static content the map control is overkill.

instead, it is worth looking at the open bing maps api that allows the developer to access location tiles in different formats and sizes, as long as the longitude and the latitude of a searched point are known.

for example, here is a service request url that will return a location tile:

http://tiles.virtualearth.net/api/getmap.ashx?c=39.213413,-98.699930&w=800&h=800&b=r,stl.h,device.mobile,mkt.en-us&z=15&logo=no&da=n

notice how i am passing the latitude and the longitude via the c parameter . w and h parameters determine the width and height of the returned image. b is the appearance descriptor. in this case, there is a device.mobile option that will increase the frequency of different location indicators (e.g. street names or highway numbers).

the z parameter is the zoom factor. this value has the range: 1 to 21 (21 being the highest). going beyond this range will cause a bad request error.

but i don't want the logo on the map...

for whatever reason you might need to remove the logos from the tile (e.g. taking too much space), you can do this through the same url parameters. to remove the bing logo, use the logo=no pair. to remove the navteq reference, use the da=n pair. compare the two images above to see what i am talking about.

how can i get the lat/lon values?

the coordinates used in the service request are used in the same format as the latitude and longitude returned by geocoordinatewatcher :

geocoordinatewatcher watcher;
public mainpage()
{
    initializecomponent();

    watcher = new geocoordinatewatcher();
    watcher.start();
    watcher.positionchanged += new eventhandler<geopositionchangedeventargs<geocoordinate>>(watcher_positionchanged);
}

void watcher_positionchanged(object sender, geopositionchangedeventargs<geocoordinate> e)
{
    debug.writeline(e.position.location.latitude + " " + e.position.location.longitude);
}

these service endpoints can be extremely useful for what windows phone does best - implement live tiles.

Windows Phone dev

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Modernize Legacy Code in Production: Rebuild Your Airplane Midflight Without Crashing
  • Top 7 Automated Testing Trends of 2022
  • What Is HttpSession in Servlets?
  • Java Outsourcing, a Strong Business, and Management Approaches

Comments

Mobile Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo