[OpenLayers-Users] compressed and/or binary GML to make the
client side happy
Christopher Schmidt
crschmidt at metacarta.com
Tue Oct 28 17:53:07 EDT 2008
On Tue, Oct 28, 2008 at 02:17:06PM -0700, darrepac wrote:
> XML is not the most efficient method to transmit data and, on the client
> side, when the application try to open the GML, it slows down heavily the
> machine and it takes age to render.
The parsing of the GML is unlikely to be the majority of the time here.
Keep in mind that all of that GML is parsed, and then turned right back
into XML to display in your browser (SVG is XML-based). In addition, the
way that OpenLayers works is to constantly update the DOM to change the
properties of that XML.
In general, you can't display more than about 50 (IE) - 150 (FF2) - 500
(FF3/Safari3) vectors at once in a browser. Any more than that, and you
run into the rendering slowness that you're seeing.
> I was thinking to compress or at least put in binary the GML file to be more
> efficient.
This would be significantly less efficient, since Javascript doesn't
have any real way to interact with binary data.
If you want to try a more efficient transfer format, I recommend
GeoJSON, which transfers in a format which is very lcose to the
browser's internal representation. However, with 4000 features, you're
still going to be completely screwed on performance. You really need to
look into rendering your data with a server: I recommend GeoServer at
this point for beginners, because it's relatively easy to get started
with.
If you only need to show a few features at a time -- say, you don't mind
limiting yourself to 200 -- you could put the data behind GeoSErver or
some other WFS server, and serve with a maxfeatures setting. This would
limit the number of features displayed at once, and you can generally
choose the ordering (so you display highest population areas first, for
example). This would let you maintain your use of vectors, but limit the
performance headaches, with a "zoom in for more info" (to limit the area
of the map further, and therefore request fewer features).
Best of luck,
--
Christopher Schmidt
MetaCarta
More information about the Users
mailing list