GithubHelp home page GithubHelp logo

geojson.net's People

Contributors

barrypsmith avatar chgennar-zz avatar dependabot[bot] avatar gzuri avatar janusw avatar jhuntoo avatar jnyrup avatar joergbattermann avatar joerobich avatar justinhachemeister avatar martincarpentier avatar matt-lethargic avatar matthunt-goco avatar monkeywithacupcake avatar nojan1 avatar olejorgensen avatar philo avatar rjhernandez avatar russcam avatar sebastianstehle avatar simoncropp avatar supermihi avatar vincentsels avatar xfischer avatar zacliveearth avatar zeus82 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  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  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  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  avatar  avatar  avatar

geojson.net's Issues

GeoJson is not usable from Windows Phone 8.1

Wp8.1 cert kit reports the following issues with your project

◦This API is not supported for this application type - Api=System.Type.op_Equality(System.Type,System.Type). Module=MSCORLIB, PUBLICKEYTOKEN=B77A5C561934E089. File=GeoJSON.Net.dll.
◦This API is not supported for this application type - Api=System.Type.GetInterface(System.String,System.Boolean). Module=MSCORLIB, PUBLICKEYTOKEN=B77A5C561934E089. File=GeoJSON.Net.dll.
◦This API is not supported for this application type - Api=System.Type.op_Inequality(System.Type,System.Type). Module=MSCORLIB, PUBLICKEYTOKEN=B77A5C561934E089. File=GeoJSON.Net.dll.
◦This API is not supported for this application type - Api=System.String.Format(System.String,System.Object). Module=MSCORLIB, PUBLICKEYTOKEN=B77A5C561934E089. File=GeoJSON.Net.dll.

I think the project should be transformed to a PCL lib.

Error setting value to CRS on featurecollection

Not sure if it's a bug, something not implemented or just me being stupid but i'm getting an error when deserializing a geojson. I've used geojson.net to process about 20 wfs services but this one is a little different.

the url is : CLICK

Only one difference in the 20 other services and this one and that is the CRS part.
Working:
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::31370" } }

Not working:
"crs": { "type": "EPSG", "properties": { "code": "31370" } }

When I do a couple of string replacements, it works so i'm assuming it has something to do with geojson.net and not the service.
A couple of string replacements solve the problem but that's not really the way to go, i think 😉

Can't parse MultiPolygon

Hello!

I am unable to parse the following MultiPolygon from http://geojsonlint.com/

