<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"Courier New \;";
        panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0in;
        margin-right:0in;
        margin-bottom:0in;
        margin-left:.5in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
p.yiv75235976msonormal, li.yiv75235976msonormal, div.yiv75235976msonormal
        {mso-style-name:yiv75235976msonormal;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
p.yiv75235976msochpdefault, li.yiv75235976msochpdefault, div.yiv75235976msochpdefault
        {mso-style-name:yiv75235976msochpdefault;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.yiv75235976msohyperlink
        {mso-style-name:yiv75235976msohyperlink;}
span.yiv75235976msohyperlinkfollowed
        {mso-style-name:yiv75235976msohyperlinkfollowed;}
span.yiv75235976emailstyle17
        {mso-style-name:yiv75235976emailstyle17;}
p.yiv75235976msonormal1, li.yiv75235976msonormal1, div.yiv75235976msonormal1
        {mso-style-name:yiv75235976msonormal1;
        margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Arial","sans-serif";}
span.yiv75235976msohyperlink1
        {mso-style-name:yiv75235976msohyperlink1;
        color:blue;
        text-decoration:underline;}
span.yiv75235976msohyperlinkfollowed1
        {mso-style-name:yiv75235976msohyperlinkfollowed1;
        color:purple;
        text-decoration:underline;}
span.yiv75235976emailstyle171
        {mso-style-name:yiv75235976emailstyle171;
        font-family:"Arial","sans-serif";
        color:windowtext;}
p.yiv75235976msochpdefault1, li.yiv75235976msochpdefault1, div.yiv75235976msochpdefault1
        {mso-style-name:yiv75235976msochpdefault1;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Arial","sans-serif";}
span.EmailStyle27
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:608859806;
        mso-list-type:hybrid;
        mso-list-template-ids:2069382202 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level2
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level3
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l0:level4
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level5
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level6
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l0:level7
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level8
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level9
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
ol
        {margin-bottom:0in;}
ul
        {margin-bottom:0in;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Brent,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Thank you very much for the advice. What I resorted to (at least for the present) is:<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoListParagraph style='text-indent:-.25in;mso-list:l0 level1 lfo1'><![if !supportLists]><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><span style='mso-list:Ignore'>1.<span style='font:7.0pt "Times New Roman"'> </span></span></span><![endif]><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> I try to get the geogcs or projcs (if projected) authority code from OGR. If successful, I try to find a match in the spatial_ref_sys table. If I find a match then I compare the wkt, if it’s exactly the same I use it. If not I go to number 2.<o:p></o:p></span></p><p class=MsoListParagraph style='text-indent:-.25in;mso-list:l0 level1 lfo1'><![if !supportLists]><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><span style='mso-list:Ignore'>2.<span style='font:7.0pt "Times New Roman"'> </span></span></span><![endif]><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I export the proj4 text from OGR and do a select on the spatial_ref_sys table for an exact match. If found I use that srid. If not I go to number 3.<o:p></o:p></span></p><p class=MsoListParagraph style='text-indent:-.25in;mso-list:l0 level1 lfo1'><![if !supportLists]><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><span style='mso-list:Ignore'>3.<span style='font:7.0pt "Times New Roman"'> </span></span></span><![endif]><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I export the wkt text from OGR and do a select on the spatial_ref_sys table for an exact match. If found I use that srid. If not I go to number 4.<o:p></o:p></span></p><p class=MsoListParagraph style='text-indent:-.25in;mso-list:l0 level1 lfo1'><![if !supportLists]><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><span style='mso-list:Ignore'>4.<span style='font:7.0pt "Times New Roman"'> </span></span></span><![endif]><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I select the max(srid) where srid > 10000000. If zero is returned then I use that base number (10000000) and add a new entry to the spatial_ref_sys table using the proj4 text and wkt so all fields have a value…and my app name as the authority (makes me feel important </span><span style='font-size:11.0pt;font-family:Wingdings;color:#1F497D'>J</span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>). If a max above 10000000 is found then I take the max and add one and then add the new entry.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>If you or anyone else can see any flaws in that logic I would appreciate some criticism.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Thanks again for your feedback!<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Best regards,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Martin<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> pcreso@pcreso.com [mailto:pcreso@pcreso.com] <br><b>Sent:</b> Friday, February 10, 2012 10:33 PM<br><b>To:</b> Martin Chapman<br><b>Cc:</b> gdal-dev@lists.osgeo.org<br><b>Subject:</b> Re: [gdal-dev] PostGIS SRID conundrum<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0><tr><td valign=top style='padding:0in 0in 0in 0in'><p class=MsoNormal>ESRI does not use a SRID, it uses a text string that needs complex parsing to work. If ESRI supported EPSG codes it would be easier...<br><br>The spatial_ref_sys table contains entries for all EPSG recognised projections. If you have a reasonable case to have a projection inluded by EPSG, submit a request to EPSG & it will finish up in the Postgis spatial_reference table.<br><br>In the short term, add a proj4txt record for your projection with an arbitrary new srid in the spatial_ref_sys table & it will work fine in Postgis. If you want it to work with GDAL/OGR then you;ll need to add it to the proj4 list of projection parameters. Where this is depends on your OS & implementation.<br><br>See this spec:<br><br><a href="http://remotesensing.org/geotiff/proj_list/orthographic.html">http://remotesensing.org/geotiff/proj_list/orthographic.html</a><br><br>The proj4 parameter list for your case may need to specify WGS84 as your ellipsoid & datum.<br><br>HTH,<br><br> Brent Wood<br><br>--- On <b>Sat, 2/11/12, Martin Chapman <i><<a href="mailto:chapmanm@pixia.com">chapmanm@pixia.com</a>></i></b> wrote:<o:p></o:p></p><p class=MsoNormal style='margin-bottom:12.0pt'><br>From: Martin Chapman <<a href="mailto:chapmanm@pixia.com">chapmanm@pixia.com</a>><br>Subject: [gdal-dev] PostGIS SRID conundrum<br>To: <a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>Date: Saturday, February 11, 2012, 12:25 PM<o:p></o:p></p><div id=yiv75235976><div><div><p class=yiv75235976msonormal>I know this question isn’t exactly related to GDAL but I thought someone on the list might be able to answer this question.<o:p></o:p></p><p class=yiv75235976msonormal> <o:p></o:p></p><p class=yiv75235976msonormal>So, I have a shape file that has the following spatial reference:<o:p></o:p></p><p class=yiv75235976msonormal> <o:p></o:p></p><p class=yiv75235976msonormal><span style='font-family:"Courier New"'>PROJCS["Orthographic",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Orthographic"],PARAMETER["Latitude_Of_Center",40],PARAMETER["Longitude_Of_Center",-75],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["User Defined",1]]</span><o:p></o:p></p><p class=yiv75235976msonormal><span style='font-family:"Courier New"'> </span><o:p></o:p></p><p class=yiv75235976msonormal><span style='font-family:"Courier New"'>It was generated using OGR. I want to insert it into postgres / postgis but there is no direct match for the wkt or proj4 definition in the spatial_ref_sys table. So, I go to insert it into the table but the question arises, what SRID do I use? Do I just fudge a random one with a high enough value that I hope it won’t conflict with some other SRID in the future, or do I create a table based off of the heterogeneous list of SRIDs at spatialreference.org and insert from that? I would like to do the later but that will be a pain unless someone has a put together a batch insert sql file for all the projections on spatialreference.org. Still, there is always the possibility that I may run into one that isn’t defined and I will have to fudge my own number anyway.</span><o:p></o:p></p><p class=yiv75235976msonormal><span style='font-family:"Courier New ;","serif"'> </span><o:p></o:p></p><p class=yiv75235976msonormal><span style='font-family:"Courier New"'>Question: What is the best way to handle this? I wish the spatial_ref_sys table came with all the ESRI and other SRID definitions. </span><o:p></o:p></p><p class=yiv75235976msonormal><span style='font-family:"Courier New"'> </span><o:p></o:p></p><p class=yiv75235976msonormal><span style='font-family:"Courier New"'>Suggestions are much appreciated!</span><o:p></o:p></p><p class=yiv75235976msonormal> <o:p></o:p></p><p class=yiv75235976msonormal>Best regards,<o:p></o:p></p><p class=yiv75235976msonormal>Martin<o:p></o:p></p><p class=yiv75235976msonormal> <o:p></o:p></p><p class=yiv75235976msonormal> <o:p></o:p></p></div></div></div><p class=MsoNormal style='margin-bottom:12.0pt'><br>-----Inline Attachment Follows-----<o:p></o:p></p><div><p class=MsoNormal>_______________________________________________<br>gdal-dev mailing list<br><a href="/mc/compose?to=gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br><a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><o:p></o:p></p></div></td></tr></table><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Calibri","sans-serif"'><o:p> </o:p></span></p></div></body></html>