MapQueryToolstrip craches on postgis layer

Topics: WinForms Controls
Jul 3, 2014 at 12:35 PM
Hello all

I have a winform application with a mapbox and a MapQueryToolstrip attached to the mapbox. I have succesfully added several postgis layers to the map, however, when using the identify tool to select a feature on the map, I get the following error:

XX000: parse error - invalid geometry

and the call stack location:
Npgsql.dll!Npgsql.NpgsqlCommand.ExecuteReader(System.Data.CommandBehavior cb=Default) Line 591

The code to add the postgis layer is as follows:

styloi = New VectorLayer("styloi")
styloi.DataSource = New Data.Providers.PostGIS("Server=localhost;Port=5432;UserId=postgres;Password=postgres;Database=k", "styloi", "gid")
MapBox1.Map.SRID = 3857
MapBox1.Map.Layers.Add(styloi)
MapBox1.Map.ZoomToExtents()
MapBox1.Refresh()

The SRID of the geometrycolumn is 3857 (google mercator)

I have also manually tested that my layer executes intersection queries and it works ok,

Dim tlr As Double = 10 * MapBox1.Map.PixelWidth
Dim p1 As New GeoAPI.Geometries.Coordinate(worldPos.X - tlr, worldPos.Y - tlr)
Dim p2 As New GeoAPI.Geometries.Coordinate(worldPos.X + tlr, worldPos.Y + tlr)
styloi.ExecuteIntersectionQuery(New GeoAPI.Geometries.Envelope(p1, p2), ds)

Sharpmap version 1.1.0, postgres 9.3, postgis 2.0
Coordinator
Jul 4, 2014 at 1:03 PM
Are you trying to query a point or an envelope?
If you are trying to query a point try setting MapBox.QueryGrowFactor = 0;
Jul 4, 2014 at 2:04 PM
I'm trying to query a point. When querying an envelope it works ok.
I set MapBox.QueryGrowFactor = 0 but it still throws the same error
Coordinator
Jul 7, 2014 at 7:38 AM
Could you post the schema of the table so I can generate a sample to test?
Jul 8, 2014 at 5:15 PM
I have already implemented a workaround without using the mapquery tool for my project.

However, the problem in the mapquery tool persists. You can try this table:

CREATE TABLE pro_kap_ota
(
gid serial NOT NULL,
"EKTASH" double precision,
"PERIMETROS" double precision,
"NAME_GREEK" character varying(100),
"NAME_LATIN" character varying(100),
"TYPOS" character varying(6),
the_geom geometry(Polygon,3857),
CONSTRAINT pro_kap_ota_pkey PRIMARY KEY (gid)
)
WITH (
OIDS=FALSE
);
ALTER TABLE pro_kap_ota
OWNER TO postgres;


And some data here:

https://www.dropbox.com/s/e8nn9d35htx94yc/test_data.csv

Already tried it with lower case column names, and also removing the column with greek names. The problem persits.

Elias
Coordinator
Jul 9, 2014 at 11:00 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.