public SqlServerGeometryTypeMapping(IGeometryServices geometryServices, string storeType)
     : base(
         new GeometryValueConverter <TGeometry>(
             CreateReader(geometryServices, IsGeography(storeType)),
             CreateWriter(IsGeography(storeType))),
         storeType)
     => _isGeography = IsGeography(storeType);
        public IFeatureProvider ConstructSourceProvider(IGeometryServices geometryServices)
        {
            header( "Construct SpatiaLite2 source provider\n" +
                  "* Author Felix Obermaier 2009\n" +
                  "* Ingenieurgruppe IVV GmbH & Co. KG\n" +
                  "* http://www.ivv-aachen.de" );

            string connectionString = 
                GetValue("Please enter the connection string for the source database file.",
                         Properties.Settings.Default.SourceConnectionString);

            string tableName = GetValue("Please enter the table name.","");

            _oidColumn = GetValue("Please enter the id column name.","");

            string geometryColumn = GetValue("Please enter the geometry column name.","");

            _sourceProvider = new SpatiaLite2Provider(geometryServices.DefaultGeometryFactory,
                connectionString, "main", tableName, _oidColumn, geometryColumn,
                geometryServices.CoordinateTransformationFactory);

            Console.WriteLine(string.Format(
                "\nThe defined source provider serves shapes of the following type:\n{0}",
                _sourceProvider.ValidGeometryType.ToString()));

            _sourceProvider.CoordinateTransformation = 
                SetCoordinateTransfromation(_sourceProvider.OriginalSpatialReference);

            _sourceProvider.Open();

            return _sourceProvider;
        }
        public IFeatureProvider ConstructSourceProvider(IGeometryServices geometryServices)
        {
            Console.WriteLine("Please enter the connection string for the source server.");
            string connectionString = Console.ReadLine();

            Console.WriteLine("Please enter the spatial schema");
            string sschema = Console.ReadLine();

            Console.WriteLine("Please enter the data tables' schema");
            string dtschema = Console.ReadLine();

            Console.WriteLine("Please enter the table name.");
            string tableName = Console.ReadLine();

            Console.WriteLine("Please enter the id column name.");
            string oidColumn = Console.ReadLine();

            Console.WriteLine("Please enter the geometry column name.");
            string geometryColumn = Console.ReadLine();

            Console.WriteLine("Please enter the SRID (e.g EPSG:4326)");
            string srid = Console.ReadLine();

            _sourceProvider = new MsSqlSpatialProvider(geometryServices[srid], connectionString, sschema, dtschema,
                                                       tableName, oidColumn, geometryColumn);
            return(_sourceProvider);
        }
        public IFeatureProvider ConstructSourceProvider(IGeometryServices geometryServices)
        {
            header("Construct SpatiaLite2 source provider\n" +
                   "* Author Felix Obermaier 2009\n" +
                   "* Ingenieurgruppe IVV GmbH & Co. KG\n" +
                   "* http://www.ivv-aachen.de");

            string connectionString =
                GetValue("Please enter the connection string for the source database file.",
                         Properties.Settings.Default.SourceConnectionString);

            string tableName = GetValue("Please enter the table name.", "");

            _oidColumn = GetValue("Please enter the id column name.", "");

            string geometryColumn = GetValue("Please enter the geometry column name.", "");

            _sourceProvider = new SpatiaLite2Provider(geometryServices.DefaultGeometryFactory,
                                                      connectionString, "main", tableName, _oidColumn, geometryColumn,
                                                      geometryServices.CoordinateTransformationFactory);

            Console.WriteLine(string.Format(
                                  "\nThe defined source provider serves shapes of the following type:\n{0}",
                                  _sourceProvider.ValidGeometryType.ToString()));

            _sourceProvider.CoordinateTransformation =
                SetCoordinateTransfromation(_sourceProvider.OriginalSpatialReference);

            _sourceProvider.Open();

            return(_sourceProvider);
        }
