Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mapinfo projection definitions are missing in export #200

Open
EPSGMapinfo opened this issue Aug 1, 2024 · 1 comment
Open

Mapinfo projection definitions are missing in export #200

EPSGMapinfo opened this issue Aug 1, 2024 · 1 comment

Comments

@EPSGMapinfo
Copy link

MapInfo projection definitions export as variant is missing in list.
Developers need these definitions quite often.

Please, add them.

@TomPohys
Copy link
Member

Hi, Could you please point out what the format looks like, where is the definition or documentation? All the exports are in app.py:

epsg.io/app.py

Lines 805 to 827 in e0008ce

export['prettywkt'] = ref.ExportToPrettyWkt()
if int(error_code) == 0:
export['usgs'] = str(ref.ExportToUSGS())
if "(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)" in export['usgs']:
export['usgs'] = ""
export['ogcwkt'] = ref.ExportToWkt()
export['proj4'] = ref.ExportToProj4()
export['html'] = highlight(ref.ExportToPrettyWkt(), WKTLexer(), HtmlFormatter(cssclass='syntax',nobackground=True))
#if correct export, then it is string, if error then return 7
if ref.ExportToXML() != 7 :
export['xml'] = '<?xml version="1.0" encoding="UTF-8"?>\n %s' % (ref.ExportToXML().replace(">",' xmlns:gml="http://www.opengis.net/gml/3.2">',1))
xml_highlight = highlight(export['xml'], XmlLexer(), HtmlFormatter(cssclass='syntax',nobackground=True))
else:
export['xml'] = ""
xml_highlight = "NOT AVAILABLE"
export['mapfile'] = 'PROJECTION\n\t'+'\n\t'.join(['"'+l.lstrip('+')+'"' for l in ref.ExportToProj4().split()])+'\nEND' ### CSS: white-space: pre-wrap
proj4 = ref.ExportToProj4().strip()
export['proj4js'] = '%s("%s:%s","%s");' % ("proj4.defs", type_epsg, code, proj4)
export['mapnik'] = '<?xml version="1.0" encoding="utf-8"?>\n<Map srs="%s">\n\t<Layer srs="%s">\n\t</Layer>\n</Map>' % (proj4,proj4)
export['mapserverpython'] = "wkt = '''%s'''\nm = mapObj('')\nm.setWKTProjection(ref.ExportToWkt())\nlyr = layerObj(m)\nlyr.setWKTProjection(ref.ExportToWkt())" % (ref.ExportToWkt()) #from mapscript import mapObj,layerObj\n
export['mapnikpython'] = "proj4 = '%s'\nm = Map(256,256,proj4)\nlyr = Layer('Name',proj4)" % (proj4) #from mapnik import Map, Layer\n
export['geoserver'] = "%s=%s" % (code,ref.ExportToWkt()) # put this custom projection in the 'user_projections' file inside the GEOSERVER_DATA_DIR '\n' # You can further work with your projections via the web admin tool.\n
export['postgis'] = 'INSERT into spatial_ref_sys (srid, auth_name, auth_srid, proj4text, srtext) values ( %s, \'%s\', %s, \'%s\', \'%s\');' % (item['code'], type_epsg, item['code'], ref.ExportToProj4(), ref.ExportToWkt())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants