Git Product home page Git Product logo

geojson.net.contrib's People

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

geojson.net.contrib's Issues

Support for NETStandard

Current version of library does not support NETStandard. Is it possible to make it compatible with NETStandard 2.0?

STContains/STWithin returning all results even if isn't inside

Hey I am not sure if I am doing something wrong or not. I am using GeoJson for states and am looking through my own data to add my data to it.

var data = await File.ReadAllTextAsync(Path.Combine(executingDirectory, StatesJson));
var collection = JsonConvert.DeserializeObject<FeatureCollection>(data);
foreach (var state in collection.Features)
{
    var geo = state.ToSqlGeography(options.Value.Srid).MakeValid();
    var records = myData.Where(i => SqlGeography.Point(i.Location.Y, i.Location.X, options.Value.Srid).MakeValid().STWithin(geo).Value);

    if(records != null && records.Count() > 0)
    {
        state.Properties.Add("stateCount", records.GetMyData());
    }
}

return collection;

The reason the Y goes in the latitude and X goes in the longitude is because of this. It works for 2 of the states (Washingotn and Utah which is where the data is expected) however it ends up filling up other states as well.
image

When I place a break point in the if statement it starts off with Washington with the expected results, and then Utah, but then it breaks on Arkansas.

The Washington geo data for the boundry of the state comes out to be


  | Name | Value | Type
-- | -- | -- | --
▶ | geo | {POLYGON ((-116.9980726794949 46.330169786151487, -117.02664974655227 47.72292715106596, -117.03142981653929 48.999309190458973, -120.00269628968556 49.000885321643864, -122.84 49.000000000000114, -122.49983068910967 48.180160223984387, -122.34002132224703 47.359951890647778, -122.58713802146673 47.095885321636388, -123.12 48.04, -124.56610107421875 48.379714965820426, -124.68721008300781 48.184432983398381, -124.39567 47.72017000000011, -124.079635 46.86475, -123.99867632678428 46.2830694871044, -123.77670365460955 46.282033189471633, -123.47137345441303 46.277253119484669, -123.22849422264113 46.186250922218562, -122.9379693202963 46.12909678810388, -122.75224422263926 45.93807485613678, -122.72578588930577 45.770333156917559, -122.65170772361546 45.63008331967734, -122.42045568910925 45.591997789078221, -122.17491512107449 45.595150051447945, -121.78809118715355 45.700983384781807, -121.56107662009549 45.732764390641307, -121.203889120094 45.689898790055224, -121.0467410894945 45.637498887711104, -120.83719315655094 45.672948920263423, -120.60963598695361 45.753900051448625, -120.15826818910023 45.740670884781935, -119.78730891989301 45.850767523779837, -119.59204952047821 45.932235419287906, -119.33699968145743 45.888336290055861, -118.97823605027111 45.992567653988658, -116.9150028145857 45.999983222022593, -116.90652787968992 46.177775987322832, -116.9980726794949 46.330169786151487))} | Microsoft.SqlServer.Types.SqlGeography

and here is the Arkansas


  | Name | Value | Type
-- | -- | -- | --
▶ | geo | {POLYGON ((-89.662919481143419 36.023072821591967, -89.673513149763252 35.94000295668279, -89.775109015649065 35.799236355119717, -89.950266282902376 35.701877956681827, -89.988894416040552 35.536229152970236, -90.147101813502132 35.404996853165017, -90.13493201369738 35.113955186497193, -90.249240281927 35.020834255507239, -90.268283047226561 34.941459255506913, -90.446618415065814 34.866838487277448, -90.4503132799747 34.7218602564826, -90.584206916042945 34.454098822562258, -90.6995487129184 34.397461452770358, -90.876307949572748 34.261474921194306, -90.9821412829065 34.0551050888367, -91.20068091506883 33.706392523731139, -91.223444383493415 33.469326890592171, -91.1080767484018 33.2068364527656, -91.156239183297828 33.010000922165858, -92.001303880566837 33.043874823533173, -93.094027879594648 33.010517686488768, -94.059757046265162 33.012119655889819, -94.002086147827441 33.57991445569678, -94.233338182333569 33.583609320605646, -94.427538214886425 33.570380153938927, -94.479912279014258 33.635983384733464, -94.451361050172991 34.510710354138, -94.430173712933311 35.483312486303348, -94.628611212934118 36.540586452778939, -93.412587246457889 36.52629791925024, -92.30717668330243 36.523662421203355, -91.251478848011743 36.52314565688043, -90.112194383488969 36.461754055317684, -90.029098680363632 36.337937323546356, -90.141804979192216 36.230502020811556, -90.253994513697862 36.122549953753833, -90.315386115260608 36.023072821591967, -89.662919481143419 36.023072821591967))} | Microsoft.SqlServer.Types.SqlGeography

The records variable inside the if statement for these states is filled with every result that is with in myData a total of 21 records. Like I mentioned both Utah and Washington (which actually has data) turn out fine but all the others East of Utah are for some reason getting all records even if their latitude/longitude don't fall with in the polygons.

I have tried both SqlGeography.Point( ... ).STWithin(geo) and geo.STContains(SqlGeography.Point( ... )) both return the same results.

