Code Monkey home page Code Monkey logo

arcgis.pcl's People

Contributors

bertt avatar davetimmins avatar jberke avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arcgis.pcl's Issues

Add "objectIds" member to Query

It would be useful to include this property ObjectIds as comma delimited string.
Do you think that adding the following code to Query class can work?
[DataMember(Name = "objectIds")]
public String ObjectIds { get; set; }

Use retry for integration tests

Sometimes the integration tests fail as they reference ArcGIS server services that have gone idle and therefore fail trying to access them (this is a known AGS issue with older versions of server). Rather than trying to look for new services to test against we can use https://github.com/giggio/xunit-retry for these tests.

Add ability to Query without knowing the geometry type

Often times as we run various rules, we need to get the geometry for sole reason to pass it to another query. At that time we do not know the geometry type nor do we care what it is. Would it be possible to have a Query method that does not specify type of geometry?

For now I created a workaround via custom serializer as a proof that the feature is doable. I pasted the class below

`using System;
using System.CodeDom;
using System.Collections.Generic;
using System.Linq;
using ArcGIS.ServiceModel;
using ArcGIS.ServiceModel.Common;
using ArcGIS.ServiceModel.Operation;
using Newtonsoft.Json.Linq;

namespace ArcGisIntegration.Services
{
public class ArcGisSerializer : ISerializer
{
private static ISerializer _serializer = null;

    public static void Init(Newtonsoft.Json.JsonSerializerSettings settings = null)
    {
        _serializer = new ArcGisSerializer(settings);
        SerializerFactory.Get = (() => _serializer ?? new ArcGisSerializer(settings));
    }

    private readonly Newtonsoft.Json.JsonSerializerSettings _settings;

    public ArcGisSerializer(Newtonsoft.Json.JsonSerializerSettings settings = null)
    {
        _settings = settings ?? new Newtonsoft.Json.JsonSerializerSettings
        {
            NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
            MissingMemberHandling = Newtonsoft.Json.MissingMemberHandling.Ignore,
            StringEscapeHandling = Newtonsoft.Json.StringEscapeHandling.EscapeHtml,
            TypeNameHandling = Newtonsoft.Json.TypeNameHandling.None
        };
    }

    public Dictionary<string, string> AsDictionary<T>(T objectToConvert) where T : CommonParameters
    {
        var stringValue = Newtonsoft.Json.JsonConvert.SerializeObject(objectToConvert, _settings);

        var jobject = Newtonsoft.Json.Linq.JObject.Parse(stringValue);
        var dict = new Dictionary<string, string>();
        foreach (var item in jobject)
        {
            dict.Add(item.Key, item.Value.ToString());
        }
        return dict;
    }

    public T AsPortalResponse<T>(string dataToConvert) where T : IPortalResponse
    {
        // got generic geometry in the API
        if (typeof(T) == typeof(QueryResponse<IGeometry>))
        {
            var preliminaryData = JObject.Parse(dataToConvert);
            var type = preliminaryData.GetValue("geometryType").Value<string>();
            switch (type)
            {
                case "esriGeometryEnvelope":
                    return (T)CreateResponce(AsPortalResponse<QueryResponse<Extent>>(dataToConvert));
                case "esriGeometryMultipoint":
                    return (T)CreateResponce(AsPortalResponse<QueryResponse<MultiPoint>>(dataToConvert));
                case "esriGeometryPoint":
                    return (T)CreateResponce(AsPortalResponse<QueryResponse<Point>>(dataToConvert));
                case "esriGeometryPolygon":
                    return (T)CreateResponce(AsPortalResponse<QueryResponse<Polygon>>(dataToConvert));
                case "esriGeometryPolyline":
                    return (T)CreateResponce(AsPortalResponse<QueryResponse<Polyline>>(dataToConvert));
                default:
                    throw new ArgumentException(
                        "AsPortalResponse - cannot support IGeometry for value returned type of " + type);
            }
        }
        return Newtonsoft.Json.JsonConvert.DeserializeObject<T>(dataToConvert, _settings);
    }

    private IPortalResponse CreateResponce<TResponce>(QueryResponse<TResponce> responce)
        where TResponce : IGeometry
    {
        var features = new List<Feature<IGeometry>>();
        responce.Features.ToList().ForEach(one => features.Add(new Feature<IGeometry>
        {
            Attributes = one.Attributes,
            Geometry = one.Geometry
        }));
        var result = new QueryResponse<IGeometry>
        {
            DisplayFieldName = responce.DisplayFieldName,
            Error = responce.Error,
            ExceededTransferLimit = responce.ExceededTransferLimit,
            Features = features,
            FieldAliases = responce.FieldAliases,
            Fields = responce.Fields,
            GeometryTypeString = responce.GeometryTypeString,
            GlobalIdFieldName = responce.GlobalIdFieldName,
            Links = responce.Links,
            ObjectIdFieldName = responce.ObjectIdFieldName,
            SpatialReference = responce.SpatialReference

        };
        return result;
    }
}

}`

