SQL 2008 geography & geometry - which to use? -
I am creating a Google map mashup and using SQL 2008.
I want to calculate the number of points on a bigger earth and in them in SQL - like selecting all the points located within a particular polygon, or select all the points within 10km xy .
I have never used and should I use geography
or geometry
datatype for it before SQL spatial features?
Geography is the type that is intended to plot the issue on Earth.
If you have a table that stores Google Maps numerals like this:
create realistic geolocation (location_id exploration identifier null, status_notography, tap) );
Then you can fill in the digits with this stored procedure:
create process proc_AddPoint @latitude decimal (9,6), @longitude decimal (9, 6), @altitude smallInt AS DECLARE @ point Geography = null; Set from the beginning; SET @ point = geography :: STPointFromText ('POINT (' + CONVERT (varchar (15), @longitude) + + + CONVERT (varchar (15), @latitude) + '+ + convert (varchar (10), @ height ) + ')', 4326) Enter value in geographic location (place_id, position_pick) (nude (), dot @); END
If you want to query for latitude, longitude and height, then just use the following query format:
SELECT geo_locations.position_point Lat AS latitude, geo_location..position_point.Long AS latitude, geo_space_position_position_point.z height from geo_locations;
Comments
Post a Comment