Esempio n. 5
0
        /*
         * http://groups.google.de/group/microsoft.public.de.german.entwickler.dotnet.framework/msg/1af0719168e45e84?dmode=source
         *
         * Thomas Scheidegger - MVP .NET - 'NETMaster'
         * http://www.cetus-links.org/oo_dotnet.html - http://dnetmaster.net/
         * use at your own risk
         */

        static Converter()
        {
            _geometryServices = new GeometryServices();

            ///ensure all the assemblies which may contain 'plugins' are loaded
            foreach (FileInfo f in new DirectoryInfo(Environment.CurrentDirectory).GetFiles("*.dll"))
            {
                if (IsClrImage(f.Name))
                {
                    AssemblyName name = AssemblyName.GetAssemblyName(f.Name);
                    try
                    {
                        AppDomain.CurrentDomain.Load(name);
                    }
                    catch
                    {
                    }
                }
            }


            foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies())
            {
                ///search for 'plugins' these are types decorated with certain attributes
                foreach (Type t in asm.GetExportedTypes())
                {
                    object[] attrs = t.GetCustomAttributes(typeof(ConfigureProviderAttribute), true);
                    if (attrs.Length == 1)
                    {
                        ConfigureProviderAttribute attr = (ConfigureProviderAttribute)attrs[0];
                        ProviderItem pi = new ProviderItem {
                            Builder = t, Name = attr.Name, ProviderType = attr.ProviderType
                        };

                        if (typeof(IConfigureFeatureSource).IsAssignableFrom(t))
                        {
                            _configureSourceProviders.Add(pi);
                        }

                        if (typeof(IConfigureFeatureTarget).IsAssignableFrom(t))
                        {
                            _configureTargetProviders.Add(pi);
                        }
                    }

                    attrs = t.GetCustomAttributes(typeof(FeatureDataRecordProcessorAttribute), true);
                    if (attrs.Length > 0)
                    {
                        FeatureDataRecordProcessorAttribute attr = (FeatureDataRecordProcessorAttribute)attrs[0];
                        _featureDataRecordProcessors.Add(new ProcessorItem
                        {
                            Description   = attr.Description,
                            Name          = attr.Name,
                            ProcessorType = t
                        });
                    }
                }
            }
        }
