Hello, Alex.

We have a field called 'spatial' that holds WKT-format polygons and
multi-polygons - these are used in our spatial queries.

We also have a field called 'centroid' that is derived from the polygons -
we choose to return these in the results rather than the polygons
themselves, because retrieving the centroids is much quicker and more
useful to us.  (There is an option when creating a layer within a SOLR
datastore to say to return a different spatial field than that which is
being used for the spatial query.)

part of schema.xml in SOLR ..

<field name="spatial" type="location_rpt" indexed="true" stored="true"
multiValued="false"/> <field name="centroid" type="location_rpt" indexed=
"true" stored="true" multiValued="false"/>

A sample of our data - note the 'spatial' field ..

{ "edition_id": "1783653", "editionSapCode": "M200", "productCategory":
"MAPS", "type": "edition", "cm_modified": "2015-03-19T02:49:23Z", "productID":
236, "documentCount": 2, "cm_creator": "admin", "id": "1783653", "
editionComment": "Digital vector data not available.", "editionCount": 1, "
editionSuffix": "First Edition", "current": true, "cm_created":
"2015-01-22T03:17:53Z", "productScale": "1:500,000", "editionStatus": "CURR",
"spatial": "POLYGON((147 -32,147 -29,150 -28,150 -32,147 -32))", "
editionAuthor": "Offenburg A.C.", "printType": "PRIN", "
editionCatalogueNumber": 327, "editionRetailPrice": 11,
"editionReference": "Offenburg
A.C., 1973, Coonamble 1:500 000 Geological Map, 1st edition, Geological
Survey of New South Wales, Sydney", "editionPublishDate":
"1972-12-31T13:00:00Z", "uuid": "64f46c8e-3745-43cf-802a-85a4a5ee5bab", "
productName": "Coonamble 1:500 000 Geological Map", "productPaperSize": "A0
Portrait", "_version_": 1496122514496028700 },

I hope this is of some help.

Regards,
David Collins


On Fri, May 8, 2015 at 9:59 AM, Alex Grech <[email protected]> wrote:

> >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
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>
------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to