{
    "type": "MultiPolygon",
    "coordinates": [
        [
            [
                [
                    -84.32281494140625,
                    34.9895035675793
                ],
                [
                    -84.29122924804688,
                    35.21981940793435
                ],
                [
                    -84.24041748046875,
                    35.25459097465022
                ],
                [
                    -84.22531127929688,
                    35.266925688950074
                ],
                [
                    -84.20745849609375,
                    35.26580442886754
                ],
                [
                    -84.19921875,
                    35.24674063355999
                ],
                [
                    -84.16213989257812,
                    35.24113278166642
                ],
                [
                    -84.12368774414062,
                    35.24898366572645
                ],
                [
                    -84.09072875976562,
                    35.24898366572645
                ],
                [
                    -84.08798217773438,
                    35.264683153268116
                ],
                [
                    -84.04266357421875,
                    35.27701633139884
                ],
                [
                    -84.03030395507812,
                    35.291589484566124
                ],
                [
                    -84.0234375,
                    35.306160014550784
                ],
                [
                    -84.03305053710936,
                    35.32745068492882
                ],
                [
                    -84.03579711914062,
                    35.34313496028189
                ],
                [
                    -84.03579711914062,
                    35.348735749472546
                ],
                [
                    -84.01657104492188,
                    35.35545618392078
                ],
                [
                    -84.01107788085938,
                    35.37337460834958
                ],
                [
                    -84.00970458984374,
                    35.39128905521763
                ],
                [
                    -84.01931762695312,
                    35.41479572901859
                ],
                [
                    -84.00283813476562,
                    35.429344044107154
                ],
                [
                    -83.93692016601562,
                    35.47409160773029
                ],
                [
                    -83.91220092773438,
                    35.47632833265728
                ],
                [
                    -83.88885498046875,
                    35.504282143299655
                ],
                [
                    -83.88473510742186,
                    35.516578738902936
                ],
                [
                    -83.8751220703125,
                    35.52104976129943
                ],
                [
                    -83.85314941406249,
                    35.52104976129943
                ],
                [
                    -83.82843017578125,
                    35.52104976129943
                ],
                [
                    -83.8092041015625,
                    35.53446133418443
                ],
                [
                    -83.80233764648438,
                    35.54116627999813
                ],
                [
                    -83.76800537109374,
                    35.56239491058853
                ],
                [
                    -83.7432861328125,
                    35.56239491058853
                ],
                [
                    -83.71994018554688,
                    35.56239491058853
                ],
                [
                    -83.67050170898438,
                    35.569097520776054
                ],
                [
                    -83.6334228515625,
                    35.570214567965984
                ],
                [
                    -83.61007690429688,
                    35.576916524038616
                ],
                [
                    -83.59634399414061,
                    35.574682600980914
                ],
                [
                    -83.5894775390625,
                    35.55904339525896
                ],
                [
                    -83.55239868164062,
                    35.56574628576276
                ],
                [
                    -83.49746704101562,
                    35.563512051219696
                ],
                [
                    -83.47000122070312,
                    35.586968406786475
                ],
                [
                    -83.4466552734375,
                    35.60818490437746
                ],
                [
                    -83.37936401367188,
                    35.63609277863135
                ],
                [
                    -83.35739135742188,
                    35.65618041632016
                ],
                [
                    -83.32305908203124,
                    35.66622234103479
                ],
                [
                    -83.3148193359375,
                    35.65394870599763
                ],
                [
                    -83.29971313476561,
                    35.660643649881614
                ],
                [
                    -83.28598022460938,
                    35.67180064238771
                ],
                [
                    -83.26126098632811,
                    35.6907639509368
                ],
                [
                    -83.25714111328125,
                    35.69968630125201
                ],
                [
                    -83.25576782226562,
                    35.715298012125295
                ],
                [
                    -83.23516845703125,
                    35.72310272092263
                ],
                [
                    -83.19808959960936,
                    35.72756221127198
                ],
                [
                    -83.16238403320312,
                    35.753199435570316
                ],
                [
                    -83.15826416015625,
                    35.76322914549896
                ],
                [
                    -83.10333251953125,
                    35.76991491635478
                ],
                [
                    -83.08685302734375,
                    35.7843988251953
                ],
                [
                    -83.0511474609375,
                    35.787740890986576
                ],
                [
                    -83.01681518554688,
                    35.78328477203738
                ],
                [
                    -83.001708984375,
                    35.77882840327371
                ],
                [
                    -82.96737670898438,
                    35.793310688351724
                ],
                [
                    -82.94540405273438,
                    35.820040281161
                ],
                [
                    -82.9193115234375,
                    35.85121343450061
                ],
                [
                    -82.9083251953125,
                    35.86902116501695
                ],
                [
                    -82.90557861328125,
                    35.87792352995116
                ],
                [
                    -82.91244506835938,
                    35.92353244718235
                ],
                [
                    -82.88360595703125,
                    35.94688293218141
                ],
                [
                    -82.85614013671875,
                    35.951329861522666
                ],
                [
                    -82.8424072265625,
                    35.94243575255426
                ],
                [
                    -82.825927734375,
                    35.92464453144099
                ],
                [
                    -82.80670166015625,
                    35.927980690382704
                ],
                [
                    -82.80532836914062,
                    35.94243575255426
                ],
                [
                    -82.77923583984375,
                    35.97356075349624
                ],
                [
                    -82.78060913085938,
                    35.99245209055831
                ],
                [
                    -82.76138305664062,
                    36.00356252895066
                ],
                [
                    -82.69546508789062,
                    36.04465753921525
                ],
                [
                    -82.64465332031249,
                    36.060201412392914
                ],
                [
                    -82.61306762695312,
                    36.060201412392914
                ],
                [
                    -82.60620117187499,
                    36.033552893400376
                ],
                [
                    -82.60620117187499,
                    35.991340960635405
                ],
                [
                    -82.60620117187499,
                    35.97911749857497
                ],
                [
                    -82.5787353515625,
                    35.96133453736691
                ],
                [
                    -82.5677490234375,
                    35.951329861522666
                ],
                [
                    -82.53067016601562,
                    35.97244935753683
                ],
                [
                    -82.46475219726562,
                    36.006895355244666
                ],
                [
                    -82.41668701171875,
                    36.070192281208456
                ],
                [
                    -82.37960815429686,
                    36.10126686921446
                ],
                [
                    -82.35488891601562,
                    36.117908916563685
                ],
                [
                    -82.34115600585936,
                    36.113471382052175
                ],
                [
                    -82.29583740234375,
                    36.13343831245866
                ],
                [
                    -82.26287841796874,
                    36.13565654678543
                ],
                [
                    -82.23403930664062,
                    36.13565654678543
                ],
                [
                    -82.2216796875,
                    36.154509006695
                ],
                [
                    -82.20382690429688,
                    36.15561783381855
                ],
                [
                    -82.19009399414062,
                    36.144528857027744
                ],
                [
                    -82.15438842773438,
                    36.15007354140755
                ],
                [
                    -82.14065551757812,
                    36.134547437460064
                ],
                [
                    -82.1337890625,
                    36.116799556445024
                ],
                [
                    -82.12142944335938,
                    36.10570509327921
                ],
                [
                    -82.08984375,
                    36.10792411128649
                ],
                [
                    -82.05276489257811,
                    36.12678323326429
                ],
                [
                    -82.03628540039062,
                    36.12900165569652
                ],
                [
                    -81.91268920898438,
                    36.29409768373033
                ],
                [
                    -81.89071655273438,
                    36.30959215409138
                ],
                [
                    -81.86325073242188,
                    36.33504067209607
                ],
                [
                    -81.83029174804688,
                    36.34499652561904
                ],
                [
                    -81.80145263671875,
                    36.35605709240176
                ],
                [
                    -81.77947998046874,
                    36.34610265300638
                ],
                [
                    -81.76162719726562,
                    36.33835943134047
                ],
                [
                    -81.73690795898438,
                    36.33835943134047
                ],
                [
                    -81.71905517578125,
                    36.33835943134047
                ],
                [
                    -81.70669555664062,
                    36.33504067209607
                ],
                [
                    -81.70669555664062,
                    36.342784223707234
                ],
                [
                    -81.72317504882812,
                    36.357163062654365
                ],
                [
                    -81.73278808593749,
                    36.379279167407965
                ],
                [
                    -81.73690795898438,
                    36.40028364332352
                ],
                [
                    -81.73690795898438,
                    36.41354670392876
                ],
                [
                    -81.72454833984374,
                    36.423492513472326
                ],
                [
                    -81.71768188476562,
                    36.445589751779174
                ],
                [
                    -81.69845581054688,
                    36.47541104282962
                ],
                [
                    -81.69845581054688,
                    36.51073994146672
                ],
                [
                    -81.705322265625,
                    36.53060536411363
                ],
                [
                    -81.69158935546875,
                    36.55929085774001
                ],
                [
                    -81.68060302734375,
                    36.56480607840351
                ],
                [
                    -81.68197631835938,
                    36.58686302344181
                ],
                [
                    -81.04202270507812,
                    36.56370306576917
                ],
                [
                    -80.74264526367186,
                    36.561496993252575
                ],
                [
                    -79.89120483398438,
                    36.54053616262899
                ],
                [
                    -78.68408203124999,
                    36.53943280355122
                ],
                [
                    -77.88345336914062,
                    36.54053616262899
                ],
                [
                    -76.91665649414062,
                    36.54163950596125
                ],
                [
                    -76.91665649414062,
                    36.55046568575947
                ],
                [
                    -76.31103515625,
                    36.551568887374
                ],
                [
                    -75.79605102539062,
                    36.54936246839778
                ],
                [
                    -75.6298828125,
                    36.07574221562703
                ],
                [
                    -75.4925537109375,
                    35.82226734114509
                ],
                [
                    -75.3936767578125,
                    35.639441068973916
                ],
                [
                    -75.41015624999999,
                    35.43829554739668
                ],
                [
                    -75.43212890625,
                    35.263561862152095
                ],
                [
                    -75.487060546875,
                    35.18727767598896
                ],
                [
                    -75.5914306640625,
                    35.17380831799959
                ],
                [
                    -75.9210205078125,
                    35.04798673426734
                ],
                [
                    -76.17919921875,
                    34.867904962568744
                ],
                [
                    -76.41540527343749,
                    34.62868797377061
                ],
                [
                    -76.4593505859375,
                    34.57442951865274
                ],
                [
                    -76.53076171875,
                    34.53371242139567
                ],
                [
                    -76.5911865234375,
                    34.551811369170494
                ],
                [
                    -76.651611328125,
                    34.615126683462194
                ],
                [
                    -76.761474609375,
                    34.63320791137959
                ],
                [
                    -77.069091796875,
                    34.59704151614417
                ],
                [
                    -77.376708984375,
                    34.45674800347809
                ],
                [
                    -77.5909423828125,
                    34.3207552752374
                ],
                [
                    -77.8326416015625,
                    33.97980872872457
                ],
                [
                    -77.9150390625,
                    33.80197351806589
                ],
                [
                    -77.9754638671875,
                    33.73804486328907
                ],
                [
                    -78.11279296875,
                    33.8521697014074
                ],
                [
                    -78.2830810546875,
                    33.8521697014074
                ],
                [
                    -78.4808349609375,
                    33.815666308702774
                ],
                [
                    -79.6728515625,
                    34.8047829195724
                ],
                [
                    -80.782470703125,
                    34.836349990763864
                ],
                [
                    -80.782470703125,
                    34.91746688928252
                ],
                [
                    -80.9307861328125,
                    35.092945313732635
                ],
                [
                    -81.0516357421875,
                    35.02999636902566
                ],
                [
                    -81.0516357421875,
                    35.05248370662468
                ],
                [
                    -81.0516357421875,
                    35.137879119634185
                ],
                [
                    -82.3150634765625,
                    35.19625600786368
                ],
                [
                    -82.3590087890625,
                    35.19625600786368
                ],
                [
                    -82.40295410156249,
                    35.22318504970181
                ],
                [
                    -82.4688720703125,
                    35.16931803601131
                ],
                [
                    -82.6885986328125,
                    35.1154153142536
                ],
                [
                    -82.781982421875,
                    35.06147690849717
                ],
                [
                    -83.1060791015625,
                    35.003003395276714
                ],
                [
                    -83.616943359375,
                    34.99850370014629
                ],
                [
                    -84.05639648437499,
                    34.985003130171066
                ],
                [
                    -84.22119140625,
                    34.985003130171066
                ],
                [
                    -84.32281494140625,
                    34.9895035675793
                ]
            ],
            [
                [
                    -75.69030761718749,
                    35.74205383068037
                ],
                [
                    -75.5914306640625,
                    35.74205383068037
                ],
                [
                    -75.5419921875,
                    35.585851593232356
                ],
                [
                    -75.56396484375,
                    35.32633026307483
                ],
                [
                    -75.69030761718749,
                    35.285984736065735
                ],
                [
                    -75.970458984375,
                    35.16482750605027
                ],
                [
                    -76.2066650390625,
                    34.994003757575776
                ],
                [
                    -76.300048828125,
                    35.02999636902566
                ],
                [
                    -76.409912109375,
                    35.07946034047981
                ],
                [
                    -76.5252685546875,
                    35.10642805736423
                ],
                [
                    -76.4208984375,
                    35.25907654252574
                ],
                [
                    -76.3385009765625,
                    35.294952147406576
                ],
                [
                    -76.0858154296875,
                    35.29943548054543
                ],
                [
                    -75.948486328125,
                    35.44277092585766
                ],
                [
                    -75.8660888671875,
                    35.53669637839501
                ],
                [
                    -75.772705078125,
                    35.567980458012094
                ],
                [
                    -75.706787109375,
                    35.634976650677295
                ],
                [
                    -75.706787109375,
                    35.74205383068037
                ],
                [
                    -75.69030761718749,
                    35.74205383068037
                ]
            ]
        ],
        [
            [
                [
                    -109.0283203125,
                    36.98500309285596
                ],
                [
                    -109.0283203125,
                    40.97989806962013
                ],
                [
                    -102.06298828125,
                    40.97989806962013
                ],
                [
                    -102.06298828125,
                    37.00255267215955
                ],
                [
                    -109.0283203125,
                    36.98500309285596
                ]
            ]
        ]
    ]
}

