function GoArcGIS( X, Y: Double; Catalog, MapService, MapLayer, FieldName: String ): String; /// You can try calling this function with the following values: /// 1945785.00909788, 715764.111071926, '', var pConnection: TArcGISServer; pGeocodedPt: TAGSPoint; pCatalog: TAGSCatalog; pMapService: TAGSMapService; pBriefLayer: TAGSBriefLayer; pMapLayer: TAGSLayerOrTable; pQueryResults: TAGSFeatureSet; bFound: Boolean; const ServerProtocol = 'http'; ServerHost = 'sampleserver1.arcgisonline.com'; ArcGISServerInstance = 'ArcGIS'; begin //Initializations to keep the compiler happy since I'm calling Free in the finally clause pCatalog := nil; pMapService := nil; pMapLayer := nil; pQueryResults := nil; pConnection := TArcGISServer.Create( nil ); pGeocodedPt := TAGSPoint.Create; pGeocodedPt.X := X; pGeocodedPt.Y := Y; pGeocodedPt.SpatialReference.Wkid := 32043; //NAD 27 Utah Central try pCatalog := pConnection.GetCatalog( ServerProtocol, ServerHost, ArcGISServerInstance, Catalog ); if pCatalog = nil then Result := '' else begin pMapService := pCatalog.GetMapService( pConnection, MapService ); if pMapService = nil then Result := '' else begin bFound := False; for pBriefLayer in pMapService.Layers do if not bFound and ( pBriefLayer.Name = MapLayer ) then begin bFound := True; pMapLayer := pMapService.GetLayerOrTable( pConnection, pBriefLayer.Id ); if pMapLayer = nil then Result := '' else begin pQueryResults := pMapLayer.Query( pConnection, '', pGeocodedPt, nil, esriSpatialRelIntersects, '', '', '', FieldName, False ); if pQueryResults = nil then Result := '' else if pQueryResults.Features.Count = 0 then Result := '' else if pQueryResults.Features[ 0 ].Attributes = nil then Result := '' else if not pQueryResults.Features[ 0 ].Attributes.ContainsKey( FieldName ) then Result := '' else Result := pQueryResults.Features[ 0 ].Attributes[ FieldName ]; end; end; if not bFound then Result := ''; end; end; finally pConnection.Free; pGeocodedPt.Free; pCatalog.Free; pMapService.Free; pMapLayer.Free; pQueryResults.Free; end; end;
GoArcGIS( 1945785.00909788, 715764.111071926, 'Specialty', 'ESRI_StateCityHighway_USA', 'counties', 'NAME' );
Hi
Has anything been done with the API, am interested in putting a map onto a desktop application from my ArcGIS Server services.
I have not pursued this any further, I apologize. If you are wanting to put a map into a Delphi application, probably just use a TWebBrowser. Other than that, I can't think of what else you'd do.
I still have four stupid programs that run on MapObjects. Since direct connect has not been supported for some time now, I am not sure what I will do once ArcSDE no longer provides service connections. I was hoping to rewrite those internal applications using ArcGIS Server in Delphi, but I keep getting other projects to start and finish. What I will very likely do is have a nightly export of shapefiles from ArcSDE and have my MapObjects programs connect to those. Stink.
"Roj"