Esempio n. 6
0
        /// <summary>
        ///     This API supports the Entity Framework Core infrastructure and is not intended to be used
        ///     directly from your code. This API may change or be removed in future releases.
        /// </summary>
        public SqliteNTSTypeMappingSourcePlugin([NotNull] IGeometryServices geometryServices)
        {
            Check.NotNull(geometryServices, nameof(geometryServices));

            _reader = new GaiaGeoReader(
                geometryServices.DefaultCoordinateSequenceFactory,
                geometryServices.DefaultPrecisionModel);
        }
        public IFeatureProvider ConstructSourceProvider(IGeometryServices geometryServices)
        {
            Console.WriteLine(
                "Please enter the connection string for the source server. Press Enter to use the following:");
            Console.WriteLine(Settings.Default.SourceConnectionString);

            string connectionString = Console.ReadLine();

            if (connectionString == "")
            {
                connectionString = Settings.Default.SourceConnectionString;
            }
            else
            {
                Settings.Default.SourceConnectionString = connectionString;
            }
            Settings.Default.Save();

            Console.WriteLine("Please enter the data tables' schema");
            string dtschema = Console.ReadLine();

            Console.WriteLine("Please enter the table name.");
            string tableName = Console.ReadLine();

            Console.WriteLine("Please enter the id column name. (CaSe sensitive)");
            _oidColumn = Console.ReadLine();
            Console.WriteLine("Please enter the geometry column name. (CaSe sensitive)");
            string geometryColumn = Console.ReadLine();

            Console.WriteLine("Please enter the SRID (e.g EPSG:4326)");
            string srid = Console.ReadLine();

            Type type;
            SqlServerDbUtility dbUtility = new SqlServerDbUtility();

            using (IDbConnection conn = dbUtility.CreateConnection(connectionString))
            {
                using (IDbCommand cmd = conn.CreateCommand())
                {
                    cmd.CommandText = string.Format("SELECT TOP 1 [{0}] FROM [{1}].[{2}] ", _oidColumn, dtschema,
                                                    tableName);
                    cmd.CommandType = CommandType.Text;
                    conn.Open();
                    type = cmd.ExecuteScalar().GetType();
                }
            }

            Type t           = typeof(MsSqlServer2008Provider <>);
            Type specialized = t.MakeGenericType(type);

            _sourceProvider =
                (IFeatureProvider)
                Activator.CreateInstance(specialized, geometryServices[srid], connectionString, dtschema, tableName,
                                         _oidColumn, geometryColumn);
            _sourceProvider.Open();
            _sourceProviderOidType = type;
            return(_sourceProvider);
        }
        public IFeatureProvider ConstructSourceProvider(IGeometryServices geometryServices)
        {
            header("Construct PostGis source provider\n" +
                   "* Author Felix Obermaier 2009\n" +
                   "* Ingenieurgruppe IVV GmbH & Co. KG\n" +
                   "* http://www.ivv-aachen.de");

            string connectionString = GetValue(
                "Please enter the connection string for the source database file.",
                Settings.Default.SourceConnectionString);

            string schema = GetValue("Please enter the schema name",
                                     Settings.Default.SourceSchema);

            string tableName = GetValue("Please enter the table name.", null);

            _oidColumn = GetValue("Please enter the id column name.", null);

            string geometryColumn = GetValue("Please enter the geometry column name.", null);

            Type             type;
            PostGisDbUtility dbUtility = new PostGisDbUtility();

            using (IDbConnection conn = dbUtility.CreateConnection(connectionString))
            {
                using (IDbCommand cmd = conn.CreateCommand())
                {
                    cmd.CommandText = string.Format("SELECT \"{0}\" FROM \"{1}\".\"{2}\" LIMIT 1;", _oidColumn, schema,
                                                    tableName);
                    cmd.CommandType = CommandType.Text;
                    conn.Open();
                    type = cmd.ExecuteScalar().GetType();
                }
            }

            _sourceProviderOidType = type;

            Type t           = typeof(PostGisProvider <>);
            Type specialized = t.MakeGenericType(type);

            _sourceProvider =
                (IFeatureProvider)
                Activator.CreateInstance(specialized,
                                         geometryServices.DefaultGeometryFactory,
                                         connectionString, schema, tableName,
                                         _oidColumn,
                                         geometryColumn,
                                         geometryServices.CoordinateTransformationFactory);
            _sourceProvider.Open();

            _sourceProvider.CoordinateTransformation =
                SetCoordinateTransfromation(_sourceProvider.OriginalSpatialReference);

            _sourceProvider.Open();

            return(_sourceProvider);
        }
        public IFeatureProvider ConstructSourceProvider(IGeometryServices geometryServices)
        {
            header("Construct PostGis source provider\n" +
                   "* Author Felix Obermaier 2009\n" +
                   "* Ingenieurgruppe IVV GmbH & Co. KG\n" +
                   "* http://www.ivv-aachen.de");

            string connectionString = GetValue(
                "Please enter the connection string for the source database file.",
                Settings.Default.SourceConnectionString);

            string schema = GetValue("Please enter the schema name",
                                     Settings.Default.SourceSchema);

            string tableName = GetValue("Please enter the table name.", null);

            _oidColumn = GetValue("Please enter the id column name.", null);

            string geometryColumn = GetValue("Please enter the geometry column name.", null);

            Type type;
            PostGisDbUtility dbUtility = new PostGisDbUtility();
            using (IDbConnection conn = dbUtility.CreateConnection(connectionString))
            {
                using (IDbCommand cmd = conn.CreateCommand())
                {
                    cmd.CommandText = string.Format("SELECT \"{0}\" FROM \"{1}\".\"{2}\" LIMIT 1;", _oidColumn, schema,
                                                    tableName);
                    cmd.CommandType = CommandType.Text;
                    conn.Open();
                    type = cmd.ExecuteScalar().GetType();
                }
            }

            _sourceProviderOidType = type;

            Type t = typeof (PostGisProvider<>);
            Type specialized = t.MakeGenericType(type);

            _sourceProvider =
                (IFeatureProvider)
                Activator.CreateInstance(specialized,
                                         geometryServices.DefaultGeometryFactory,
                                         connectionString, schema, tableName,
                                         _oidColumn,
                                         geometryColumn,
                                         geometryServices.CoordinateTransformationFactory);
            _sourceProvider.Open();

            _sourceProvider.CoordinateTransformation =
                SetCoordinateTransfromation(_sourceProvider.OriginalSpatialReference);

            _sourceProvider.Open();

            return _sourceProvider;
        }