How to

Hi,
How I use it? Im trying to deserialize it bur JsonConvert.DeserializeObject always give me errors

Add Feature<T> for strongly typed (de)serialization of Feature.Properties

Feature should be added such that properties can be defined by a model. There should be some support for a strongly typed version of properties. The current dictionary representation from an object breaks the use of JsonPropertyAttribute. Of course the reflection could be rewritten using GetCustomAttributes, but it would be more robust to simply use existing mechanisms.

nuget

you've got the nuget spec file but I dont' see your package in the feed. Did you add it?

Can't parse LineString

Trying to parse the json below, errors with "Value cannot be null."

{ "type": "LineString","coordinates": [ [-81.586856, 41.102725], [-81.586856, 41.102725] ]}

Trying to parse the above string with:

JsonConvert.DeserializeObject<GeoJSON.Net.Geometry.LineString>(lineString, new GeoJSON.Net.Converters.LineStringConverter());

cannot check null feature

I had some code that just made sure that no one passed a null object as a feature, just something like:

private void DoSomethingWithFeature(GeoJSON.Net.Feature.Feature f)
{
     if (f !=null).....
}

Since the update from 1.0.62 to 1.1.63, this value errors out with a null exception every time, regardless if f is actually null or not. Is there a different way i should be checking this parameter?

