[gdal-dev] Missing EPSG Codes and importFromUrl

Howard Butler hobu.inc at gmail.com
Fri Feb 3 09:09:10 EST 2012


Caveats about importFromUrl:

* It only can consume http://, not https://
* It adds Accept: application/x-ogcwkt to the headers, and so the server can respond with that data
* It simply fetches the data from the URL and hands it off to SetFromUserInput, which is OSR's swiss army knife of SRS consumption.

Neither epsg-registry.org nor georepository.com return a simple text string of OGC WKT [1], and so there is no way for SetFromUserInput to be able to consume the data once cUrl fetches it.  You either need to find a URL on these websites that returns (plain) data that SetFromUserInput can ultimately consume, or modify these websites to respond to the Accept: header and return data accordingly.

[1] http://spatialreference.org/ref/epsg/4326/ogcwkt/

As far as EPSG:4418 is concerned, spatialreference.org doesn't have it, though it appears to just be NAD 27 UTM 10N with feet instead of meters for the units. You should be able to craft this by modifying things directly using the OSR module of the SWIG bindings.  The reason why 4418 isn't in spatialreference.org is most likely because it is pretty new, and spatialreference.org hasn't been updated with a new EPSG database in a while.

Here's some Python that might demonstrate how to get what you want... 

> href = osr.SpatialReference()
> href.ImportFromEPSG(26710)  # Import the NAD27 UTM variant, and then we'll change the units
> href.SetTargetLinearUnits("PROJCS", "U.S. Foot",  0.3048006096012)
> href.SetAuthority("UNIT", "EPSG", 9003)

Howard


On Feb 3, 2012, at 6:19 AM, David Baker (Geoscience) wrote:

> Andy,
>  
> Great reference!  Thanks for the info.  But, when I execute the line:
>  
> var i = src.ImportFromUrl(@"http://georepository.com/search/by-name/?query=4418");
>  
> I get an error 6 of 6.  This gets back to my second question, can, and if so, how does one call on a URL to get the parameter info ?
>  
> Thanks,
> David
>  
> From: gdal-dev-bounces at lists.osgeo.org [mailto:gdal-dev-bounces at lists.osgeo.org] On Behalf Of Andy Cheetham
> Sent: Friday, February 03, 2012 1:45 AM
> To: gdal-dev at lists.osgeo.org
> Subject: Re: [gdal-dev] Missing EPSG Codes and importFromUrl
>  
> You could try our website the GeoRepository.com
> 
> It will provide you with all the details of the CRS in question
> 
> http://georepository.com/search/by-name/?query=4418
> 
> Hope this helps
> 
> Andy Cheetham
> 
> On 2 Feb 2012 23:33, "David Baker (Geoscience)" <david.m.baker at chk.com> wrote:
> All,
>  
> Working in C#...  I have need for EPSG:4418. Per http://www.epsg-registry.org/ this is the code for “ProjectedCRS [NAD27 / BLM 18N (ftUS)]”.  This code does not seem to be in the GDAL/OGR/Prog4 database in FWTools2.4.7.  Executing the line:
>  
> var i = src.ImportFromEPSG(4418);
>  
> This call returns an error indicating the code is invalid.  I also searched the /data directory for this projection but was not able to find it.  So my next move was to try:
>  
> var i = src.ImportFromUrl(@"http://www.epsg-registry.org/export.htm?gml=urn:ogc:def:crs:EPSG::4410");
>  
> This did not work either.
>  
> So my general question is, for missing CRS’s how does one retrieve the projection information from the web?
>  
> Thanks in Advance,
> David
>  
> David M. Baker
> Senior Advisor – Geoscience Technology
> Chesapeake Energy Corporation
> 405-935-3715 office
> 405-496-5373 cell
> david.m.baker at chk.com
>  
>  
> 
> This email (and attachments if any) is intended only for the use of the individual or entity to which it is addressed, and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If the reader of this email is not the intended recipient, or the employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by return email and destroy all copies of the email (and attachments if any).
> 
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
> 
> 
> This email (and attachments if any) is intended only for the use of the individual or entity to which it is addressed, and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If the reader of this email is not the intended recipient, or the employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by return email and destroy all copies of the email (and attachments if any).
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev



More information about the gdal-dev mailing list