[postgis-users] SRID for analyzing a USA national data set in Meters

Stephen Woodbridge woodbri at swoodbridge.com
Mon Apr 2 08:25:44 PDT 2007


Michael,

The Simple answer is that there is no simple answer. You have not given 
us enough information about what kind of calculations you need to do and 
what are acceptable errors. Are you worried about distortions in 
distance, area, or direction/heading for example.

Why don't you do all you analysis in lat/lon and convert to meters based 
on the fact that 1 deg is roughly 69..... nautical miles and you can 
convert miles to meters? You this would be problematic over large 
changes in latitude. Or use distance_sphere() which uses another 
approximation based on a spherical earth.

Any suggestion we can offer will have problems. You need to look at the 
problems in light of you analysis constraints and pick a compomise that 
you can live with. If you give us additional information me might be 
able to make additional suggestions.

Also variants on this request can be found in the archives as this is a 
fairly common question.

Hope this helps,
   -Steve W

Michael Frumin wrote:
> pedro,
> 
> This appears to suggest that i should pick an SRID based on one point in 
> my data set.  However, since the data set is national, it includes 
> points from all around the USA (i.e. at least 4 UTM zones).  So, if I 
> pick the SRID for, say, Mountain Time, will that horribly distort points 
> on the east and/or west coast?  is there no SRID that is perhaps less 
> accurate in any one time zone, but more accurate across all time zones 
> in the [continental] US?
> 
> thanks,
> mike
> 
> pdoria at netmadeira.com wrote:
>> Hello Michael,
>>
>> You determine the correct SRID with this bit of code (PHP):
>> (the $loc was obtained from a SELECT with the astext(geometry) function)
>>
>> The idea behind this is summarized in the UtmZoneFromLong() function.
>> Pick a Long value and calculate the utm zone for it.
>> Then use the SridFromUtmZone() function to get the srid from the given 
>> mask
>> (see below) --> this queries spatial_ref_sys with the calculated $utm 
>> param.
>> SELECT srid FROM spatial_ref_sys WHERE srtext LIKE 'PROJCS[\"WGS 84 / UTM
>> zone $utm%' LIMIT 1
>>
>> // extract the POINT geometry
>> $geometry = str_replace("POINT(","", $loc);
>> $geometry = str_replace(")","",$geometry);
>> $coordinate = explode(" ",$geometry);
>> $lon=$coordinate[0];
>> $lat=$coordinate[1];
>>
>> // get utm zone from coordinates
>> $utm=UtmZoneFromLong($lon);
>> // get srid from the spatial_ref_sys table for the given utm zone
>> // add N or S
>> if($lat>=0) $utm.="N";
>> else $utm.="S";
>> $srid=SridFromUtmZone($utm, $connection);
>>
>>
>> // determine UTM zone from LonLat coordinates
>> // params $long: longitude
>> // returns (int) utm
>> function UtmZoneFromLong($lon) {
>>     $utm = floor(($lon + 180) / 6) + 1;
>>     return $utm;
>> }
>>
>> // query the spatial_ref_sys table for the srid of the given utm zone
>> // params $utm: utm zone string (MUST BE TRAILED WITH 'N' OR 'S'!), 
>> $conn:
>> connection to the db
>> // returns (int) srid
>> function SridFromUtmZone($utm, $conn){
>> $myresult = pg_exec($conn, "SELECT srid FROM spatial_ref_sys WHERE srtext
>> LIKE 'PROJCS[\"WGS 84 / UTM zone $utm%' LIMIT 1");
>> $srid=pg_result($myresult, 0, 0);
>> return $srid;
>> }
>>
>> HTH,
>> Pedro Doria Meunier
>>
>> -----Original Message-----
>> From: postgis-users-bounces at postgis.refractions.net
>> [mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of 
>> mfrumin
>> Sent: segunda-feira, 2 de Abril de 2007 14:12
>> To: postgis-users at postgis.refractions.net
>> Subject: [postgis-users] SRID for analyzing a USA national data set in
>> Meters
>>
>>
>> I have a data set that includes points all over the United States in 
>> lat/lng
>> (say, SRID = 4326) but I need to do some analysis on these data in real
>> units, say meters.  So, my task is to select an appropriate SRID that 
>> will
>> work reasonably well for the whole USA to reproject lat/lng into 
>> meters.  There are a bazillion SRID's available. Any suggestions?
>>
>> This analysis doesn't have to be super-precise, so I'm not so 
>> concerned with
>> the limitations of a national projection (as opposed to state/region).
>>
>> thanks,
>> Michael
>>
>> -- View this message in context:
>> http://www.nabble.com/SRID-for-analyzing-a-USA-national-data-set-in-Meters-t 
>>
>> f3505664.html#a9790471
>> Sent from the PostGIS - User mailing list archive at Nabble.com.
>>
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
>>
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>   
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users




More information about the postgis-users mailing list