Esempio n. 10
0
        public WKBReader(IGeometryServices services)
        {
            services          = services ?? GeometryServiceProvider.Instance;
            _geometryServices = services;
            _precisionModel   = services.DefaultPrecisionModel;
            _sequenceFactory  = services.DefaultCoordinateSequenceFactory;

            HandleSRID      = true;
            HandleOrdinates = AllowedOrdinates;
        }
Esempio n. 11
0
        public WKBReader(IGeometryServices services)
        {
            services = services ?? GeometryServiceProvider.Instance;
            _geometryServices = services;
            _precisionModel = services.DefaultPrecisionModel;
            _sequenceFactory = services.DefaultCoordinateSequenceFactory;

            HandleSRID = true;
            HandleOrdinates = AllowedOrdinates;
        }
Esempio n. 12
0
        public WKBReader(IGeometryFactory factory)
        {
            _geometryServices = GeometryServiceProvider.Instance;

            _factory         = factory;
            _sequenceFactory = factory.CoordinateSequenceFactory;
            _precisionModel  = factory.PrecisionModel;

            HandleSRID      = true;
            HandleOrdinates = AllowedOrdinates;
        }
Esempio n. 13
0
        public WKBReader(IGeometryFactory factory)
        {
            _geometryServices = GeometryServiceProvider.Instance;

            _factory = factory;
            _sequenceFactory = factory.CoordinateSequenceFactory;
            _precisionModel = factory.PrecisionModel;

            HandleSRID = true;
            HandleOrdinates = AllowedOrdinates;
        }
