[OpenLayers-Users] Large Vector Layer
Scott Davis
scott at davisworld.org
Thu Aug 16 15:41:13 EDT 2007
On Aug 16, 2007, at 12:09 PM, Gregor Mosheh wrote:
> Scott Davis wrote:
>> I have a datalayer that has ~10,000 bus stops (points).
>
> WFS is basically like GeoRSS in that it communicates XML about
> vector data, and that the browser must decipher the XML.
> Differrence 1 is that it can describe more than a point; difference
> 2 is that it's even more verbose and therefore XML parsing is even
> slower.
>
Yeah. The verbosity of GML and the slow/painful browser-side parsing
is what I'm trying to get around. Ultimately I think that GeoJSON is
going to be a nice fit, but it sounds like I'm a month or more away
from a GeoServer + OpenLayers out-of-the-box solution. Hence my
question #1 "Is WFS the right solution for this right now?"
I was looking to GeoRSS as a solution that was lighter-weight than
full GML and also supported OOTB by both GS and OL. As far as GeoRSS
goes, there are a couple of different encodings according to <http://
georss.org/>. The Simple encoding and the W3C Geo encoding both are
limited to points. (It looks like GeoServer emits W3C based on the
namespace here: <http://sigma.openplans.org:8080/geoserver/wms/
reflect?layers=states&format=rss>). There is also GeoRSS GML dialect
that looks good: far lighter than GML2/3, but supports points, lines,
polygons, etc.
I still need to do more digging to find out which GeoRSS dialect is
supported by OpenLayers. But for the 10k bus stop points, any of the
three will be sufficient provided OL does the same bbox query that it
does with WFS. Hence my question "Is this behavior the same for
GeoRSS as well, or will I get an avalanche of XML?"
> So if you're in a circumstance (say, zoomed out to the city-wide
> view) where you'll want to see 1,000 points or even 500, you
> probably won't enjoy the effect.
>
Exactly. We've got the points rendered into the WMS base layer when
you are zoomed out. That is super-performant. When we get in close
enough, we'll turn on Markers that are clickable/hoverable. (More on
this in a second.)
> This has been a thorn in my side for a few years, wanting to use
> WFS but finding it impractical for any significant scales of use.
>
In a browser, I couldn't agree more. For a rich desktop client, while
I'd prefer a lighter format, it hasn't been as expensive
computationally. Java can parse those gnarly GML docs like a hot
knife through soft butter. GML clearly wasn't targeted/positioned as
a Web 2.0 solution, but that doesn't mean that it isn't a solution at
all.
>
> At FRUGOS a few months back where I met you, I presented my
> solution when I had the same issue in Google Maps. My solution was
> to use a WMS layer, then have a click handler that would do the
> real magic:
>
> 1. Grab the data for the point, e.g. GetFeatureInfo to GeoServer
> 2. Draw a popup box anchored at the appropriate location on the
> map, containing the data.
>
> The visual effect is that they clicked and got a popup, but you get
> to bypass the overhead involved in true Features. I know that OL
> can do all of the above. For (1) there's a Freemap of the CIA
> Factbook demonstrating click-to-query code. Part (2) should be very
> easy once you have the data and have generated the HTML.
>
I know that OL + GeoServer can do all of the above as well -- that's
our current implementation. (grin)
Sadly I wasn't able to see your presentation at the FRUGOS GeoSummit
(it was a great little unconference in Boulder, Colorado <http://
groups.google.com/group/geosummit/web/geosummit-2007>). It sounds
like the solution you presented is what we came to independently with
one tiny tweak. We ultimately didn't go with a GetFeatureInfo request
since it is limited to a single pixel/LongLat. We rolled our own
reverse geocoder that accepted a point, buffered it by a certain
amount, returned the results from the DB in hand-rolled JSON, and
popped up Markers via the OL API. (Hence my question, "Is there a
good hyperlinked discussion anywhere of the (old?) Markers layer vs.
the (new?) Vector layer?")
The current solution is fine, but misses on two key criteria:
1. The roundtrip to the server and back was slower than the customer
wanted. (I agreed, BTW. For layers with < 300 features, the round
trip to PostGIS and back was manageable, but certainly not
instantaneous. The query for one out of 10k points was simply too
slow -- 5-10 seconds.) We're looking for near instantaneous response
times for clicks and...
2. The customer wants hover capabilities (simple tooltip) and click
capabilities (popup with more data). Once the hover requirement came
up, querying _every pixel under the mouse cursor_ back and forth to
the server simply wasn't an option. (A "sea of undifferentiated
pixels", indeed!) Pulling those features up to a Marker is what we
need to do, AFAICT.
Thanks for taking the time to respond, Gregor. I really appreciate
it. However my questions remain:
Does WFS sound like the right solution -- given a 10k datalayer than
needs hover capabilities -- for out of the box OpenLayers 2.4 and
GeoServer 1.6.nightly?
Does GeoRSS currently get constrained to the map bbox like WFS in
OpenLayers 2.4?
Any thoughts on the differences/benefits/drawbacks of an old Marker
layer vs. a new Vector layer?
Does OpenLayers 2.5 RC 1 bring anything to the party that would
significantly ease my pain?
Cheers,
s
> --
> Gregor Mosheh / Greg Allensworth
> System Administrator, HostGIS cartographic development & hosting
> services
> http://www.HostGIS.com/
>
> "Remember that no one cares if you can back up,
> only if you can restore." - AMANDA
More information about the Users
mailing list