Lastly here is one of the points that is showing up in a state that shouldn't have any data {POINT (47.2219 -122.4479)} yet some how the methods above are showing true even though the point shouldn't exist within that location.

Let me know if you need any more information, as I am really wanting to try to figure this out.

Switch Lat Lon

Hi guys!

I have a problem with conversion from SqlGeography to IGeometryObject (use method - MsSqlSpatialConvert.ToGeoJSONGeometry).
At the entrance I submit Longitude, Latitude, and the output is a sequence contrary Latitude, Longitude.

May be bug at line 63,70 SqlGeographyGeoJSONSink.cs ?

Thanks.

.NET 5?

We'd been using GeoJSON.Net.Contrib.MsSqlSpatial in a few .NET Framework 4.5 projects, without issue.

Now we're trying to move to .NET 5, and we are having issues.

The most recent package we can find on .NuGet is 0.3.6, from July 2, 2020. And it has a dependency on .NETFramework v4.5.

Has anyone built an equivalent package that does support .NET 5?

Add support for Extended Well-Known Text

Would it be possible to add support for Extended Well-Known Text to GeoJSON.Net.Contrib.MsSqlSpatial?

Per Wikipedia:

EWKT and EWKB – Extended Well-Known Text/Binary – A PostGIS-specific format that includes the spatial reference system identifier (SRID) and up to 4 ordinate values (XYZM).[15][16] For example: SRID=4326;POINT(-44.3 60.1) to locate a longitude/latitude coordinate using the WGS 84 reference coordinate system.

Cannot load GeoJSON.NetContrib.Wkbconversions

I was experimenting with WKB conversions but .ToWkb() gave me an error
{"Kan bestand of assembly GeoJSON.NetContrib.WkbConversions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null of een van de afhankelijkheden hiervan niet laden. Het systeem kan het opgegeven bestand niet vinden.":"GeoJSON.NetContrib.WkbConversions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"}

It's in Dutch but I assume the message is clear. GeoJSON.NetContrib.WkbConversions could not be found

MsSqlSpatial BoundingBox is not optional

Prerequisites

  • Put an X between the brackets on this line if you have done all of the following:
    • Reproduced the problem with the latest version.
    • Attempted to debug the issue.
    • Checked the documentation to see if a solution already exists.
    • Checked that your issue is not already filed.

Description

RFC 7946 The GeoJSON Format states:

A GeoJSON object MAY have a member named "bbox" to include information on the coordinate range for its Geometries, Features, or FeatureCollections

But GeoJSON.Net.Contrib.MsSqlSpatial provides no way to make this property optional.

Steps to Reproduce

IGeometryObject geometryObject = sqlGeometry.ToGeoJSONGeometry();
var properties = new Dictionary<string, object>();
int id = 1;

Feature feature =
    new Feature(
        geometryObject,
        properties,
        id.ToString());
feature.BoundingBoxes = null;
return feature;

Expected behavior: [What you expect to happen]

Expect an overload with a flag determining whether or not BoundingBoxes should be set or if null is provided to BoundingBoxes after creating the feature it should be respected.

Actual behavior: [What actually happens]

BoundingBoxes is always populated.

Reproduces how often: [What percentage of the time does it reproduce?]

100%

Versions

You can get this information from the library being used that is causing the issue. Also, please include the OS and what version of the OS you're running.

Version Information: 0.3.1
Operating System: Windows 10

Additional Information

Any additional information, configuration or data that might be necessary to reproduce or resolve the issue.

I will be submitting a pull request with updated methods with an optional parameter and unit tests verifying the behavior as soon as I have the issue number to tag it with.

Implementation in a docker container.

Hello,

First of all, congrats for the solution. Is quite complete and well done!

I am trying to deploy my solution using the Net.Contrib into a docker/container environment and I am having a hard time with the SqlServer.Types.

It keeps hitting the " Unable to load shared library 'SqlServerSpatial140.dll' or one of its dependencies" error.

I have tried put the dll in the app folder, in the usr/bin folder. everywhere.

Have you guys faced a scenario like this? Could you share me some wisdom?

Thanks in advance.

Empty SqlGeography/Geometry MultiPolygon throws NotSupportedException

SqlGeographyBuilder builder = new SqlGeographyBuilder();
builder.SetSrid(4326);
builder.BeginGeography(OpenGisGeographyType.MultiPolygon);
builder.EndGeography();
geoJSON = builder.ConstructedGeography.ToGeoJSONGeometry();

Code above results in the following exception:

An exception of type 'System.NotSupportedException' occurred in GeoJSON.Net.Contrib.MsSqlSpatial.dll but was not handled in user code

Additional information: Geometry type MultiPolygon is not supported yet.

whereas the code below will work fine:

SqlGeographyBuilder builder = new SqlGeographyBuilder();
builder.SetSrid(4326);
builder.BeginGeography(OpenGisGeographyType.MultiPolygon);
builder.BeginGeography(OpenGisGeographyType.Polygon);
builder.EndGeography();
builder.EndGeography();
geoJSON = builder.ConstructedGeography.ToGeoJSONGeometry();

The same also seems to apply to SqlGeometries.

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.