Coordinate Order

Hi,

working on a fork of your project I noticed that the order you're using in your GeographicPosition class is following:

Latitude, Longitude, Altitude

However the documentation requires the following order:

Point coordinates are in x, y order (easting, northing for projected coordinates, longitude, latitude for geographic coordinates):

And:

A position is represented by an array of numbers. There must be at least two elements, and may be more. The order of elements must follow x, y, z order (easting, northing, altitude for coordinates in a projected coordinate reference system, or longitude, latitude, altitude for coordinates in a geographic coordinate reference system).

http://geojson.org/geojson-spec.html

Is your order wrong or am I?

Cheers,
Fred

Feature.Equals ignores id and properties

The equality comparison methods of the Feature class ignore the Id and Properties properties, resulting in e.g. two features with different Id being equal if the geometries are the same.

Since there is a unit test explicitly covering this behavior, I assume it is by design, but I don't understand the rationale behind; for me, it seems very counter-intuitiive and potential source of hard to trackdown bugs. Can somebody give me a clue?

No Json.NET version in the nuspec

The GeoJSON.Net nuspec doesn't include any version information about the version of Json.NET it depends on. This is important, given the ubiquity of Json.NET, and therefore the likelihood of multiple (and therefore, possibly conflicting) transitive dependencies. You should use the minimum version of Json.NET that works.

