locked
Problems in aggregate multipolygon shapes RRS feed

  • Question

  • Hi,

    i got a problem, my aim is to use the method STUnion which will return one row containing the boundaries of the entire world.

    i've download a shapefiles that contains these places.

    ID    CONTINENT
    1    Africa
    2    Antarctica
    3    Asia
    4    Australia
    5    Europe
    6    North America
    7    Oceania
    8    South America

    i've imported in the db using shapefile_uploader ad setting the srid to 4326.

    Ican't  obtain the result i want. the stUnion function return allways null (i read that return null in case the srid differs so i even tried to force again the srid to 4326 but nothing).

    I even tried to use the StBuffer methods to avoid problems...nothing

    This is the little example i use, works only with the id 3 and 5...does anyone know how can i resolve the problem?

    Thanks a lot Massimo

    DECLARE @sum_geography_pos geography = 'GEOMETRYCOLLECTION EMPTY';
    SELECT @sum_geography_pos = @sum_geography_pos.STUnion(geography_pos) FROM world_boundaries5 --WHERE id IN (3,5);
    --SELECT @sum_geography_pos = @sum_geography_pos.STUnion(geography::STMPolyFromText(geography_pos.ToString(), 4326)) FROM dbo.world_boundaries5
    SELECT @sum_geography_pos

    Tuesday, September 21, 2010 11:26 AM

Answers

  • Every geography instance must fit inside a hemisphere, so you can't have a single geometry collection containing the boundaries of the entire world.

    Beginning Spatial with SQL Server http://www.apress.com/book/view/1430218290
    • Marked as answer by Tom Li - MSFT Friday, October 1, 2010 12:22 PM
    Tuesday, September 21, 2010 11:39 AM
    Answerer

All replies

  • Every geography instance must fit inside a hemisphere, so you can't have a single geometry collection containing the boundaries of the entire world.

    Beginning Spatial with SQL Server http://www.apress.com/book/view/1430218290
    • Marked as answer by Tom Li - MSFT Friday, October 1, 2010 12:22 PM
    Tuesday, September 21, 2010 11:39 AM
    Answerer
  • The restriction is only for geography, if you load the data in a geometry table you will be able to use STUnion 
    Tuesday, September 21, 2010 1:08 PM
  • Thanks guys for your precious replies.

    Massimo

    Tuesday, September 21, 2010 3:33 PM