NetTopologySuite and DeepEarth Map Control

Aug 20, 2010 at 4:23 AM

Wow - this is an amazing project. After reviewing the SVN trunk code for a couple of hours this opens up so many possibilities for projects I am already working on. Thank you to all the developers!

Now for my stupid question. How does the NetTopologySuite Geometry class relate to the DeepEarth Map Control Geometry Layer?

I would ideally like to pull WKB strings from a PostGIS database and render them. I can see how to get the WKB into a NetTopologySuite LineString object, etc. but then what? Do I simply access the list of coordinates and construct a geometry object that DeepEarth Map Control understands?

Are there any examples I can look at?

Has there been any work done on a WFS client?

thanks, Andy

Developer
Aug 20, 2010 at 4:47 PM
The Geometries/Shapes in the DeepEarth control are based on a class
called "PathControlBase" class in the Geometries folder

this had a property called "Locations"

public ObservableCollection<Location> Locations

public class Location
{
public double Latitude { get; set; }
public double Longitude { get; set; }
public double Altitude { get; set; }
}

PathControlBase is based on GeometryControlBase<IGeometry>

the IGeometry is in the GeoAPI library

and IGeometry is also the interface that the NetTopologySuite
Geometries/Shapes are also based on...


If you actually look at the "LineStringControl in the DeepEarth
Project in the constructor is passes in a
GisSharpBlog.NetTopologySuite.Geometries.LineString

public LineStringControl() : base(new LineString(null))

to access the "GisSharpBlog.NetTopologySuite.Geometries.LineString" in
the DeepEarth LineStringControl
you can use the "GeometryItem" property, e.g. LineStringControl.GeometryItem

if you look at the PointControl, It passes in a
GisSharpBlog.NetTopologySuite.Geometries.Point in it's constructor

and the PolygonControl passes in a
GisSharpBlog.NetTopologySuite.Geometries.Polygon

and in each you access the passed in NetTopologySuite Geomerty via the
"GeometryItem" property

and you should be able to see how you could create more
GeomertyControls like this to work on the DeepEarth Control, based on
the NetTopologySuite Geometries

Hope I explained that ok? :)
Aug 20, 2010 at 4:57 PM
Edited Aug 20, 2010 at 4:58 PM

Great - thanks for the detailed explanation! :)

Andy

Aug 21, 2010 at 3:15 AM

Hi again. I'm looking at the SVN HEAD trunk code and I don't see what you are referring to. What I see is:

LineString is based on PathBase
PathBase is based on GeometryBase
GeometryBase is based on Control

The constructor for LineString takes a line color and thickness.

A search for PathControlBase, GeometryControlBase and LineStringControl in the entire solution gives zero results. A search for IGeometry in the entire solution only returns results inside the GeoAPI and NetTopologySuite projects. Nothing in the DeepEarth map control.

I must be looking at something very different to what you were referring to. Sorry for being a bit thick.

thanks, Andy

P.S. sorry also for filing the same bug three times - Codeplex stopped responding for a while.

Developer
Aug 21, 2010 at 3:24 AM
I am talking about he Latest version in the Silverlight (SL4) Branch
Aug 21, 2010 at 4:02 AM

Ah, ok. I avoided that because I hope for Moonlight support and they haven't reached SL3 yet.

So in the trunk there is no relationship between the NetTopologySuite classes and the DE map control?

Andy

Developer
Aug 21, 2010 at 5:03 AM
No in the SL 3 version it is done differently

But It would not be that hard to take the SL4 geo's and put them into
the SL3 version and replace what is there I think, you would need
replace/update a few things here and there

or

Take the SL4 version and try and get it to compile as SL3, in the
trunk there are versions of the NetTopologySuite etc which are SL3
and there is a SL 3 version of the Rx.Net dlls here
http://msdn.microsoft.com/en-us/devlabs/ee794896.aspx

maybe this might work, would have to give it a try, see if it looks
like it is do-able and not to much work?
Aug 21, 2010 at 5:07 AM
Edited Aug 21, 2010 at 5:32 AM

I might give that a try. Is the bug I reported regarding LineString fixed in the SL4 branch? If so I will keep working with that, otherwise I might stick with the SL3 trunk.

Andy

Developer
Aug 21, 2010 at 5:26 AM
the bug where the geo. flicks to the other side, the fill bug...?

no this still does this in SL4 version
Aug 21, 2010 at 5:34 AM

Yes. Do you think it will get fixed? Being able to put lines on the map and have then show reliably at all zoom levels is I think important in a mapping application.

Andy

Developer
Aug 21, 2010 at 5:36 AM
I downloaded the latest check-in "Change Set 49789"

and compiled and run it ok....

but what happens is the Silverlight control is set as the start up project...

you need to right-click and set the "ExampleControlWeb" website
application as the startup project in Visual Studio and the try run it
and it should run fine

There is a new TileSource set as the default, I added a couple in the
MainPage.xaml.cs file and commented them out
Aug 21, 2010 at 5:38 AM

My problem was that I was missing the Expression Blend 4 SDK. Installing that fixed the exception problems. Strange that it compiled without errors though.

Andy