Esempio n. 14
0
        /* 
         * http://groups.google.de/group/microsoft.public.de.german.entwickler.dotnet.framework/msg/1af0719168e45e84?dmode=source
         * 
         * Thomas Scheidegger - MVP .NET - 'NETMaster'
         * http://www.cetus-links.org/oo_dotnet.html - http://dnetmaster.net/
         * use at your own risk
         */

        static Converter()
        {
            _geometryServices = new GeometryServices();

            ///ensure all the assemblies which may contain 'plugins' are loaded
            foreach (FileInfo f in new DirectoryInfo(Environment.CurrentDirectory).GetFiles("*.dll"))
            {
                if (IsClrImage(f.Name))
                {
                    AssemblyName name = AssemblyName.GetAssemblyName(f.Name);
                    try
                    {
                        AppDomain.CurrentDomain.Load(name);
                    }
                    catch
                    {
                    }
                }
            }


            foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies())
            {
                ///search for 'plugins' these are types decorated with certain attributes
                foreach (Type t in asm.GetExportedTypes())
                {
                    object[] attrs = t.GetCustomAttributes(typeof(ConfigureProviderAttribute), true);
                    if (attrs.Length == 1)
                    {
                        ConfigureProviderAttribute attr = (ConfigureProviderAttribute)attrs[0];
                        ProviderItem pi = new ProviderItem { Builder = t, Name = attr.Name, ProviderType = attr.ProviderType };

                        if (typeof(IConfigureFeatureSource).IsAssignableFrom(t))
                            _configureSourceProviders.Add(pi);

                        if (typeof(IConfigureFeatureTarget).IsAssignableFrom(t))
                            _configureTargetProviders.Add(pi);
                    }

                    attrs = t.GetCustomAttributes(typeof(FeatureDataRecordProcessorAttribute), true);
                    if (attrs.Length > 0)
                    {
                        FeatureDataRecordProcessorAttribute attr = (FeatureDataRecordProcessorAttribute)attrs[0];
                        _featureDataRecordProcessors.Add(new ProcessorItem
                                                             {
                                                                 Description = attr.Description,
                                                                 Name = attr.Name,
                                                                 ProcessorType = t
                                                             });
                    }
                }
            }
        }
        public IFeatureProvider ConstructSourceProvider(IGeometryServices geometryServices)
        {
            Console.WriteLine(
                "Please enter the connection string for the source server. Press Enter to use the following:");
            Console.WriteLine(Settings.Default.SourceConnectionString);

            string connectionString = Console.ReadLine();
            if (connectionString == "")
                connectionString = Settings.Default.SourceConnectionString;
            else
                Settings.Default.SourceConnectionString = connectionString;
            Settings.Default.Save();

            Console.WriteLine("Please enter the data tables' schema");
            string dtschema = Console.ReadLine();
            Console.WriteLine("Please enter the table name.");
            string tableName = Console.ReadLine();
            Console.WriteLine("Please enter the id column name. (CaSe sensitive)");
            _oidColumn = Console.ReadLine();
            Console.WriteLine("Please enter the geometry column name. (CaSe sensitive)");
            string geometryColumn = Console.ReadLine();
            Console.WriteLine("Please enter the SRID (e.g EPSG:4326)");
            string srid = Console.ReadLine();

            Type type;
            SqlServerDbUtility dbUtility = new SqlServerDbUtility();
            using (IDbConnection conn = dbUtility.CreateConnection(connectionString))
            {
                using (IDbCommand cmd = conn.CreateCommand())
                {
                    cmd.CommandText = string.Format("SELECT TOP 1 [{0}] FROM [{1}].[{2}] ", _oidColumn, dtschema,
                                                    tableName);
                    cmd.CommandType = CommandType.Text;
                    conn.Open();
                    type = cmd.ExecuteScalar().GetType();
                }
            }

            Type t = typeof (MsSqlServer2008Provider<>);
            Type specialized = t.MakeGenericType(type);

            _sourceProvider =
                (IFeatureProvider)
                Activator.CreateInstance(specialized, geometryServices[srid], connectionString, dtschema, tableName,
                                         _oidColumn, geometryColumn);
            _sourceProvider.Open();
            _sourceProviderOidType = type;
            return _sourceProvider;
        }
        private IGeometry Read(
            string bytes,
            IGeometryServices geometryServices = null,
            Ordinates handleOrdinates          = Ordinates.XYZM)
        {
            var byteArray = new byte[bytes.Length / 2];

            for (var i = 0; i < bytes.Length; i += 2)
            {
                byteArray[i / 2] = byte.Parse(bytes.Substring(i, 2), NumberStyles.HexNumber);
            }

            var reader = new SqlServerSpatialReader(geometryServices ?? NtsGeometryServices.Instance)
            {
                HandleOrdinates = handleOrdinates
            };

            return(reader.Read(byteArray));
        }
        public IFeatureProvider ConstructSourceProvider(IGeometryServices geometryServices)
        {
            Console.WriteLine("Please enter the connection string for the source server.");
            string connectionString = Console.ReadLine();
            Console.WriteLine("Please enter the spatial schema");
            string sschema = Console.ReadLine();
            Console.WriteLine("Please enter the data tables' schema");
            string dtschema = Console.ReadLine();
            Console.WriteLine("Please enter the table name.");
            string tableName = Console.ReadLine();
            Console.WriteLine("Please enter the id column name.");
            string oidColumn = Console.ReadLine();
            Console.WriteLine("Please enter the geometry column name.");
            string geometryColumn = Console.ReadLine();
            Console.WriteLine("Please enter the SRID (e.g EPSG:4326)");
            string srid = Console.ReadLine();

            _sourceProvider = new MsSqlSpatialProvider(geometryServices[srid], connectionString, sschema, dtschema,
                                                       tableName, oidColumn, geometryColumn);
            return _sourceProvider;
        }