Issue building from newly cloned repository

Not sure if this is just me, so close if necessary.

When cloning repository and trying to build in Visual Studio 2012 (v 11.0.50727.1 RTMREL), the ArcGIS.ServiceModel and ArcGIS.Test projects fail to load.

Error:

C:\dev\ArcGIS.PCL\ArcGIS.ServiceModel\ArcGIS.ServiceModel.csproj : error  : The imported project "C:\dev\ArcGIS.PCL\packages\Microsoft.Bcl.Build.1.0.7\tools\Microsoft.Bcl.Build.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.  C:\dev\ArcGIS.PCL\ArcGIS.ServiceModel\ArcGIS.ServiceModel.csproj

C:\dev\ArcGIS.PCL\ArcGIS.Test\ArcGIS.Test.csproj : error  : The imported project "C:\dev\ArcGIS.PCL\packages\Microsoft.Bcl.Build.1.0.7\tools\Microsoft.Bcl.Build.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.  C:\dev\ArcGIS.PCL\ArcGIS.Test\ArcGIS.Test.csproj

Workaround

Removing the following lines from the respective .csproj files resolves this issue and allows me to build...

  <Import Project="..\packages\Microsoft.Bcl.Build.1.0.7\tools\Microsoft.Bcl.Build.targets" />

...however 10 out of 14 tests then fail for an assembly load failure.

After successful build, adding the above line back into the .csproj file no longer causes the project load failure, and also allows most of the tests to pass.

Support Solve operation

Hi,

I'm working on a routing prototype, and the "solve" operation is not yet implemented in ArcGis.PCL. I can propose to do the job, as I will need it for my project.

Look at a better DI mechanism

The current way of resolving ISerializer, HttpClient etc. is pretty limited so need to investigate a better way of doing this.

Bait & Switch it up

Reading Paul Betts blog it seems I'm doing it wrong.

Thinking I can rip out all the non platform stuff and have that as a truly portable dll and then reference that from the bait and switch version. So will end up with 2 portable solutions though one will have all the platform specific stuff in it.

This will also allow the encryption to be done properly from issue #6

Add deleteFeatures operation

Would be great to be able to easily delete WHERE global='xxxxx'. Right now I have to query the objectid, then do an ApplyEdits with the objectId to delete.

Travis-CI build error

Currently the Travis-CI build errors when trying to discover tests with the error

536System.TypeLoadException: Could not load type 'Xunit.Sdk.XunitTestFrameworkDiscoverer, xunit.execution, Version=2.0.0.2785, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c'

Related to xunit/xunit#158

Post vs Get

We ran into a small issue. Query method is hard-coded to use 2047 to decide if POST or GET should be used. We encountered some use cases, where people customize config to allow for a smaller request size. At that point we would get errors on certain (long body) requests. Would it be possible to make this number configurable instead of hard-coded, and just default to 2047 if not configured?

