Support for Shapefiles and Rasters

2862
7
Jump to solution
10-28-2013 01:33 PM
Labels (1)
DarrenRempel
New Contributor III
If I use the ArcGIS Runtime SDK for WPF Samples demo application to load a .bmp raster image that has WGS84 as the spatial reference - it does NOT display the raster image.  If I take the same image and change the projection to WGS84 World Mercator Auxiliary or even NAD83 - it loads just fine.  Why is this happening and how can I fix it?  Is there any documentation on what is supported?  It is just geographic projections that are not supported?
0 Kudos
1 Solution

Accepted Solutions
MichaelBranscomb
Esri Frequent Contributor
Hi,

I can confirm that rasters in other formats and in geographic coordinate systems do work. However, the examples I have do not have PRJ files - the spatial reference info is stored in the raster auxiliary file (.aux.xml). This file was introduced during ArcGIS 9.2 for storing additional raster information (http://resources.arcgis.com/en/help/main/10.2/index.html#//009t00000027000000).

To get your sample Bitmap to display in the sample app (and to display in ArcMap too), I had to run the Define Projection GP tool in ArcMap and provide the spatial reference. This generated a new .aux.xml file and the raster now successfully displays.

testMap.bmp.aux.xml:
<PAMDataset>
  <SRS>GEOGCS[&quot;GCS_WGS_1984&quot;,DATUM[&quot;WGS_1984&quot;,SPHEROID[&quot;WGS_1984&quot;,6378137.0,298.257223563]],PRIMEM[&quot;Greenwich&quot;,0.0],UNIT[&quot;Degree&quot;,0.0174532925199433]]</SRS>
</PAMDataset>


Cheers

Mike

View solution in original post

0 Kudos
7 Replies
MichaelBranscomb
Esri Frequent Contributor
Hi,

Both projected and geographic coordinate systems are supported. The list of supported coordinate systems can be found at http://resources.arcgis.com/en/help/runtime-wpf/concepts/index.html#/Coordinate_system_identifiers/0....

The raster in WGS84 should work fine. The setup in this sample is that the local map service being used to display the raster is running in WGS84 (determined by source Map Package), whilst the spatial reference of the map is Web Mercator Auxiliary Sphere (determined in this scenario by the first layer in the map). Therefore the local map service is performing the reprojection and is reprojecting the layers on the fly and rendering the map in the requested spatial reference.

If you have a small sample of the bitmap - you could upload to this thread and I'll give it a test.

Cheers

Mike
0 Kudos
DarrenRempel
New Contributor III
Mike,

Attached is the sample file. 

Darren
0 Kudos
DarrenRempel
New Contributor III
Hi,

If you have a small sample of the bitmap - you could upload to this thread and I'll give it a test.

Cheers

Mike



Mike - did you have a chance to look at the sample I uploaded?

thanks,

Darren
0 Kudos
MichaelBranscomb
Esri Frequent Contributor
Hi,

Apologies for the delay in replying. I've been looking into this - there may be two issues. When I open the raster sample you provided in ArcMap, it warns of an inconsistent extent for the spatial reference, and won't overlay with any data in ArcMap either. I can confirm that with a suitable raster dataset, they are reprojected on the fly by the localserver.

However I also noticed a possible bug in our sample - whether you choose a vector dataset or a raster dataset the way the sample is written it will always submit a renderer which may possibly confuse matters (

You should modify the code to perform a check for the workspace type first and only define a renderer if it's a vector dataset e.g.:

// Use the GetDetails method which now supports dynamic data sources to determine the geometry type of the new datasource
if (workspaceInfo.FactoryType != WorkspaceFactoryType.Raster)
{
    arcGisLocalDynamicMapServiceLayer.GetDetails(dynamicLayerInfo.ID, (featureLayerInfo, exception) =>
    {
        ...
    });
}

Cheers

Mike
0 Kudos
DarrenRempel
New Contributor III
It would appear to me from my testing that any rasters other than geotiffs that are in Geographic projection are NOT supported.  When I generate a WGS 84 .proj file from ESRI ArcMap it contains:
GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433],AUTHORITY["EPSG",4326]]

ESRI runtime will only process rasters that also include the specification of the projection.  For example,
PROJCS["UTM_Zone_11_Northern_Hemisphere",GEOGCS["GCS_WGS_1984",DATUM["D_WGS84",SPHEROID["WGS84",6378137,298.257223560493]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",-117],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],UNIT["Meter",1]]

Same goes for ArcMap.  If anyone has an example of a jpeg, png, or jpeg that is spatially referenced in Geographic projection and loads successfully in ESRI runtime or ArcMap - I would greatly appreciate seeing the expected .prj file format.
0 Kudos
MichaelBranscomb
Esri Frequent Contributor
Hi,

I can confirm that rasters in other formats and in geographic coordinate systems do work. However, the examples I have do not have PRJ files - the spatial reference info is stored in the raster auxiliary file (.aux.xml). This file was introduced during ArcGIS 9.2 for storing additional raster information (http://resources.arcgis.com/en/help/main/10.2/index.html#//009t00000027000000).

To get your sample Bitmap to display in the sample app (and to display in ArcMap too), I had to run the Define Projection GP tool in ArcMap and provide the spatial reference. This generated a new .aux.xml file and the raster now successfully displays.

testMap.bmp.aux.xml:
<PAMDataset>
  <SRS>GEOGCS[&quot;GCS_WGS_1984&quot;,DATUM[&quot;WGS_1984&quot;,SPHEROID[&quot;WGS_1984&quot;,6378137.0,298.257223563]],PRIMEM[&quot;Greenwich&quot;,0.0],UNIT[&quot;Degree&quot;,0.0174532925199433]]</SRS>
</PAMDataset>


Cheers

Mike
0 Kudos
DarrenRempel
New Contributor III
Mike,

Thanks!
0 Kudos