Esempio n. 18
0
        private IGeometry Read(
            string bytes,
            IGeometryServices geometryServices = null,
            Ordinates handleOrdinates          = Ordinates.XYZM)
        {
            var byteArray = new byte[bytes.Length / 2];

            for (var i = 0; i < bytes.Length; i += 2)
            {
                byteArray[i / 2] = byte.Parse(bytes.Substring(i, 2), NumberStyles.HexNumber);
            }

            var reader = (IBinaryGeometryReader)Activator.CreateInstance(
                typeof(SqlServerNetTopologySuiteServiceCollectionExtensions)
                .Assembly
                .GetType("NetTopologySuite.IO.SqlServerSpatialReader"),
                geometryServices ?? NtsGeometryServices.Instance);

            reader.HandleOrdinates = handleOrdinates;

            return(reader.Read(byteArray));
        }
Esempio n. 19
0
        public void DoTestThreading()
        {
            IGeometryServices services = GeometryServiceProvider.Instance;

            services.CreateGeometryFactory();
            int before = ((NtsGeometryServices)services).NumFactories;

            Debug.WriteLine("{0} factories already created", before);

            var wkts = new[]
            {
                "POINT ( 10 20 )",
                "LINESTRING EMPTY",
                "LINESTRING(0 0, 10 10)",
                "MULTILINESTRING ((50 100, 100 200), (100 100, 150 200))",
                "POLYGON ((100 200, 200 200, 200 100, 100 100, 100 200))",
                "MULTIPOLYGON (((100 200, 200 200, 200 100, 100 100, 100 200)), ((300 200, 400 200, 400 100, 300 100, 300 200)))",
                "GEOMETRYCOLLECTION (POLYGON ((100 200, 200 200, 200 100, 100 100, 100 200)), LINESTRING (250 100, 350 200), POINT (350 150))"
                ,
            };

            int[] srids = { 4326, 31467, 3857 };

            const int numJobs     = 30;
            var       waitHandles = new WaitHandle[numJobs];

            for (int i = 0; i < numJobs; i++)
            {
                waitHandles[i] = new AutoResetEvent(false);
                ThreadPool.QueueUserWorkItem(TestReaderInThreadedContext, new object[] { wkts, waitHandles[i], srids, i });
            }

            WaitHandle.WaitAll(waitHandles, 10000);

            int after = ((NtsGeometryServices)services).NumFactories;

            Console.WriteLine("Now {0} factories created", after);
            Assert.LessOrEqual(after, before + srids.Length);
        }
 /// <summary>
 ///     Initializes a new instance of the <see cref="SqlServerSpatialReader"/> class.
 /// </summary>
 /// <param name="services"> The geometry services used to create <see cref="IGeometry"/> instances. </param>
 public SqlServerSpatialReader(IGeometryServices services)
 {
     _services        = services ?? GeometryServiceProvider.Instance;
     _sequenceFactory = _services.DefaultCoordinateSequenceFactory;
     _handleOrdinates = AllowedOrdinates;
 }
        //public NtsGeometrySink()
        //    :this(GeometryFactory.Default)
        //{
        //}

        public NtsGeometrySink(IGeometryServices geometryServices)
        {
            _geometryServices = geometryServices;
        }
        //public NtsGeometrySink()
        //    :this(GeometryFactory.Default)
        //{
        //}

        public NtsGeometrySink(IGeometryServices geometryServices)
        {
            _geometryServices = geometryServices;
        }
Esempio n. 23
0
 public SqliteGeometryTypeMapping(IGeometryServices geometryServices, string storeType)
     : base(new GeometryValueConverter <TGeometry>(CreateReader(geometryServices), CreateWriter()), storeType)
 {
 }
Esempio n. 24
0
 public static IGeometryFactory CreateGeometryFactory(this IGeometryServices self, string oid)
 {
     return(_store.Get(oid));
 }
