Archive for the ‘Mapping’ Category

Post

GEOCode an Address

In Bing Maps,Geo Spatial,Mapping on February 24, 2012 by mws580

Bing Control to Convert a Text Address into a Location

Add a Service Reference

From Visual Studio service reference point to http://dev.virtualearth.net/webservices/v1/geocodeservice/geocodeservice.svc/mex for the dev environment. There are staging and production links so you appropriate ones for your application.

Staging:

http://staging.dev.virtualearth.net/webservices/v1/geocodeservice/geocodeservice.svc

Production:

http://dev.virtualearth.net/webservices/v1/geocodeservice/geocodeservice.svc

http://msdn.microsoft.com/en-us/library/dd221354.aspx

GEOCode ServiceReference

Comments Off

Post

Found it, Lost it, Found it

In Bing Maps,Geo Spatial,Mapping on February 23, 2012 by mws580

Just when I became well versed in mapping with the bing map control and the ability to plot locations from SQL,  the come out wit an improved version that is totally different. 

My old code still works just fine when referencing the v6.2 library. 

Control on a diet.

To accommodate Mobile computing the control was slimmed down to its core.  As the developer needed other functionality they could add modules as needed to fulfill tasks.

Here is an article on importing GEORss feeds.

GEORSss and Bing Map v7

What’s new in Bing Map 7

Here is Keith Kinnan’s list of updates

What is new

Comments Off

Post

Get Location on Windows Phone 7

In Geo Spatial,Mapping,SQL Saturday,Windows Phone 7 on January 15, 2011 by mws580

To get the geographic location of the device there ae a few steps to follow. 

1) Add a reference to System.Device

2) Add a ‘using’ line using System.Device.Location;

3) At the start of the page add a listener

GeoCoordinateWatcher watcher;

For a one time get of the location…

4) Add a button that calls the event defined here

private void StartLocationButton_Click(object sender, RoutedEventArgs e)
{
    // The watcher variable was previously declared as type GeoCoordinateWatcher.
    if (watcher == null)
    {
        watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.High); // Use high accuracy.
        watcher.MovementThreshold = 20; // Use MovementThreshold to ignore noise in the signal.
        watcher.StatusChanged += new EventHandler<GeoPositionStatusChangedEventArgs>(watcher_StatusChanged);
    }
    watcher.Start();
}
5) Add the listening event that the above function calls.  It is listening for the status change.  The start above causes a status change.  Notice there is a stop at the end.  Geo Location service burns battery time.

void watcher_StatusChanged(object sender, GeoPositionStatusChangedEventArgs e)
{
    if (e.Status == GeoPositionStatus.Ready)
    {
        // Use the Position property of the GeoCoordinateWatcher object to get the current location.
        GeoCoordinate co = watcher.Position.Location;
        latitudeTextBlock.Text = co.Latitude.ToString("0.000");
        longitudeTextBlock.Text = co.Longitude.ToString("0.000");
        //Stop the Location Service to conserve battery power.
        watcher.Stop();
    }
}

 

Happy Coding

Comments Off

t

There were great attendees to the SQL Saturday presentation “Spatial Queries in SQL 2008”

First, here are the slide,database , SQL, and ASP.Net code in one zip file.

Download from SQLSaturday website

Here are some links mentioned during the presentation.

1) Geocoding addresses using Google See sample on Codeplex.com

2) BING maps SDK AJAX version

3) Bing maps SDK Silverlight version

4) Window Mobile 7 toolkit Download the Tools

phone7

SQL Saturday 49 Orlando

on October 16, 2010 by mws580

Comments Off

t

As promised here are the slides from the presentation.

PowerPoint Slides

PDF version on the slides

Tampa Code Camp 2009

on November 7, 2009 by mws580

Comments Off

Post

SQL Saturday #21 Orlando – Spatial Data in SQL 2008

In Mapping,SQL Saturday,SQL Server 2008 on October 17, 2009 by mws580

October 17, 2009

This session is

a quick tour of the spatial features of SQL Server 2008slide1

PowerPoint slides

PowerPoint as PDF

Tyler Chessman’s article in SQL Server Magazine’s December 2008 issue is my primary source of information to implement my spatial solutions. Visit http://www.sqlmag.com and search for instant doc ID 100528.
Here is a link to the article

What is Spatial Data

  • Spatial data represents the shape and physical location of an object.
  • The object can be a house, business, sub-division, or a county.
  • SQL Server 2008 has two new data types GEOMETRY and GEOGRAPHY.
  • GEOMETRY works with flat objects.
  • GEOGRAPHY considers the shape of the earth.

CLR Types

  • GEOGRAPHY and GEOMETRY are CLR data types.
  • You do not need to have CLR enabled on the SQL Server instance.
  • Microsoft has provided a long list of OGC methods.
  • These are methods that are part of the independent Open Geospatial Consortium list of specifications

STDistance Function explained

  • The STDistance function requires an argument of the SQLgeometrytype
  • Convert the latitude and longitude to SQLgeometrytype.
  • Declare a variable of the geography type.
  • Set the variable to geography::STGeomFromText(‘point(lon lat)’,4326).
  • Notice that the point is a string.
  • Notice there is no comma between lat and lon
  • 4326 is an SRID and is used to tell the function what method to use to calculate distance on a not-so-round planet.

STDistance in action

Declare @CodeGEOG geography =
geography::STGeomFromText(‘Point(-95.3410 29.7070)’,4326);
Select top(5) addr.AddressID as id ,
addr.addressline1,addr.city,
addr.SpatialLocation, — Will show the raw data
addr.SpatialLocation.AsGml() as SpationalGML,
addr.SpatialLocation.STAsText() as SpatialText,
addr.SpatialLocation.STGeometryType() as GeoType,
addr.SpatialLocation.STNumPoints() as Points,
addr.SpatialLocation.STDistance(@CodeGEOG) as distance_in_meters,
addr.SpatialLocation.STDistance(@CodeGEOG)/1609.344 as distance_in_miles
from dbo.Address addr
Where
addr.SpatialLocation.STDistance(@CodeGEOG)/1609.344 < 50
order by distance_in_miles

Wire the SQL up to Virtual Earth

The wire up will get it’s own blog entry

Comments Off

Post

SQLSaturday #15 Jacksonville

In Bing Maps,Mapping,SQL Server 2008 on May 2, 2009 by mws580

Spatial data represents the shape and physical location of an object.  For example, the object can be a house, business, sub-division, or a county.  SSQL Server 2008 has two new data types GEOMETRY and GEOGRAPHY.  GEOMETRY works with flat objects. GEOGRAPHY considers the shape of the earth. 

GEOGRAPHY and GEOMETRY or CLR data types. Though to implement them you do not need to have CLR enabled on the SQL Server instance.  Microsoft has provided a long list of OGC methods.  These are methods that are part of the independent  Open Geospatial Consortium list of specifications.

Here is a PDF of my presentation SQLSaturday.pdf (806.55 kb)

Comments Off

Follow

Get every new post delivered to your Inbox.