Developer
Aug 21, 2010 at 5:39 AM
Yes is pretty important that the Geo's stay where they are meant to be...

I can try to fix it, plus I have had a look at the other bug about
resizing the browsers and the geo's not updating there position

I did not write all the project, some other people who are a bit
better developers than me did a lot of this stuff....
but i will try find the problems
Aug 22, 2010 at 7:59 AM

The SL4 works fine in moonlight 3 preview 8. or at least the things i have testet with my prototype worked as intended

 

beware if you intend to use NTS to do any geometry gymnastics then there are a couple of bugs in it

you have to apply my patch to restore the use of PowerCollections

Aug 22, 2010 at 5:51 PM

I see your patch was submitted nearly two months ago. I'm a bit disheartened that it hasn't be incorporated into the SL4 branch or the trunk by a developer so everyone automatically receives it. Will that happen?

Andy

Coordinator
Aug 23, 2010 at 10:01 AM

Sorry that is my fault, we're running branches out of codeplex currently for clients and have not had the time to contribute back.

David had a really go and building geometries with native GeoAPI support in the SL4 branch, seperately we've looked at making a super lean SL4 control with no GeoAPI or NTS at all. I'm not sure waht is more valueable.

The solution to the flipping / disappearing lines/polygons is to find the intersection on the current viewport and add an extra co-ordinate, in fact then you can clip outside the viewport and also increase performance.

LiFo, how have you found NTS overall? We used it here to create geometries and WKB serialisation, I found the GML and WKT not great and the Area/Length calculations relying on reprojection.

Aug 23, 2010 at 4:07 PM
Edited Aug 23, 2010 at 4:08 PM
soulsolutions wrote:
LiFo, how have you found NTS overall? We used it here to create geometries and WKB serialisation, I found the GML and WKT not great and the Area/Length calculations relying on reprojection.

One idea would be to port the GML and WKT support from OpenScales. Actionscript is pretty close to C#. That project is LGPL so the port would have to go into it's own assembly. They also have a WFS (non-transactional so it's simpler) client as well.

Andy

Sep 1, 2010 at 3:14 PM
soulsolutions wrote:

LiFo, how have you found NTS overall? We used it here to create geometries and WKB serialisation, I found the GML and WKT not great and the Area/Length calculations relying on reprojection.

I use DeepEarth for a Program to edit,View and upload gpx traces to OpenStreetMap (it is not in a state where i can share it yet)
I don't use GML or WKT 
since a gpx trace can have thousands of coordinates and DeepEarth is not good at handling many coordinates i have added a couple of display filters
so only the part that is within an expanded bounding box is displayed, and i also use the Douglas peucker simplifying filter when the zoom is below 16

i also use nts for a couple of editing filters like an exclusion filter, eg. i can specify a polygon and all coordinates inside that polygon are excluded

overall i like NTS it works great, the only thing i don't like is that many operations on LineStrings do Node the LineString
so if i have a LineString that is selfintersectiong (witch happens a lot with gpx traces) it is split up in multiple linesegments
therefor i dont use NTS directly on my base types, but only as helper methods for geometry manipulation

Sep 5, 2010 at 7:26 PM
LiFo wrote:
since a gpx trace can have thousands of coordinates and DeepEarth is not good at handling many coordinates i have added a couple of display filters

so only the part that is within an expanded bounding box is displayed, and i also use the Douglas peucker simplifying filter when the zoom is below 16

My conclusion is that TransformUpdate mode is flawed. It distorts the LineStrings badly making high zoom levels unattractive.

Could you elaborate more on when you actually apply the Douglas Peucker filter? Do you do it when the LineString is constructed, or at some point during rendering when the user zooms? How do to apply and remove the filter, i.e. do you switch between more than one geometry layer, keeping unused ones hidden somehow? I tried that kind of approach and it didn't work very well.

Andy

Sep 6, 2010 at 2:53 AM
soulsolutions wrote:

Sorry that is my fault, we're running branches out of codeplex currently for clients and have not had the time to contribute back.

I just submitted a patch. I saw that there have been several users who have submitted patches going back to February 2009! Are you going to incorporate any of them? I suggest you take a look otherwise you will kill community enthusiasm.

Andy

Sep 7, 2010 at 7:46 PM
soulsolutions wrote:

David had a really go and building geometries with native GeoAPI support in the SL4 branch, seperately we've looked at making a super lean SL4 control with no GeoAPI or NTS at all. I'm not sure waht is more valueable.

Would it be possible to make it more modular? I.e. let user's choose if they want to use GeoAPI and/or NTS? For me NTS with the Lifo patch makes the .xap file too large for my application. It's nice to have the NTS functionality but it's also important to keep the download time low I think.

I looked at separating NTS from the SL4 branch but it was like following a rabbit down a hole.

Andy

Oct 13, 2010 at 2:14 PM

WGS and web mercator

Hello,

I tries to combine data from ArcGIS server with Bing maps. The data in ArcGIS server are publiched with with a system called  WGS_1984_Web_Mercator_Auxiliary_Sphere and the coordinates are in meters. From the deep earth application a calculate the coordinates in lat long. That's my problem. How do I convert the lat/long coordinates to the metric format that ArcGIS Server expects?

Best regards,

Johan