[postgis-users] distance to coastline

Kevin Russell krussell1 at baldwinmutual.com
Tue Aug 1 11:37:34 PDT 2006


In trying to learn more about gis by solving a problem, I've come up
with the following problem: how to compute the distance from a point
to the coastline.  So first off, I installed postgis and after a
little looking I've found the following sources of data for the
entire us coastline: http://coastalmap.marine.usgs.gov/GISdata/
basemaps/coastlines/nos80k/ and then a smaller portion:  http://  
rimmer.ngdc.noaa.gov/mgg/coast/getcoast.html.

Because of my lack of experience, I figured the best way to get the
data into postgis was to convert the shapefile of the entire us
coastline and import it into postgis.  I was successful in doing this
but it appears that all of the data is contained in one record, so
I'm assuming this is just a massive multipolygon.  So I've got the
data, but now I'm stuck on getting the distance to the coastline as  
distance_spheroid will not compute from point to multipolygon.  Also,  
I was unable to find a way to find the closest point on the  
multipolygon so I can use distance_spheroid(point,point).

My other option is to import the second datasource which provides the
following data options: mapgen, arc/info ungenerate, matlab, or
splus.  Here's a sample of the data:
# -b
-88.872153    30.052031
-88.871126    30.050930
-88.870393    30.050564
-88.870099    30.050710
-88.870099    30.051004
-88.871786    30.052104
-88.872153    30.052031
# -b
-88.869439    30.049024
-88.869293    30.048730
-88.869073    30.048804
-88.868999    30.049024
-88.868999    30.049244
-88.869366    30.049464
-88.869439    30.049024
# -b
-88.872373    30.048437
-88.872006    30.048144
-88.871346    30.047924
-88.870319    30.047997
-88.869733    30.047997
-88.869293    30.047850
-88.868633    30.047704
-88.867166    30.047704
-88.866872    30.047997
-88.867019    30.048510
-88.868119    30.049610
-88.868046     30.049170
-88.867753    30.048877
-88.867753    30.048657
-88.868193    30.048437
-88.869879    30.048510
-88.870686    30.048730
-88.871346    30.048730
-88.871786    30.048730
-88.872373    30.048437
# -b
-88.872153    30.044990
-88.871053    30.045137
-88.870539    30.045137
-88.870246    30.044917
-88.870539    30.044623
-88.870979    30.044550
-88.871859    30.044550
-88.872299    30.044623
-88.872520    30.044843
-88.872153    30.044990

And I'm assuming these are line segments.  I think this will be the  
easier option( less mathematically challenging) but am unable to  
figure out how to get the data imported into postgis.  Can anyone  
please provide me some guidance?  Then, once the data is in, what  
would be the easiest way to find the closest point to utilize  
distance_spheroid?

Thanks,
Kevin



More information about the postgis-users mailing list