Esempio n. 25
0
 /// <summary>
 /// Method to set the geometry services class
 /// </summary>
 /// <param name="geometryServices">The geometry services class</param>
 /// <returns>A reference to this session</returns>
 public ISession SetGeometryServices(IGeometryServices geometryServices)
 {
     GeometryServices = geometryServices;
     return(this);
 }
        /// <summary>
        ///     This API supports the Entity Framework Core infrastructure and is not intended to be used
        ///     directly from your code. This API may change or be removed in future releases.
        /// </summary>
        public SqlServerNTSTypeMappingSourcePlugin([NotNull] IGeometryServices geometryServices)
        {
            Check.NotNull(geometryServices, nameof(geometryServices));

            _geometryServices = geometryServices;
        }
Esempio n. 27
0
 internal GpkgStandardBinaryReader(IGeometryServices services)
 {
     _wkbReader = new WKBReader(services);
 }
        public IFeatureProvider ConstructSourceProvider(IGeometryServices geometryServices)
        {
            string path;
            while (true)
            {
                Console.WriteLine("Please enter the path to the input shapefile");
                path = Console.ReadLine();

                if (File.Exists(path))
                    break;
                Console.WriteLine("Invalid Path");
            }

            _sourceProvider = new ShapeFileProvider(path, geometryServices.DefaultGeometryFactory,
                                              geometryServices.CoordinateSystemFactory) { IsSpatiallyIndexed = false };
            _sourceProvider.Open();
            Console.WriteLine("\nINFO The shape type is: " + _sourceProvider.ShapeType + "\n");

            if (Array.IndexOf(new ShapeType[] { ShapeType.PointM, ShapeType.PointZ, ShapeType.MultiPointM, ShapeType.MultiPointZ, ShapeType.PolygonM, ShapeType.PolygonZ }, _sourceProvider.ShapeType) > -1)
                Console.WriteLine("Warning: The source shapefile contains Z or M values. This is work in progress and can cause issues.");

            ForceCoordinateOptions[] coordinateOptions = (ForceCoordinateOptions[])Enum.GetValues(typeof(ForceCoordinateOptions));
            Dictionary<int, ForceCoordinateOptions> fco = new Dictionary<int, ForceCoordinateOptions>();
            for (int i = 0; i < coordinateOptions.Length; i++)
                fco.Add(i, coordinateOptions[i]);

            ShapeFileReadStrictness[] strictnesses = (ShapeFileReadStrictness[])Enum.GetValues(typeof(ShapeFileReadStrictness));
            Dictionary<int, ShapeFileReadStrictness> strictness = new Dictionary<int, ShapeFileReadStrictness>();

            for (int i = 0; i < strictnesses.Length; i++)
                strictness.Add(i, strictnesses[i]);

            Console.WriteLine("Force Coordinate Options? Enter the id of one of the options below or leave blank.");
            foreach (KeyValuePair<int, ForceCoordinateOptions> option in fco)
            {
                Console.WriteLine(string.Format("{0} {1}", option.Key, option.Value));
            }
            int opt;
            if (int.TryParse(Console.ReadLine(), out opt))
            {
                if (fco.ContainsKey(opt))
                    _sourceProvider.ForceCoordinateOptions = fco[opt];

                Console.WriteLine(string.Format("The effective shape type is now {0}", _sourceProvider.EffectiveShapeType));
            }

            Console.WriteLine("Please select a Leniency option:");
            foreach (KeyValuePair<int, ShapeFileReadStrictness> pair in strictness)
            {
                Console.WriteLine(String.Format("{0} {1}", pair.Key, pair.Value));
            }

            if (int.TryParse(Console.ReadLine(), out opt))
            {
                if (strictness.ContainsKey(opt))
                    _sourceProvider.ReadStrictness = strictness[opt];
            }


            return _sourceProvider;
        }
        /// <summary>
        ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
        ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
        ///     any release. You should only use it directly in your code with extreme caution and knowing that
        ///     doing so can result in application failures when updating to a new Entity Framework Core release.
        /// </summary>
        public SqliteNetTopologySuiteTypeMappingSourcePlugin([NotNull] IGeometryServices geometryServices)
        {
            Check.NotNull(geometryServices, nameof(geometryServices));

            _geometryServices = geometryServices;
        }
 private static SqlServerSpatialReader CreateReader(IGeometryServices services, bool isGeography)
 => new SqlServerSpatialReader(services)
 {
     IsGeography = isGeography
 };