CRS type issue

Hi, we are having an issue with GeoJSON.net and openlayers 3. The problem is that GeoJSON.Net provides CRS.types with upper-case first letter (i.e. "Name") when openlayers is expecting a lowercase string "name" and throws an CRS.type invalid exception. And the GeoJSON spec says - " the value of its "type" member must be the string "name"/"link" ". I guess the keyword here is "must" and the same issue might be applicable when working with other libraries as well.

Properties object on Geojson

I'd like to put together a pull request to expose out the properties objects, like in the example here http://geojson.org/geojson-spec.html#examples, on the geojson objects I'm deserialising. Given the flexibility of the spec around properties I'd like to pull them in as a JObject which can be access.

Any objections to me putting together this PR?

Porting the library to dnxcore50

Have anyone made an attempt to port the library to CoreCLR/dnxcore50?

I'm building an ASP.NET 5/ASP.NET Core project and would like to use this library. I'd might have a stab at porting it. Opening this issue to discuss if anyone have attempted it so far.

Respect the formatting of the serializer when writing json for MultiPolygon

The current implementation when writing the json for a MultiPolygon uses the default .ToString() method on a JArray which will write json with indented formatting. This causes problems in specific cases where the resulting json must have no formatting applied e.g. when using GeoJSON.NET in conjunction with Elasticsearch's geo_shape type, the Elasticsearch Bulk API uses newline (\n) characters to delimit the actions within the bulk request and the current formatting for a MultiPolygon causes exceptions similar to:

