WFS GetFeature request feature with lat/lng literal - leaflet

According to the Geoserver documentation: https://docs.geoserver.org/master/en/user/services/wms/reference.html#getfeatureinfo it is preferred to use the WFS GetFeature service over WMS GetFeatureInfo as literally cited:
The GetFeatureInfo operation requests the spatial and attribute data for the features at a given location on a map. It is similar to the WFS GetFeature operation, but less flexible in both input and output. Since GeoServer provides a WFS service we recommend using it instead of GetFeatureInfo whenever possible.
I have been looking for a way to request all matching features for a lat/lng point and the shape of a layers geometry via WFS GetFeature. I can't find it and the cql_filter combiantion with within or intersects won't get me any further. Any good documeantion or examples someone has to share?

Don't know if you are still needed, but just provides for others who need.
WFS GetFeature request feature with lat/lng literal:
{youHost}/geoserver/wfs?service=WFS&version=1.0.0&request=GetFeature&typeName={yourTypeName}&srsName=EPSG:4326&maxFeatures=10000&format_options=callback:getJson&cql_filter=INTERSECTS(geom, POINT ({long} {lat}))

Related

Filtering the Clustered Points by JSON attributes using Mapbox-gl-js

I am working on the project in which I want to filter the GeoJson using their attributes and visualize the marker in cluster form on the map.
I try using the following "Filtering Clustered Points by JSON attributes using Mapbox-gl-js"
solution but unable to understand how to filter GeoJson using their attributes and set filter GeoJson data to map.
I already made an application using Google Maps API, but now I want to develop through Mapbox-gl-js API.
Existing Application Link: http://maps.dicrc.in/BM/
Mapbox The GeoJSON clustering happens at the source level. If you want to filter data in the clusters, you will have to filter the GeoJSON itself based on the attributes BEFORE clustering it.
You can use tools like turf/filter to filter the GeoJSON data. For clustering and updating your filtered data, follow the example in this jsfiddle map.getSource('sourceName').setData(filteredData)
disclaimer: I work at Mapbox

I have to return some geographic data through a REST web-service instead of one with WMS or WFS protocol. What is the best data representation then?

Usually, when I can, I offer a layer to join on a Geoserver, for example, through a WMS or WFS service.
However, this time, its not the case. I am asked to provide a REST web-service method where among the attributes returned is a road (a line) that will sometimes interest the caller (and he will want to display it on a map), but most of the times he won't use it.
How should I return that line that depicts the road ? I will return a String, its quite sure, I think.
Should I encode it like Postgis does, for example ?
LINESTRING(0 0, 1 1, 2 1, 2 2) ?
What is the good practice when you have to return in a String attribute some geographical data, in a non-geographic web-service ?
Thanks
I'd suggest GeoJSON format and MongoDB as a back end storage. Though you may wrap geometries from Postgis into GeoJSON either. It allows to store additional attributes and can be rendered by Google API or Bing API or QGIS at user front end.

How to list data in one datastore with geoserver rest interfaces?

I have tried to use "rest/layers.json" to get all data,but only got the services have been published.
I thought it might be
"rest/workspaces/{workspaceName}/datastores/{datastoreName}/featuretypes.json" ,bu i always get the emty object.
it should look like:"rest/workspaces/{workspaceName}/datastores/{datastoreName}/data.json.
so,how to get the data list with a datastore exactly.
GeoServer REST services are only managing configuration, there is not data access. If you want to get data, use WFS, it's really simple, e.g.:
http://demo.geo-solutions.it/geoserver/wfs?service=WFS&version=1.0.0&request=GetFeature&typeName=topp:states&outputformat=application/json

How to get a SRS/CRS name from geoserver?

I received a list (XML) of SRSes by request:
http://gis1:8080/geoserver/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetCapabilities
then parse it and get a list of EPSG codes like "EPSG:1234"
How I can now get a name of specific SRS like "Pulkovo 1942 / Gauss-Kruger zone 13" for "EPSG:28413"?
...or may be I can do it by OpenLayers API?
OGC services do not provide such facilities, they are built under the assumption that you have a EPSG database already available in the client.
You can try using some free online service to get to a name (with the perils of a service that is not guaranteed to be available 24x7 of course), like:
https://www.epsg-registry.org/
http://epsg.io/
http://spatialreference.org/
A better solution production wise, if you are using GeoServer, is probably to create a WPS process in GeoServer that would do the same job (or create a REST service of your own based on other open source libraries).

Fetching Zipcodes falling in between the routes Final and End destination using MapQuest API

I need to fetch zipcodes falling all along the route using MapQuest API.Plz suggest i tried to find on mapquest forum as well as on stack .I also did google but can't manage to find appropriate solution.
Ex : Suppose i define a Route from point A to Point B. Now i need to fetch all zipcodes falling in between this route.
You'll want to look at the Corridor Search, which is part of the Search API Web Service. You have two options; you can either pass in the shapePoints that make up the route (corridor) that you want to search along, or you can use the Directions API to calculate a route and then use the sessionId from the Directions API response as input into the Search request.
Here's an example using the Directions API in conjunction with the Search API:
Use the Directions API to calculate a route between two points. In this example, I'm calculating a route between Denver, CO and Aurora, CO:
http://www.mapquestapi.com/directions/v2/route?key=YOUR-APP-KEY-GOES-HERE&from=Denver,CO&to=Aurora,CO
Locate the sessionId parameter in the response.
Use the Search API to perform a corridor search on the uspostalcodes table. I'm also filtering the results from the table to include just the name of the postal code and none of the other info that is available in the table.
http://www.mapquestapi.com/search/v2/corridor?key=YOUR-APP-KEY-GOES-HERE&sessionId=YOUR-SESSION-ID-GOES-HERE&width=1&buffer=0&hostedData=mqap.uspostalcodes|||POSTCODE
You can adjust the width/buffer options as well to refine your search.
Hope this helps!