Thank you!

Support multipart polylines and polygons

Currently these just have a PointCollectionList for their Paths and Rings, should be an array instead. Need to check how it would affect the serialization. This needs to filter through to the GeoJSON conversions too.

.NET Standalone Solution

Right now there is a single solution which requires the build to have access and licenses to Xamarin, etc... It would be good to have .NET only solution, so that we can easily build .NET only version of the package.

Allow gateway to automatically use server info

Allow usage of the server info from rest/info to be used automatically for things like the token service. You can do this now be calling the methods yourself but this would make it simpler.

Advanced Query Capabilities

When describing a service, Advanced Query Capabilities node is not included in the response. Here is how it looks in the browser when hitting a service.
Advanced Query Capabilities:
Supports Statistics: true
Supports OrderBy: true
Supports Distinct: true
Supports Pagination: false
Supports TrueCurve: true

Update wiki

There are lots of missing pages, placeholders in sidebar need filling in

Add logging

Add LibLog so requests and errors are logged using the users log framework of choice

Support generating encrypted tokens

As of ArcGIS Server 10.1 it is possible to pass an encrypted payload when generating tokens. An example is shown here.

Since the RSA crypto library isn't available as a PCL it will need to be done per client in a similar way to serialization. One way this could work is to have an optional crypto provider that can be passed to the TokenProvider constructor and if it is set then it requests an encrypted payload, otherwise it works as is in the CheckGenerateToken method. Something like this?

protected async Task<Token> CheckGenerateToken()
{
    if (TokenRequest == null) return null;

    _token = null; // reset the Token

    CheckRefererHeader();

    var url = TokenRequest.BuildAbsoluteUrl(RootUrl).Split('?').FirstOrDefault();
    Uri uri;
    bool validUrl = Uri.TryCreate(url, UriKind.Absolute, out uri);
    if (!validUrl)
        throw new HttpRequestException(String.Format("Not a valid url: {0}", url));

    HttpContent content = null;
    if (_crypto != null)
    {
        Uri encryptionInfoEndpoint = new Uri(RootUrl, "publicKey");
        var ei = await GetStringAsync(encryptionInfoEndpoint, addToken: false);

        byte[] exponent = EncodingHelper.HexToBytes(ei["publicKey"].Value<string>());
        byte[] modulus = EncodingHelper.HexToBytes(ei["modulus"].Value<string>());

        var encryptedTokenRequest = new GenerateToken(
                EncodingHelper.BytesToHex(_crypto.Encrypt(exponent, modulus, Encoding.UTF8.GetBytes(TokenRequest.Username), false)),
                EncodingHelper.BytesToHex(_crypto.Encrypt(exponent, modulus, Encoding.UTF8.GetBytes(TokenRequest.Password), false)));

        content = new FormUrlEncodedContent(Serializer.AsDictionary(encryptedTokenRequest));
    }
    else content = new FormUrlEncodedContent(Serializer.AsDictionary(TokenRequest));

    _httpClient.CancelPendingRequests();
    HttpResponseMessage response = await _httpClient.PostAsync(uri, content);
    response.EnsureSuccessStatusCode();

    var resultString = await response.Content.ReadAsStringAsync();
    System.Diagnostics.Debug.WriteLine("Generate token result: " + resultString);
    var result = Serializer.AsPortalResponse<Token>(resultString);

    if (result.Error != null) throw new InvalidOperationException(result.Error.ToString());

    _token = result;
    if (!String.IsNullOrWhiteSpace(TokenRequest.Referer)) _token.Referer = TokenRequest.Referer;

    return _token;
}

Pass in Custom Logger

Is there a way to pass in a custom logger on ArcGIS.PCL without building the project with the pre-condition values?

Missing return count only support in query

Hi,

As we use this library, we want to get total count only for a query and now it is missing in the Query and QueryResponse class. I think just need to add Count property into QueryResponse class and ReturnCountOnly property into Query class.

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.