[OpenLayers-Dev] [Dev] Re: Vectors in OpenLayers?

Paul Spencer pspencer at dmsolutions.ca
Fri Oct 20 09:09:27 EDT 2006


I'm not keen on using GML as the only representation.  For me, I  
rarely deal with GML and am more often dealing with WKT.

I am also hesitant to agree to having the digitizing tools generate  
GML that is then processed into Geometry->Shape ... that seems quite  
awkward to me.

I suggest that the architecture support serializing Geometries/Shapes  
into something ... those of us that are interested in implementing  
support for a particular format can implement it.

Then digitizing/editing tools can generically operate on Shapes and  
be part of the generic graphics lib.  Remember that one of our design  
goals was to build a graphics lib independent of the GIS part, that  
could be used as a stand-alone component.

Cheers

Paul

On 20-Oct-06, at 7:15 AM, Cameron Shorter wrote:

> Bart van den Eijnden (OSGIS) wrote:
>> Also, if somebody starts drawing new geometries from scratch, you  
>> will need a way to generate GML to insert them using a WFS. So not  
>> in all use cases will the client already have the data in GML format.
>
> We already cover this use case in Mapbuilder, and I suggest we use  
> the same design pattern in this design.
>
> When a User draws on a map, we process the mouseActions and create  
> a GML Layer. The GML Layer is rendered the normal way GML->Geometry  
> Classes->Vector Renderer.
>
> Then when the user presses the SAVE button, you build a WFS  
> Transaction from the GML and send it to the server.
>
> So there is no need for serialising from Geometry->GML.
>
>> Cameron, are you suggesting to go for one format (WKT or GML), and  
>> then use the server-side to transform if necessary?
>
> I think it will be a rare user requirement to convert from WKT->GML  
> or visa-versa in a Web Client. So I don't think it is worth  
> spending too much time addressing yet.
>
>> If so, would you go for WKT or GML? In my opinion GML is the most  
>> logical option, it can always be transformed server-side to WKT if  
>> you need to go to something like PostGIS directly (without a WFS),  
>> since mostly we will talk to OGC web services and not to something  
>> like PostGIS directly. Disadvantage is that its structures are  
>> more elaborate than WKT.
>
> I agree that GML would probably be better.
> We have quite a bit of experience and code dealing with GML and WFS  
> in Mapbuilder, and we should be able to reuse that.
>
>> Best regards,
>> Bart
>> Cameron Shorter schreef:
>>> I'm wondering whether we will need to create a Geometry->GML  
>>> serialiser.
>>> In an application which uses GML, the rendering logic will go:
>>>
>>> GML -> Geometry Classes -> Vector Rendering HTML
>>>
>>> Ie, the client will already have the data in GML format.
>>>
>>> If the user edits features, then we can have the tools update the  
>>> data source (GML in this case) which in turn will propagate the  
>>> update though to the Geometry and Renderer.
>>>
>>> The other reason you might want to serialise is so that you can  
>>> convert from one format to another, eg WKT->Geometry->GML or  
>>> similar. However I suggest we keep vector transformation on the  
>>> server, probably as a web service.
>>>
>>> Paul Spencer wrote:
>>>
>>>> For you maybe ;)  GML would be another good output choice I guess
>>>>
>>>> Paul
>>>>
>>>> On 19-Oct-06, at 3:44 AM, Bart van den Eijnden (OSGIS) wrote:
>>>>
>>>>
>>>>> Will there also be an option to serialize the objects as GML?
>>>>>
>>>>> Since interaction will mostly be against OGC Web Services.
>>>>>
>>>>> Best regards,
>>>>> Bart
>>>>>
>>>>> -- 
>>>>> Bart van den Eijnden
>>>>> OSGIS, Open Source GIS
>>>>> http://www.osgis.nl
>>>>>
>>>>>
>>>>> --------- Oorspronkelijk bericht --------
>>>>> Van: Paul Spencer <pspencer at dmsolutions.ca>
>>>>> Naar: Pierre GIRAUD <bluecarto at gmail.com>
>>>>> Cc: dev at openlayers.org
>>>>> Onderwerp: Re: [OpenLayers-Dev] [Dev]  Re: Vectors in OpenLayers?
>>>>> Datum: 19/10/06 00:09
>>>>>
>>>>>
>>>>>> Hi Pierre,
>>>>>>
>>>>>> I haven't looked at the code but I think that this will be  
>>>>>> needed in
>>>>>> some sort of factory object that can create Geometry (and  
>>>>>> associated
>>>>>> Shape) objects from WKT.  We are a bit early for implementation
>>>>>> details right now (despite the fact that I've already done a  
>>>>>> bunch of
>>>>>> implementation), but when the design is finalized, we'll need  
>>>>>> this
>>>>>> piece.
>>>>>>
>>>>>> This reminds me that Geometry objects need to be able to  
>>>>>> serialize
>>>>>> themselves as WKT.
>>>>>>
>>>>>> Cheers
>>>>>>
>>>>>> Paul
>>>>>>
>>>>>> On 13-Oct-06, at 12:46 PM, Pierre GIRAUD wrote:
>>>>>>
>>>>>> &gt; I wanna propose you some peace of code for this.
>>>>>> &gt; Hope you'll be able to have a quick look and check if I'm  
>>>>>> the  good
>>>>>> &gt; way.
>>>>>> &gt;
>>>>>> &gt; I tried to follow the &quot;factory&quot; pattern, but  
>>>>>> I'm  not sure I
>>>>>> &gt; implemented it right considering the rest of the  
>>>>>> architecture.
>>>>>> &gt;
>>>>>> &gt; Regards and nice week-end
>>>>>> &gt;
>>>>>> &gt; Pierre
>>>>>> &gt;
>>>>>> &gt; ps : this code might be useable in the current vector  
>>>>>> sandbox
>>>>>> &gt;
>>>>>> &gt; On 10/13/06, Pierre GIRAUD &lt;bluecarto at gmail.com&gt;  
>>>>>> wrote:
>>>>>> &gt;&gt; I don't know if this is a needed functionnality, but  
>>>>>> it can
>>>>>
>>>>>
>>>>> probably
>>>>>
>>>>>> &gt;&gt; help. I was trying to think about and implement a way  
>>>>>> to  add a
>>>>>> &gt;&gt; feature
>>>>>> &gt;&gt; by its WKT string writing.
>>>>>> &gt;&gt;
>>>>>> &gt;&gt; Something like :
>>>>>> &gt;&gt;
>>>>>> &gt;&gt; OpenLayers.Vector.WKT
>>>>>> &gt;&gt;
>>>>>> &gt;&gt; p4 = new OpenLayers.Vector.WKT('POINT(-40 30)');
>>>>>> &gt;&gt;
>>>>>> &gt;&gt; Regards
>>>>>> &gt;&gt;
>>>>>> &gt;&gt; Pierre
>>>>>> &gt;&gt;
>>>>>> &gt;&gt; On 10/13/06, Paul Spencer  
>>>>>> &lt;pspencer at dmsolutions.ca&gt;  wrote:
>>>>>> &gt;&gt; &gt; Thanks Chris :)
>>>>>> &gt;&gt; &gt;
>>>>>> &gt;&gt; &gt; Performance really sucks if you add a lot of   
>>>>>> features.  I
>>>>>
>>>>>
>>>>> wrote a
>>>>>
>>>>>> &gt;&gt; &gt; quick loop to add a 1 degree box every 10  
>>>>>> degrees and
>>>>>
>>>>>
>>>>> brought my
>>>>>
>>>>>> &gt;&gt; &gt; firefox to a halt.  Profiling reveals a number of
>>>>>
>>>>>
>>>>> problematic
>>>>>
>>>>>> &gt;&gt; areas,
>>>>>> &gt;&gt; &gt; the biggest of which is getPx (of course).
>>>>>> &gt;&gt; &gt;
>>>>>> &gt;&gt; &gt; I've done some optimization that improves   
>>>>>> performance in
>>>>>
>>>>>
>>>>> this case:
>>>>>
>>>>>> &gt;&gt; &gt;
>>>>>> &gt;&gt; &gt; * remove the call to Pixel.add(x,y) and  
>>>>>> directly  modify the
>>>>>
>>>>>
>>>>> pixel
>>>>>
>>>>>> &gt;&gt; &gt; position - this was a big savings ...
>>>>>> &gt;&gt; &gt;
>>>>>> &gt;&gt; &gt; * cached px location in the Point object based  
>>>>>> on  the bounds
>>>>>
>>>>>
>>>>> of the
>>>>>
>>>>>> &gt;&gt; &gt; containing vectorLayer so getPx is only called  
>>>>>> when the
>>>>>
>>>>>
>>>>> bounds have
>>>>>
>>>>>> &gt;&gt; &gt; actually changed.
>>>>>> &gt;&gt; &gt;
>>>>>> &gt;&gt; &gt; attached is a patch against the sandbox to   
>>>>>> incorporate these
>>>>>
>>>>>
>>>>>> &gt;&gt; changes.
>>>>>> &gt;&gt; &gt;
>>>>>> &gt;&gt; &gt; Next steps for me are:
>>>>>> &gt;&gt; &gt;
>>>>>> &gt;&gt; &gt; * fix rendering in IE and Safari (that was the  
>>>>>> whole  point
>>>>>
>>>>>
>>>>> of using
>>>>>
>>>>>> &gt;&gt; &gt; excanvas)
>>>>>> &gt;&gt; &gt;
>>>>>> &gt;&gt; &gt; * further optimizations, including:
>>>>>> &gt;&gt; &gt;
>>>>>> &gt;&gt; &gt;    o try caching the bounds of each vector and  
>>>>>> test for
>>>>>> &gt;&gt; intersection
>>>>>> &gt;&gt; &gt; with layer bounds before rendering
>>>>>> &gt;&gt; &gt;
>>>>>> &gt;&gt; &gt;    o tighten inner loops and remove deep call  
>>>>>> chains
>>>>>
>>>>>
>>>>> (possibly
>>>>>
>>>>>> &gt;&gt; &gt; putting some of the pixel conversion stuff right  
>>>>>> into
>>>>>
>>>>>
>>>>> convertToPx)
>>>>>
>>>>>> &gt;&gt; &gt;
>>>>>> &gt;&gt; &gt;   o anything else you can think of
>>>>>> &gt;&gt; &gt;
>>>>>> &gt;&gt; &gt; * convenience functions for constructing  
>>>>>> polygons  and lines
>>>>>
>>>>>
>>>>> from
>>>>>
>>>>>> &gt;&gt; &gt; points without having to construct intermediate  
>>>>>> objects
>>>>>> &gt;&gt; &gt;
>>>>>> &gt;&gt; &gt; Other things that need to be done at some point,  
>>>>>> but  not
>>>>>> &gt;&gt; necessarily
>>>>>> &gt;&gt; &gt; for 2.3:
>>>>>> &gt;&gt; &gt;
>>>>>> &gt;&gt; &gt; * refactor the code (what, already?) so that the  
>>>>>> Vector
>>>>>> &gt;&gt; architecture
>>>>>> &gt;&gt; &gt; can support multiple rendering types (Canvas,  
>>>>>> SVG, VML,
>>>>>
>>>>>
>>>>> possibly
>>>>>
>>>>>> &gt;&gt; &gt; others in the future) by introducing  
>>>>>> Layer.Vector  subclasses
>>>>>
>>>>>
>>>>> and a
>>>>>
>>>>>> &gt;&gt; &gt; new Rendering class that knows how to render  
>>>>>> into the
>>>>>
>>>>>
>>>>> sub-classed
>>>>>
>>>>>> &gt;&gt; &gt; layer types
>>>>>> &gt;&gt; &gt;
>>>>>> &gt;&gt; &gt; * refactor styling support to make it less  
>>>>>> specific to
>>>>>
>>>>>
>>>>> Canvas
>>>>>
>>>>>> &gt;&gt; &gt; rendering stuff
>>>>>> &gt;&gt; &gt;
>>>>>> &gt;&gt; &gt; * add some Controls for digitizing and possibly  
>>>>>> editing
>>>>>> &gt;&gt; &gt;
>>>>>> &gt;&gt; &gt; Cheers
>>>>>> &gt;&gt; &gt;
>>>>>> &gt;&gt; &gt; Paul
>>>>>> &gt;&gt; &gt;
>>>>>> &gt;&gt; &gt; On 12-Oct-06, at 7:55 PM, Christopher Schmidt  
>>>>>> wrote:
>>>>>> &gt;&gt; &gt;
>>>>>> &gt;&gt; &gt; &gt; On Thu, Oct 12, 2006 at 05:02:00PM -0400,  
>>>>>> Paul  Spencer
>>>>>
>>>>>
>>>>> wrote:
>>>>>
>>>>>> &gt;&gt; &gt; &gt;&gt; Schuyler, et al
>>>>>> &gt;&gt; &gt; &gt;&gt;
>>>>>> &gt;&gt; &gt; &gt;&gt; attached is a first cut at the vector   
>>>>>> stuff.  It
>>>>>
>>>>>
>>>>> extracts
>>>>>
>>>>>> &gt;&gt; over an
>>>>>> &gt;&gt; &gt; &gt;&gt; existing openlayers folder and  
>>>>>> contains  only the
>>>>>
>>>>>
>>>>> new files
>>>>>
>>>>>> &gt;&gt; I've added
>>>>>> &gt;&gt; &gt; &gt;&gt; plus a change to OpenLayers.js to load  
>>>>>> the  extra
>>>>>
>>>>>
>>>>> files by
>>>>>
>>>>>> &gt;&gt; default
>>>>>> &gt;&gt; &gt; &gt;&gt; (except for excanvas for some reason ;)).
>>>>>> &gt;&gt; &gt; &gt;&gt;
>>>>>> &gt;&gt; &gt; &gt;&gt; There is a vector.html in the examples  
>>>>>> folder.
>>>>>> &gt;&gt; &gt; &gt;
>>>>>> &gt;&gt; &gt; &gt; This code, with some improvements from  
>>>>>> Schuyler  and I,
>>>>>
>>>>>
>>>>> is now
>>>>>
>>>>>> &gt;&gt; in place
>>>>>> &gt;&gt; &gt; &gt; in a sandbox in the OpenLayers SVN. You  
>>>>>> can  check out
>>>>>
>>>>>
>>>>> with:
>>>>>
>>>>>> &gt;&gt; &gt; &gt;
>>>>>> &gt;&gt; &gt; &gt; svn co http://svn.openlayers.org/sandbox/ 
>>>>>> sderle/ vector/
>>>>>> &gt;&gt; &gt; &gt;
>>>>>> &gt;&gt; &gt; &gt; You can try it out at:
>>>>>> &gt;&gt; &gt; &gt;
>>>>>> &gt;&gt; &gt; &gt;
>>>>>
>>>>>
>>>>> http://openlayers.org/~crschmidt/vector/examples/vector.html
>>>>>
>>>>>> &gt;&gt; &gt; &gt;
>>>>>> &gt;&gt; &gt; &gt; Click once to start drawing a line --  
>>>>>> click  again to
>>>>>
>>>>>
>>>>> end it.
>>>>>
>>>>>> &gt;&gt; &gt; &gt;
>>>>>> &gt;&gt; &gt; &gt; FF only at the moment.
>>>>>> &gt;&gt; &gt; &gt;
>>>>>> &gt;&gt; &gt; &gt; Cool stuff, Paul, thanks for getting the  
>>>>>> ball  rolling
>>>>>
>>>>>
>>>>> on this.
>>>>>
>>>>>> &gt;&gt; &gt; &gt; --
>>>>>> &gt;&gt; &gt; &gt; Christopher Schmidt
>>>>>> &gt;&gt; &gt; &gt; Web Developer
>>>>>> &gt;&gt; &gt;
>>>>>> &gt;&gt; &gt;
>>>>>
>>>>>
>>>>> +----------------------------------------------------------------- 
>>>>> +
>>>>>
>>>>>> &gt;&gt; &gt; |Paul Spencer
>>>>>
>>>>>
>>>>> pspencer at dmsolutions.ca    |
>>>>>
>>>>>> &gt;&gt; &gt;
>>>>>
>>>>>
>>>>> +----------------------------------------------------------------- 
>>>>> +
>>>>>
>>>>>> &gt;&gt; &gt; |Chief Technology Officer
>>>>>
>>>>>
>>>>>     |
>>>>>
>>>>>> &gt;&gt; &gt; |DM Solutions Group Inc
>>>>>
>>>>>
>>>>> http://www.dmsolutions.ca/ |
>>>>>
>>>>>> &gt;&gt; &gt;
>>>>>
>>>>>
>>>>> +----------------------------------------------------------------- 
>>>>> +
>>>>>
>>>>>> &gt;&gt; &gt;
>>>>>> &gt;&gt; &gt;
>>>>>> &gt;&gt; &gt;
>>>>>> &gt;&gt; &gt;
>>>>>> &gt;&gt; &gt;
>>>>>> &gt;&gt; &gt;
>>>>>> &gt;&gt; &gt;
>>>>>> &gt;&gt; &gt; _______________________________________________
>>>>>> &gt;&gt; &gt; Dev mailing list
>>>>>> &gt;&gt; &gt; Dev at openlayers.org
>>>>>> &gt;&gt; &gt; http://openlayers.org/mailman/listinfo/dev
>>>>>> &gt;&gt; &gt;
>>>>>> &gt;&gt; &gt;
>>>>>> &gt;&gt; &gt;
>>>>>> &gt;&gt; &gt;
>>>>>> &gt;&gt;
>>>>>> &gt;&gt; &lt;wkt.html&gt;
>>>>>> &gt;&gt; &lt;WKT.js&gt;
>>>>>> &gt; _______________________________________________
>>>>>> &gt; Dev mailing list
>>>>>> &gt; Dev at openlayers.org
>>>>>> &gt; http://openlayers.org/mailman/listinfo/dev
>>>>>>
>>>>>> +---------------------------------------------------------------- 
>>>>>> -+
>>>>>> |Paul Spencer                           
>>>>>> pspencer at dmsolutions.ca    |
>>>>>> +---------------------------------------------------------------- 
>>>>>> -+
>>>>>> |Chief Technology  
>>>>>> Officer                                         |
>>>>>> |DM Solutions Group Inc                http:// 
>>>>>> www.dmsolutions.ca/ |
>>>>>> +---------------------------------------------------------------- 
>>>>>> -+
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> Dev mailing list
>>>>>> Dev at openlayers.org
>>>>>> http://openlayers.org/mailman/listinfo/dev
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>> +-----------------------------------------------------------------+
>>>> |Paul Spencer                          pspencer at dmsolutions.ca    |
>>>> +-----------------------------------------------------------------+
>>>> |Chief Technology Officer                                         |
>>>> |DM Solutions Group Inc                http://www.dmsolutions.ca/ |
>>>> +-----------------------------------------------------------------+
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Dev mailing list
>>>> Dev at openlayers.org
>>>> http://openlayers.org/mailman/listinfo/dev
>>>>
>>>
>>>
>
>
> -- 
> Cameron Shorter
> http://cameron.shorter.net

+-----------------------------------------------------------------+
|Paul Spencer                          pspencer at dmsolutions.ca    |
+-----------------------------------------------------------------+
|Chief Technology Officer                                         |
|DM Solutions Group Inc                http://www.dmsolutions.ca/ |
+-----------------------------------------------------------------+







More information about the Dev mailing list