Wednesday, September 10, 2014

Tips to interact with Astro’s WMS maps

As we plan to retire the original Map-a-Planet (MAP) website there will be aspects from the original website that will not be able in the new MAP2 website. The first aspect is that not every layer will be available as an interactive layer. As a substitution for some simple interactive manipulation, we still have our live mapping services (called Web Mapping Services, WMS). Most bases available in MAP2 will also be available from here http://astrodocs.wr.usgs.gov/index.php/Webservices or they are also listed in the Esri GIS portal (still being updated). 


 These live layers are used in many of our web applications and thus viewable from there including our Planetary Nomenclature, PILOT, Geologic Mapping sites, etc. Example (Aram Chaos on Mars). But they are also ideal for use in web mapping apps like OpenLayers and GISs like QGIS, ArcMap, or ENVI. And you can even build custom images from a simple browser call or using apps like GDAL (gdal_translate).
 

For a simple interactive image request, again from any layer listed above you can type this into any browser and modify at will. HTML example (just click to test):
http://planetarymaps.usgs.gov/cgi-bin/mapserv?map=/maps/mars/mars_simp_cyl.map&SERVICE=WMS&VERSION=1.1.1&SRS=EPSG:4326&STYLES=&REQUEST=GetMap&FORMAT=image%2Fjpeg&LAYERS=MDIM21&BBOX=221,15,231,25&WIDTH=1000&HEIGHT=1000
To change the request, pay attention to these keywords:


For GDAL see our tips page for installing and the GDAL wms page for more (also related). See the xml text below (or on Git) for a Mars MDIM21 example (again customize the address and layer names from the listing above). Using the XML block you can run this below:
> gdal_translate -of PNG gdal_MDIM21.xml mdim21_out.png

File: gdal_MDIM21.xml
<GDAL_WMS>
  <Service name="WMS">
    <Version>1.1.1</Version>
    <ServerUrl>http://planetarymaps.usgs.gov/cgi-bin/mapserv?map=/maps/mars/mars_simp_cyl.map</ServerUrl>
    <SRS>EPSG:4326</SRS>
    <ImageFormat>image/jpeg</ImageFormat>
    <Layers>MDIM21</Layers>
  </Service>
  <DataWindow>
    <UpperLeftX>280</UpperLeftX>
    <UpperLeftY>45</UpperLeftY>
    <LowerRightX>290</LowerRightX>
    <LowerRightY>35</LowerRightY>
     <SizeX>1000</SizeX>
     <SizeY>1000</SizeY>
  </DataWindow>
  <Projection>EPSG:4326</Projection>
  <BandsCount>3</BandsCount>
  <DataType>Byte</DataType>
</GDAL_WMS>



In QGIS you can add a "WMS" layer and copy this example "get capabilities" linked in from the page above. Then you can pick one or more of the available layers:
http://planetarymaps.usgs.gov/cgi-bin/mapserv?map=/maps/earth/moon_simp_cyl.map&service=WMS&request=GetCapabilities

By default, if added first, these layers will think the are on Earth. But if you define the QGIS project using the built-in planetary projections for the Moon, Mars, or other and allow projection-on-the-fly, they will behave appropriately.


Lastly, using our planetary extensions within OpenLayers, you can easily make your own web maps using these same services. Copy and edit this example html document with the layers from above (see this page live). Once tweaked, feel free to host in your own website.

Other clients work too - mash it Earth's weather on Mars...

Hope this helps,
Trent

2 comments:

  1. I've created @MagellanVenus using this service, thanks! https://twitter.com/MagellanVenus

    ReplyDelete
  2. Thank you for providing the best information.I can sure this can help me to update my knowledge.This can help me to crack GIS Jobs in Hyderabad.

    ReplyDelete