<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><br>Hi Martin,<br><br>I can't see why that won't work, but it does have one issue, and that is that if there is already a match, but the parameters are in a different order, you won't find it, & then you are effectively creating a nonstandard SRID which duplicates a standard & supported projection. <br><br>Which doesn't stop it working for your case.<br><br>And I don't believe there are any orthographic projecttions in Postgis at present, so it is a potential problem only for now.<br><br>Cheers,<br><br> Brent<br><br>--- On <b>Sat, 2/11/12, Martin Chapman <i><chapmanm@pixia.com></i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: Martin Chapman <chapmanm@pixia.com><br>Subject: RE: [gdal-dev] PostGIS SRID conundrum<br>To: pcreso@pcreso.com<br>Cc:
gdal-dev@lists.osgeo.org<br>Date: Saturday, February 11, 2012, 6:48 PM<br><br><div id="yiv704304299"><style><!--
#yiv704304299
_filtered #yiv704304299 {font-family:Wingdings;panose-1:5 0 0 0 0 0 0 0 0 0;}
_filtered #yiv704304299 {font-family:"Cambria Math";panose-1:2 4 5 3 5 4 6 3 2 4;}
_filtered #yiv704304299 {font-family:Calibri;panose-1:2 15 5 2 2 2 4 3 2 4;}
_filtered #yiv704304299 {font-family:Tahoma;panose-1:2 11 6 4 3 5 4 4 2 4;}
_filtered #yiv704304299 {panose-1:0 0 0 0 0 0 0 0 0 0;}
#yiv704304299
#yiv704304299 p.yiv704304299MsoNormal, #yiv704304299 li.yiv704304299MsoNormal, #yiv704304299 div.yiv704304299MsoNormal
        {margin:0in;margin-bottom:.0001pt;font-size:12.0pt;font-family:"serif";}
#yiv704304299 a:link, #yiv704304299 span.yiv704304299MsoHyperlink
        {color:blue;text-decoration:underline;}
#yiv704304299 a:visited, #yiv704304299 span.yiv704304299MsoHyperlinkFollowed
        {color:purple;text-decoration:underline;}
#yiv704304299 p.yiv704304299MsoListParagraph, #yiv704304299 li.yiv704304299MsoListParagraph, #yiv704304299 div.yiv704304299MsoListParagraph
        {margin-top:0in;margin-right:0in;margin-bottom:0in;margin-left:.5in;margin-bottom:.0001pt;font-size:12.0pt;font-family:"serif";}
#yiv704304299 p.yiv704304299msonormal, #yiv704304299 li.yiv704304299msonormal, #yiv704304299 div.yiv704304299msonormal
        {margin-right:0in;margin-left:0in;font-size:12.0pt;font-family:"serif";}
#yiv704304299 p.yiv704304299msochpdefault, #yiv704304299 li.yiv704304299msochpdefault, #yiv704304299 div.yiv704304299msochpdefault
        {margin-right:0in;margin-left:0in;font-size:12.0pt;font-family:"serif";}
#yiv704304299 span.yiv704304299msohyperlink
        {}
#yiv704304299 span.yiv704304299msohyperlinkfollowed
        {}
#yiv704304299 span.yiv704304299emailstyle17
        {}
#yiv704304299 p.yiv704304299msonormal1, #yiv704304299 li.yiv704304299msonormal1, #yiv704304299 div.yiv704304299msonormal1
        {margin:0in;margin-bottom:.0001pt;font-size:11.0pt;font-family:"sans-serif";}
#yiv704304299 span.yiv704304299msohyperlink1
        {color:blue;text-decoration:underline;}
#yiv704304299 span.yiv704304299msohyperlinkfollowed1
        {color:purple;text-decoration:underline;}
#yiv704304299 span.yiv704304299emailstyle171
        {font-family:"sans-serif";color:windowtext;}
#yiv704304299 p.yiv704304299msochpdefault1, #yiv704304299 li.yiv704304299msochpdefault1, #yiv704304299 div.yiv704304299msochpdefault1
        {margin-right:0in;margin-left:0in;font-size:12.0pt;font-family:"sans-serif";}
