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

Michael Frumin mfrumin at rpa.org
Mon Apr 2 08:13:02 PDT 2007


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
>   



More information about the postgis-users mailing list