>Francesco Fornari <fra.fornari <at> gmail.com> writes: > > Hello all,in our company we use with success GeoServer and Apache Solr for several project, but never togheter, so we tried to realize a proof of concept to demonstrate that solr can be a good choice as data for lat/lon positions managed by one of our projects (we are talking of the order of magnitude of about two MILLION or more positions stored). > > We followed the guide that we found at: http://docs.geoserver.org/latest/en/user/community/solr/index.html > > > so we downloaded version 2.7-SNAPSHOT of GeoServer due to the fact that the guide is intended for 2.7.x versions. > > We're using Solr version 4.10.3 (> than 4.8/4.9 written on the guide). > > We downloaded and successfully installed solr extension from http://ares.boundlessgeo.com/geoserver/master/community-latest/ (we was able to see Solr as possible datasource in GS admin page). > > Until now everithing seems to be ok, but we had to work hard to see that "beautiful" little red squares representing our positions on the world rectangle. > > And here comes first problems: > adding the "layer" or "categorization" field to ALL our solr documents to satisfy the requirement of the plugin was not easy, but fortunately we was "playing" with solr, so we was able to delete all created documents a recreate them with an additional default field, in our case named "layer" which default value is "positions", so when uploading new documents, if a value for field "layer" is not provided the default value "positions" is set. In Solr you can do this by defining a field in this way in schema.xml file: > > <field name="layer" type="string" indexed="true" stored="true" required="false" multiValued="false" default="positions" /> > > > In our case was not a problem redefine the schema, but would be great if the solr plugin of geoserver uses the "layer" field as optional filter field and not as mandatory feature the user documents must provide. > > Always in schema.xml we have a field: > <field name="positionRpt" type="location_rpt" indexed="true" stored="true" required="false" multiValued="false"/> > > > where location_rpt is a type defined as: > <fieldType name="location_rpt" class="solr.SpatialRecursivePrefixTreeFieldType" distErrPct="0.025" maxDistErr="0.000009" units="degrees" spatialContextFactory="com.spatial4j.core.context.jts.Jt sSpatialContextFactory" autoIndex="true" /> > > Remember that this is not the default "location_rpt" field that comes with solr in bundle, we added the spatialContextFactory attribute, but to avoid classNotFound exceptions on Solr startup you have to install Jts libraries inside your solr web-inf/lib directory inside the war. > > Following various guide on the internet we found that rpt fields can be write on solr product in different format: we used "longitude latitude" (longitude first and latitude after separated by a space) format. (THIS IS WRONG, read below for correct solution) > > All done Solr side.... for now...... > > And here comes the pain... in solr field configuration whe defined locationRpt as a "Geometry" (but also with ALL other possible choices in drop-down menu) but nothing: various exceptions both on solr output console (while geoserver does spatial queries on it) and on geoserver console (wrong geometry errors). > > The SOLUTION was to define positionRpt content in WKT syntax, so a document with lat and lon values must have the rpt field expressed as "POINT(latitude,longitude)", this is the syntax to express a point in WKT language. > > And voilà! everithing worked, we was able to see ALL our positions on the layer preview. > > Hoping to be helpful > Bye > > Francesco Fornari > Italian Software Engineer > > > > ---------------------------------------------------------------------- -------- > New Year. New Location. New Benefits. New Data Center in Ashburn, VA. > GigeNET is offering a free month of service with a new server in Ashburn. > Choose from 2 high performing configs, both with 100TB of bandwidth. > Higher redundancy.Lower latency.Increased capacity.Completely compliant. > http://p.sf.net/sfu/gigenet > > _______________________________________________ > Geoserver-users mailing list > Geoserver-users <at> lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/geoserver-users >
Hey Francesco, I was wondering if you could go into some detail about your solution for defining the positionRpt content in WKT format. I am currently trying to get GeoServer connected to a Solr instance and I am having trouble getting GeoServer to read point data from Solr. I believe I am not importing the point data correctly into Solr. I have followed the steps that you have provided and I am unsure on how to declare positionRpt in the WKT format. Do I need to modify my SQL query to return the points in WKT format? Currently I am just returning them as Latitude and longitude ("ST_X(center) || ' ' || ST_Y(center)" PostgreSQL database) Or is there something that I can modify in the schema.xml to transform my points into WKT format? Any help or insight would be greatly appreciated. Regards, Alex. ------------------------------------------------------------------------------ One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y _______________________________________________ Geoserver-users mailing list Geoserver-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geoserver-users