Unexpected end-of-input: expected close marker for ARRAY (from [Source: [B@5ee6d620; line: 1, column: 2])
at [Source: [B@5ee6d620; line: 2, column: 238]

I can send a pull request with a fix

GeographicPosition private setters prevents Deserialization

I was trying to deserialize (with Newtonsoft's JsonConvert) a GeographicPosition object which I recieved from my server unsuccessfully.
I even tried something much more simple, creating a new GeographicPosition object, serializing and deserializing it - something which also "failed", the GeographicPosition object constructed with values (1,2,3), serialized into a correct json object and got deserialized into a GeographicPosition (0,0,0).
After some research I noticed that GeographicPosition class is making use of private setters which were the ones that prevented the correct deserialization, removing them solved the issue.
So, my questions are :

  1. Why GeographicPosition is using private setters ? What's the benefit ?
  2. Do I expose myself to any kind of vulnerabilities by setting them as non-private methods ?
  3. Are there any alternative methods ? good practices ?

Thank you.

What is my mistake in this case?

I have a Web API that have a request model contain a property like this:
public GeoJSON.Net.Geometry.Point Location { get; set; }
I send the value for this property like this:
Location:{ type:"Point", coordinates: [100.0, 120.0]}
but my model is ModelState.IsValid is false.
Thanks for your advises.

Setting to disable camelCase serialisation on feature properties names.

Hi

Great software! My apologies if this is a duplicate issue.

I have the following situation:

I am using your library to pull data out of a database and serve it to a client. However, the client is expecting the feature property names to be the same as those in the database (case-sensitive) e.g. Name, Area, Region.

Is it possible to place a setting on the serialiser to ignore case for property names only?

Converters.PolygonConverter

You will need to change your Regex to handle -90,90 and -180,180
From
MatchCollection coordinateGroups = Regex.Matches(inputJsonValue, @"([\d+.\d+,\d+.\d+[,\d+.\d+]])");
To
MatchCollection coordinateGroups = Regex.Matches(inputJsonValue, @"([-+]?\d{1,2}([.]\d+)?),\s
([-+]?\d{1,3}([.]\d+)?)");

and for each point
var coordinates = Regex.Match(coordinatePair.Value, @"(?[-+]?\d{1,2}([.]\d+)?),\s_(?[-+]?\d{1,3}([.]\d+)?)_");

Stuart

Simple example

Hi friend, good work

I'm soory but I didn't success create some example of GeoJson.
Please attach some example

Deserialization for interior polygon

The PolygonConverter only works with single-layer polygons, any polygon with a hole will not work with this method.

I will be creating a solution to this.

Nuget version is not updated

When I use Nuget package of GeoJSON.NET for deserializing of FeatureCollection it just throws Not Implemented exception. I've downloaded project, build it and add dll and it works fine, so it looks like you should update the nuget package with the latest fixes.

No types implement ICRSObject

I was trying to use the Crs property on Feature and I realized that no types can be assigned or read from that property as the interface ICRSObject is not implemented by any types.

[Question] Why are Coordinates in LineString (and other classes) read-only?

Hi there,
first of all thanks for this great library.

I have a use case where I want to replace the coordinates of a LineString (because they were simplified using https://github.com/imshz/simplify-net). To do this i create a new LineString object and overwrite the existing one in the Coordinates object above.
This doesn't work, because I don't have a setter. Is there a reason this was done the way it is?

(To solve my issue I imported the GeoJSON.Net project and added setters.)

Looping coördinates

I'm deserializing a Json file with GeoJSON.net, which works fine in this way:

var feature = JsonConvert.DeserializeObject<FeatureCollection>(text);

But I can't find how to loop this deserialized 'thing' to get the coordinates (lat/lon) of each multilinestring...

Can someone help me?

Thanks!

GeographicPosition: order of longitude, latitude

Why the decision to supply latitude and longitude to the GeographicPosition constructor in the opposite order of the GeoJSON spec? This makes it rather unintuitive, especially when using coordinates in anything other than 4326.

From https://tools.ietf.org/html/rfc7946#section-3.1.1:

"A position is an array of numbers. There MUST be two or more elements. The first two elements are longitude and latitude, or easting and northing, precisely in that order and using decimal numbers. Altitude or elevation MAY be included as an optional third element."

Maybe this could be corrected in the new Position class?

Code References Obsolete Specifications

All of the code references the 2008 spec, these have been superseded by RFC7946. Change code comments to reflect this and also double check that the code reflects these new specifications.

NB: Note to myself so can link PR back, rather than a complaint or bug for anyone else.

Duplicate class MultiPointConverter.cs

Hi,

I am not sure if that's a big issue but I noticed that there are two MultiPointConverter classes.
One in GeoJSON.Net.Converters and one in GeoJSON.Net.Geometry.
Can be a little confusing when reading quickly the library's contents.

Regards,

GeoJson Version 1.1.64 - Method not found - GeoJson.Net.Geometry.Polygon.get_Coordinates()

I formally used version 0.1.47 and it worked well for me when I try to get coordinates of a polygon, I have just updated to the above version, but gives an error when I try to access the coordinates of a polygon.

Additional information: Method not found: 'System.Collections.Generic.List`1<GeoJSON.Net.Geometry.LineString> GeoJSON.Net.Geometry.Polygon.get_Coordinates()'.

Feature equality problem

Hi,

Feature inherits the Equals implementation from GeoJSONObject. The Equals method returns true if both compared object have the property BoundingBox set to null.

One problem I encountered because of this it that collection.Features.IndexOf(myFeature) will always return 0, regardless of the actual index of the item in the list (given that all bboxes are null).

One workaround is to use ReferenceEquals instead: collection.Features.FinIndex(x => object.ReferenceEquals(x, myFeature))

Thanks for this lib!

geoJson and web api

Hi,
i'm posting a geoJSON object to a web api method, with this signature

    [HttpPost]
    public GeoJSON.Net.Feature.Feature Post(GeoJSON.Net.GeoJSONObject obj)

but unfortunately there's no way to get obj deserialized from json.
What i'm doing wrong? is web api supported ?

DbGeometry + PolygonConverter = WellKnownText

Hi, I'm storing my polygon on MS SQL Server with EntityFramework's DbGeometry property. When I use the PolygonConverter I'm still getting the WKT format of the data, no the GeoJson.

        [JsonConverter(typeof (PolygonConverter))]
        public DbGeometry Coordenadas { get; set; }
console.log(data.Options[0].Coordenadas);

wkt

Do I need to change my data type or create my own fork of this library?

LineString.IsClosed() is incorrectly attempting to cast Positions.

Since the constructor of LineString (on line 32) will accept the IPosition object to create the collections of coordinates

public LineString(IEnumerable<IPosition> coordinates)

any function that tests the position collection for "correctness" such as .IsClosed() should test those positions using the acceptable Interface.

        public bool IsClosed()
        {
            var firstCoordinate = Coordinates[0] as Position;

            if (firstCoordinate != null)
            {
                var lastCoordinate = Coordinates[Coordinates.Count - 1] as Position;
               
                return firstCoordinate.Latitude == lastCoordinate.Latitude
                       && firstCoordinate.Longitude == lastCoordinate.Longitude
                       && firstCoordinate.Altitude == lastCoordinate.Altitude;
            }

            return Coordinates[0].Equals(Coordinates[Coordinates.Count - 1]);
        }

Array

I have an array of GeoJson Points and it seems invalid at http://geojsonlint.com/

List<Point> ar = new List<Point>();      
foreach(DataRow dr in dt.Rows)
{
    ar.Add((Point)MsSqlSpatialConvert.ToGeoJSONGeometry((SqlGeography)dr["SsLoc"]));
}
var serializer = new JsonSerializer();
serializer.Serialize(Response.Output, ar.ToArray());

Perhaps the serializer should serialize arrays to GeometryCollection or maybe FeatureCollection
http://geojson.org/geojson-spec.html#geometry-collection

What are your thoughts? or what am I doing wrong? Looking forward to your response.

tweet

JsonConvert.DeserializeObject<FeatureCollection>() doesn't load each feature's properties value

Hi

Thank you for great product, I start to use this in my new project.
https://github.com/tilemapjp/Turf.Sharp

I found one bug:
JsonConvert.DeserializeObject<FeatureCollection>("...") doesn't load each feature's properties value.
All features have 0 length properties.

Please see attached zip.
It includes two geojson's, one is Points.geojson, FeatureCollection of Point features.
The other is Point.geojson, one Point feature subset of Points.geojson.

If I load Point.geojson by JsonConvert.DeserializeObject<Feature>(), it is successful to load with 3 length properties.
But if I load Points.geojson by JsonConvert.DeserializeObject<FeatureCollection>(), the properties values of each features are 0 length.

Regards,

Geojsons.zip

Point type results in invalid GeoJson when using DefaultValueHandling.Ignore on server API code

If you use the GeoJson library in Azure API app and you use the following code in WebApiConfig to reduce the amount of Json returned by web API:

config.Formatters.JsonFormatter.SerializerSettings.DefaultValueHandling = DefaultValueHandling.Ignore;

Then the Type is not returned for a Point, when the type is "Point" (is default value for GeoJSONObjectType) resulting in an invalid GeoJson format.

You can solve this by using " DefaultValueHandling = DefaultValueHandling.Include)" in GeoJSONObject.cs

[JsonProperty(PropertyName = "type", Required = Required.Always, DefaultValueHandling = DefaultValueHandling.Include)]
[JsonConverter(typeof(StringEnumConverter))]
public GeoJSONObjectType Type { get; internal set; }

You can test this by adapting the unit tests and addding the " new JsonSerializerSettings { DefaultValueHandling = DefaultValueHandling.Ignore }", example:

public void Can_Serialize_With_Lat_Lon_Alt()
{
var point = new Point(new GeographicPosition(53.2455662, 90.65464646, 200.4567));

        var expectedJson = "{\"coordinates\":[90.65464646,53.2455662,200.4567],\"type\":\"Point\"}";

        var actualJson = JsonConvert.SerializeObject(point, new JsonSerializerSettings { DefaultValueHandling = DefaultValueHandling.Ignore });

        JsonAssert.AreEqual(expectedJson, actualJson);
    }

CRS and BoundingBoxes, Required.AllowNull

When I'm trying to deserialize GeoJSON that I work with I got the exception regarding crs property. It occurs because that geoJSON lacks properties crs and bbox, and as I can see from the specification of GeoJSON that properties are not required. That two properties have attribute JsonProperty(Required = Required.AllowNull), which means that they are required but they could be empty. Would it make sense to change to Required.Default, which will make the properties not required?

Reintroduce support for Silverlight

Hi,

I noticed you moved from Profile344 to Profile259 back in January. A major side-effect of this is that the PCL can no longer be used by Silverlight projects.

How would you feel about reinstating Profile344? I don't think its a big job - mostly just avoiding a few of the newer reflection APIs. I can put together a PR, but I thought I'd just check in first in case there are other reasons why this wouldn't be a good idea.

Cheers,

Peter.

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.