Esempio n. 31
0
        public IFeatureProvider ConstructSourceProvider(IGeometryServices geometryServices)
        {
            string path;

            while (true)
            {
                Console.WriteLine("Please enter the path to the input shapefile");
                path = Console.ReadLine();

                if (File.Exists(path))
                {
                    break;
                }
                Console.WriteLine("Invalid Path");
            }

            _sourceProvider = new ShapeFileProvider(path, geometryServices.DefaultGeometryFactory,
                                                    geometryServices.CoordinateSystemFactory)
            {
                IsSpatiallyIndexed = false
            };
            _sourceProvider.Open();
            Console.WriteLine("\nINFO The shape type is: " + _sourceProvider.ShapeType + "\n");

            if (Array.IndexOf(new ShapeType[] { ShapeType.PointM, ShapeType.PointZ, ShapeType.MultiPointM, ShapeType.MultiPointZ, ShapeType.PolygonM, ShapeType.PolygonZ }, _sourceProvider.ShapeType) > -1)
            {
                Console.WriteLine("Warning: The source shapefile contains Z or M values. This is work in progress and can cause issues.");
            }

            ForceCoordinateOptions[] coordinateOptions   = (ForceCoordinateOptions[])Enum.GetValues(typeof(ForceCoordinateOptions));
            Dictionary <int, ForceCoordinateOptions> fco = new Dictionary <int, ForceCoordinateOptions>();

            for (int i = 0; i < coordinateOptions.Length; i++)
            {
                fco.Add(i, coordinateOptions[i]);
            }

            ShapeFileReadStrictness[] strictnesses = (ShapeFileReadStrictness[])Enum.GetValues(typeof(ShapeFileReadStrictness));
            Dictionary <int, ShapeFileReadStrictness> strictness = new Dictionary <int, ShapeFileReadStrictness>();

            for (int i = 0; i < strictnesses.Length; i++)
            {
                strictness.Add(i, strictnesses[i]);
            }

            Console.WriteLine("Force Coordinate Options? Enter the id of one of the options below or leave blank.");
            foreach (KeyValuePair <int, ForceCoordinateOptions> option in fco)
            {
                Console.WriteLine(string.Format("{0} {1}", option.Key, option.Value));
            }
            int opt;

            if (int.TryParse(Console.ReadLine(), out opt))
            {
                if (fco.ContainsKey(opt))
                {
                    _sourceProvider.ForceCoordinateOptions = fco[opt];
                }

                Console.WriteLine(string.Format("The effective shape type is now {0}", _sourceProvider.EffectiveShapeType));
            }

            Console.WriteLine("Please select a Leniency option:");
            foreach (KeyValuePair <int, ShapeFileReadStrictness> pair in strictness)
            {
                Console.WriteLine(String.Format("{0} {1}", pair.Key, pair.Value));
            }

            if (int.TryParse(Console.ReadLine(), out opt))
            {
                if (strictness.ContainsKey(opt))
                {
                    _sourceProvider.ReadStrictness = strictness[opt];
                }
            }


            return(_sourceProvider);
        }
Esempio n. 32
0
 private static GaiaGeoReader CreateReader(IGeometryServices geometryServices)
 => new GaiaGeoReader(
     geometryServices.DefaultCoordinateSequenceFactory,
     geometryServices.DefaultPrecisionModel);
        /// <summary>
        ///     This API supports the Entity Framework Core infrastructure and is not intended to be used
        ///     directly from your code. This API may change or be removed in future releases.
        /// </summary>
        public SqlServerNTSTypeMappingSourcePlugin([NotNull] IGeometryServices geometryServices)
        {
            Check.NotNull(geometryServices, nameof(geometryServices));

            _reader = new SqlServerSpatialReader(geometryServices);
        }
Esempio n. 34
0
 public SectorController(IGeometryServices services)
 {
     //inject our Geometry service into this controller
     _services = services;
 }
Esempio n. 35
0
 internal GpkgStandardBinaryReader(IGeometryServices services)
 {
     _wkbReader = new WKBReader(services);
 }