#yiv704304299 span.yiv704304299EmailStyle27
        {font-family:"sans-serif";color:#1F497D;}
#yiv704304299 .yiv704304299MsoChpDefault
        {}
_filtered #yiv704304299 {margin:1.0in 1.0in 1.0in 1.0in;}
#yiv704304299 div.yiv704304299WordSection1
        {}
#yiv704304299
_filtered #yiv704304299 {}
_filtered #yiv704304299 {}
_filtered #yiv704304299 {}
_filtered #yiv704304299 {}
_filtered #yiv704304299 {}
_filtered #yiv704304299 {}
_filtered #yiv704304299 {}
_filtered #yiv704304299 {}
_filtered #yiv704304299 {}
_filtered #yiv704304299 {}
#yiv704304299 ol
        {margin-bottom:0in;}
#yiv704304299 ul
        {margin-bottom:0in;}
--></style><div><div class="yiv704304299WordSection1"><p class="yiv704304299MsoNormal"><span style="font-size:11.0pt;font-family:"sans-serif";color:#1F497D;">Brent,</span></p><p class="yiv704304299MsoNormal"><span style="font-size:11.0pt;font-family:"sans-serif";color:#1F497D;"> </span></p><p class="yiv704304299MsoNormal"><span style="font-size:11.0pt;font-family:"sans-serif";color:#1F497D;">Thank you very much for the advice. What I resorted to (at least for the present) is:</span></p><p class="yiv704304299MsoNormal"><span style="font-size:11.0pt;font-family:"sans-serif";color:#1F497D;"> </span></p><p class="yiv704304299MsoListParagraph" style=""><span style="font-size:11.0pt;font-family:"sans-serif";color:#1F497D;"><span style="">1.<span style="font:7.0pt "Times New Roman";"> </span></span></span><span
style="font-size:11.0pt;font-family:"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.</span></p><p class="yiv704304299MsoListParagraph" style=""><span style="font-size:11.0pt;font-family:"sans-serif";color:#1F497D;"><span style="">2.<span style="font:7.0pt "Times New Roman";"> </span></span></span><span style="font-size:11.0pt;font-family:"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.</span></p><p class="yiv704304299MsoListParagraph" style=""><span
style="font-size:11.0pt;font-family:"sans-serif";color:#1F497D;"><span style="">3.<span style="font:7.0pt "Times New Roman";"> </span></span></span><span style="font-size:11.0pt;font-family:"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.</span></p><p class="yiv704304299MsoListParagraph" style=""><span style="font-size:11.0pt;font-family:"sans-serif";color:#1F497D;"><span style="">4.<span style="font:7.0pt "Times New Roman";"> </span></span></span><span style="font-size:11.0pt;font-family:"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:"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.</span></p><p class="yiv704304299MsoNormal"><span style="font-size:11.0pt;font-family:"sans-serif";color:#1F497D;"> </span></p><p class="yiv704304299MsoNormal"><span style="font-size:11.0pt;font-family:"sans-serif";color:#1F497D;">If you or anyone else can see any flaws in that logic I would appreciate some criticism.</span></p><p class="yiv704304299MsoNormal"><span style="font-size:11.0pt;font-family:"sans-serif";color:#1F497D;"> </span></p><p class="yiv704304299MsoNormal"><span
style="font-size:11.0pt;font-family:"sans-serif";color:#1F497D;">Thanks again for your feedback!</span></p><p class="yiv704304299MsoNormal"><span style="font-size:11.0pt;font-family:"sans-serif";color:#1F497D;"> </span></p><p class="yiv704304299MsoNormal"><span style="font-size:11.0pt;font-family:"sans-serif";color:#1F497D;">Best regards,</span></p><p class="yiv704304299MsoNormal"><span style="font-size:11.0pt;font-family:"sans-serif";color:#1F497D;">Martin</span></p><p class="yiv704304299MsoNormal"><span style="font-size:11.0pt;font-family:"sans-serif";color:#1F497D;"> </span></p><p class="yiv704304299MsoNormal"><b><span style="font-size:10.0pt;font-family:"sans-serif";">From:</span></b><span style="font-size:10.0pt;font-family:"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</span></p><p class="yiv704304299MsoNormal"> </p><table class="yiv704304299MsoNormalTable" cellpadding="0" cellspacing="0" border="0"><tbody><tr><td style="padding:0in 0in 0in 0in;" valign="top"><p class="yiv704304299MsoNormal">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 rel="nofollow" target="_blank" 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 rel="nofollow" ymailto="mailto:chapmanm@pixia.com" target="_blank" href="/mc/compose?to=chapmanm@pixia.com">chapmanm@pixia.com</a>></i></b> wrote:</p><p class="yiv704304299MsoNormal" style="margin-bottom:12.0pt;"><br>From: Martin Chapman <<a rel="nofollow" ymailto="mailto:chapmanm@pixia.com" target="_blank" href="/mc/compose?to=chapmanm@pixia.com">chapmanm@pixia.com</a>><br>Subject: [gdal-dev] PostGIS SRID conundrum<br>To: <a rel="nofollow" ymailto="mailto:gdal-dev@lists.osgeo.org"
target="_blank" href="/mc/compose?to=gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>Date: Saturday, February 11, 2012, 12:25 PM</p><div id="yiv704304299"><div><div><p class="yiv704304299msonormal">I know this question isn’t exactly related to GDAL but I thought someone on the list might be able to answer this question.</p><p class="yiv704304299msonormal"> </p><p class="yiv704304299msonormal">So, I have a shape file that has the following spatial reference:</p><p class="yiv704304299msonormal"> </p><p class="yiv704304299msonormal"><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></p><p class="yiv704304299msonormal"><span style="font-family:"Courier New";"> </span></p><p class="yiv704304299msonormal"><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></p><p class="yiv704304299msonormal"><span style="font-family:"serif";"> </span></p><p class="yiv704304299msonormal"><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></p><p class="yiv704304299msonormal"><span style="font-family:"Courier New";"> </span></p><p class="yiv704304299msonormal"><span style="font-family:"Courier New";">Suggestions are much appreciated!</span></p><p class="yiv704304299msonormal"> </p><p class="yiv704304299msonormal">Best regards,</p><p class="yiv704304299msonormal">Martin</p><p class="yiv704304299msonormal"> </p><p class="yiv704304299msonormal"> </p></div></div></div><p class="yiv704304299MsoNormal" style="margin-bottom:12.0pt;"><br>-----Inline Attachment
Follows-----</p><div><p class="yiv704304299MsoNormal">_______________________________________________<br>gdal-dev mailing list<br><a rel="nofollow">gdal-dev@lists.osgeo.org</a><br><a rel="nofollow" target="_blank" href="http://lists.osgeo.org/mailman/listinfo/gdal-dev">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a></p></div></td></tr></tbody></table><p class="yiv704304299MsoNormal"><span style="font-size:10.0pt;font-family:"sans-serif";"> </span></p></div></div></div></blockquote></td></tr></table>