Select to view content in your preferred language

Problem using GeometryService.project with outSR in wkt

1328
3
04-11-2011 04:40 AM
RavindraSoman
Emerging Contributor
I want to project polygons from SR 102100 to SR of my featurelayer which is defined using wkt. but when i use project method and pass SR of feature layer as outSR, it gives a fault with message "Unexpected end of input".

It is happening only with when i define SR using wkt. With wkid, it works just fine.

any idea what am i doing wrong?
Tags (2)
0 Kudos
3 Replies
MehulChoksey
Esri Contributor
What wkt you are using?
0 Kudos
RavindraSoman
Emerging Contributor
Hi mehu11111,

this is the wkt that I am using:

PROJCS["NAD_1983_HARN_StatePlane_Illinois_East_FIPS_1201",GEOGCS["GCS_North_American_1983_HARN",DATUM["D_North_American_1983_HARN",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",984250.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-88.33333333333333],PARAMETER["Scale_Factor",0.999975],PARAMETER["Latitude_Of_Origin",36.66666666666666],UNIT["Foot_US",0.3048006096012192]]


One more thing I noticed yesterday is that this problem is only occurring in Firefox. It is working fine in IE and Chrome. In Firefox also, the request url that is generated in project operation returns a successful response when you request it for the second time.

steps to reproduce:

1. Execute geometry project operation in flex using above wkt as outSR and 102100 as inSR in firefox.
2. Use firebug addon to capture the Url that is generated
3. Copy and paste url in new tab in firefox and hit Enter. Notice no result is displayed this time
4. Do not refresh the page. Select the url in address bar and hit Enter.
5. You get a successful response containing projected geometries in 4326 wkid.

This is the url that gets generated during project operation:

http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer/project?inSR=1021...

Copy above url and load it in IE, firefox and Chrome. It doesn't work in firefox but works in IE and chrome.

Note: my firefox version is 3.6.16

- Ravindra
0 Kudos
MehulChoksey
Esri Contributor
Working for me in FF using the sample below. Could you try the sample below to see if it works for you?
Note that i have used the same values for the polygon that you have provided.
What version of Flash player are you using? is the flash player on FF a debug version?

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:esri="http://www.esri.com/2008/ags"
               xmlns:s="library://ns.adobe.com/flex/spark"
               pageTitle="Project a point">
    
    <s:layout>
        <s:VerticalLayout paddingBottom="15"
                          paddingLeft="15"
                          paddingRight="15"
                          paddingTop="15"/>
    </s:layout>

    <fx:Script>
        <![CDATA[
            import com.esri.ags.Graphic;
            import com.esri.ags.SpatialReference;
            import com.esri.ags.events.GeometryServiceEvent;
            import com.esri.ags.geometry.Geometry;
            import com.esri.ags.geometry.MapPoint;
            import com.esri.ags.geometry.Polygon;
            
            import mx.controls.Alert;
            
            private function projectNow():void
            {
                //var outSR:SpatialReference = new SpatialReference(wkid.selectedItem.data);
                // Note: GeometryService takes in geometries instead of graphics as input
                var geomPolygon:Polygon = new Polygon(
                    [[new MapPoint(-12480617.814858563,4396253.404548177),
                      new MapPoint(-12480532.062067455,4396095.992043047),
                      new MapPoint(-12480770.688915139,4396100.530491602),
                      new MapPoint(-12480617.814858563,4396253.404548177)]],new SpatialReference(102100))
                
                
                var outSR:SpatialReference = new SpatialReference(NaN,'PROJCS["NAD_1983_HARN_StatePlane_Illinois_East_FIPS_1201",GEOGCS["GCS_North_American_1983_HARN",DATUM["D_North_American_1983_HARN",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",984250.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-88.33333333333333],PARAMETER["Scale_Factor",0.999975],PARAMETER["Latitude_Of_Origin",36.66666666666666],UNIT["Foot_US",0.3048006096012192]]');
                fromTxt.text = "";
                fromTxt.text = geomPolygon.toString();
                geometryService.project([ geomPolygon as Geometry ], outSR);
            }

            private function projectCompleteHandler(event:GeometryServiceEvent):void
            {
                try
                {
                     fromTxt.text+= event.result.toString();
                    
                    
                }
                catch (error:Error)
                {
                    Alert.show(error.toString());
                }
            }

            private function onFault(info:Object, token:Object = null):void
            {
                Alert.show(info.toString());
            }

            

            protected function button1_clickHandler(event:MouseEvent):void
            {
               projectNow();
            }

        ]]>
    </fx:Script>

    <fx:Declarations>
        <esri:GeometryService id="geometryService"
                              concurrency="last"
                              fault="onFault(event)"
                              projectComplete="projectCompleteHandler(event)"
                              url="http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer"/>
    </fx:Declarations>
    
    <s:VGroup width="100%" height="100%" >
      
    <esri:Map wrapAround180="true"  id="myMap" >
        <esri:extent>
            <esri:Extent id="lower48"
                         xmin="-14305000" ymin="2748000" xmax="-6815000" ymax="7117000">
                <esri:SpatialReference wkid="102100"/>
            </esri:Extent>
        </esri:extent>
        <esri:ArcGISTiledMapServiceLayer url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"/>
        <esri:GraphicsLayer id="myGraphicsLayer">
            <esri:symbol>
                <!-- Symbol to clearly mark the point to be projected -->
                <esri:SimpleMarkerSymbol alpha="0.9"
                                         color="0xFFFF00"
                                         size="12"
                                         style="square">
                    <esri:SimpleLineSymbol color="0x000000"/>
                </esri:SimpleMarkerSymbol>
            </esri:symbol>
        </esri:GraphicsLayer>
    </esri:Map>
        <s:Button label="Project" click="button1_clickHandler(event)" />
        <s:Scroller id="scroller"
                    left="0" right="0" top="0" bottom="0"
                    hasFocusableChildren="false"
                    measuredSizeIncludesScrollBars="false"
                    minViewportInset="1">
            <!--- @copy spark.components.supportClasses.SkinnableTextBase#textDisplay -->
            <s:RichEditableText id="fromTxt"
                                heightInLines="10"
                                widthInChars="50"/>
        </s:Scroller>
       

</s:VGroup>         
</s:Application>

0 Kudos