How to order result by distance from the point in Overpass? - openstreetmap

I using query which returns nearby streets. Is it possible to order this streets by distance from the point?
<query type="way">
<around lat="51.15178610143037" lon="9.931640625" radius="1000"/>
<has-kv k="highway" regv="primary|secondary|tertiary|residential"/>
</query>
<union>
<item/>
<recurse type="down"/>
</union>
<print/>

Not directly within the Overpass API. You'd have to sort the streets yourself in a post-processing step.

According to documentation on OSM wiki you can use:
out qt
or in your case
<print order="quadtile"/>
described as sort by quadtile index; this is roughly geographical and significantly faster than order by ids. It's not exactly you want, but still better than sort by ids.

Related

How to filter house numbers of a city in OSM map

Does anyone have any documentation or know how to get all the house numbers of a city available on OpenStreetMap or Nominatim?
I've searched some documentation but it doesn't seem to work.
Or anyone have api documentation that can do it please help me.
Thanks,
There's no direct API for this that would just spit out all the addresses, or even just all the house numbers, for a specific city, at least not that I'd know off.
If you can import an OSM planet extract containing your city of choice into an osm2pgsql database it would be easy to run:
SELECT DISTINCT "addr:housenumber"
FROM planet_osm_point
WHERE "addr:city=..."
UNION
SELECT DISTINCT "addr:housenumber"
FROM planet_osm_polygon
WHERE "addr:city=..."
Overpass API could also be used, esp. with the OverPass Turbo frontend it can be given queries like "addr:housenumber=* in City_name", but by default it will return full object data and not just a single field like house number.
Raw Overpass API queries can probably do just that, but I'm not that deep into its query syntax. Maybe the examples can give you a hint towards what may work.
But the Overpass API query language is not necessarily for those faint at heart ... :O

Azure Devops - hosted XML: Conditional based Rules

we are using azure devops hosted xml process.
i am trying to set Field A as required when Field B equals to Field C but the comparison do not work with i compare two reference fields.
if i compare a reference field to a specific value it works, but i need to compare 2 fields.
This is the comparison (G.CR and G.FixFor both equal 815)
<FIELD refname="G.BugReason">
<WHEN field="G.CR" value="G.FixFor">
<REQUIRED />
</WHEN>
</FIELD>
both of the fields are defined as strings.
it does work when i do the following comparison (when G.CR equals 815):
<FIELD refname="G.BugReason">
<WHEN field="G.CR" value="815">
<REQUIRED />
</WHEN>
</FIELD>
please help.
thanks.
Guy.
The scenario you ask about isn't supported.
You can define conditions that are based on what value is assigned to
a specific field or whether a user modifies a specific field.
According to our official doc -- Assign conditional-based values and rules. It's not able to directly compare two field as a conditional-based rules.
You could create a related user voice and vote up in our feature request page from Developer Community site. Our PM will kindly review your suggestion.

How to get latitude and longitude of a highway milestone with openstreetmap

I need to get the latitude and longitude of a given highway milestone or kilometrical point using openstreetmap Api, I have read the documentation but I can not find an answer.
Thanks in advance
The corresponding OSM tag for a highway milestone is highway=milestone. It is usually found on nodes.
If you know the rough location of the highway milestone then you use the Overpass API to retrieve it (note that the regular API is mainly for editing map data and should not be used to query it). The required query could look like:
<osm-script output="json" timeout="25">
<query type="node">
<has-kv k="highway" v="milestone"/>
<bbox-query e="-117.06" n="33.45" s="33.40" w="-117.09"/>
</query>
<print mode="body"/>
<recurse type="down"/>
<print mode="skeleton" order="quadtile"/>
</osm-script>
This will retrieve all milestones within the bounding box defined by e="-117.06" n="33.45" s="33.40" w="-117.09". You can view the result via overpass turbo which is just a nice webfrontend to the Overpass API.
You can also query for all milestones on/near a specific road:
<osm-script output="json" timeout="25">
<query type="way">
<has-kv k="name" v="Pala Temecula Road"/>
</query>
<query type="node">
<around radius="5"/>
<has-kv k="highway" v="milestone"/>
</query>
<print mode="body"/>
<recurse type="down"/>
<print mode="skeleton" order="quadtile"/>
</osm-script>
This will retrieve all milestones within a 5 meter radius around the Pala Temecula Road.
Note that OSM doesn't include every highway milestone. Currently there are only about 30 000 highway milestones in OSM, which isn't very much. But feel free to add more.

Querying Jobs for a Customer

I'm trying to query Jobs for a specific Customer, but am running into a little issue. It appears that the ParentRef is not queryable:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<IntuitResponse xmlns="http://schema.intuit.com/finance/v3" time="2014-02-19T10:20:31.635-08:00">
<Fault type="ValidationFault">
<Error code="4001">
<Message>Invalid query</Message>
<Detail>QueryValidationError: property 'ParentRef' is not queryable</Detail>
</Error>
</Fault>
</IntuitResponse>
However, that's the only thing I can think of to limit the query on the server-side. In the old world, we submitted a Filter of CustomerId :EQUALS: #{id} to the Jobs API, but now the Customer/Job APIs have been combined. My v3 query is SELECT * FROM Customer WHERE Job = true AND ParentRef = '#{id}' which seems like a reasonable thing to do.
Am I missing something? Could you allow us to query on ParentRef?
Something like this works OK:
SELECT * FROM Customer WHERE FullyQualifiedName LIKE 'Your Customer Name:%'
the above works if you only have one level. Try a cast:
if (null != cust.ParentRef && ((ReferenceType)cust.ParentRef).Value == c.Id)
Then if you were building a treeview for instance just wrap it in a recursive method.

SSRS Report in 1:N relation

Please guide me about this. I am working on CRM online.
I need report(custom SSRS) which will be invoked from Campaign and it will print all the Leads belongs to that Campaign.
How should i achieve this.
I created a master report based on Campaign, and a child report which is added inside that master report using BIDS.
I am passing campaignId to the child and child report does it work simply.
Is it possible using single report instead of two report...??
Any help would be appreciated.
Thanks
You can create a single report, isn't mandatory to use the Parent-Child relationship that is available with Dynamics CRM.
Inside your report you can create how many dataset you want, just define a dataset with a query (built with FetchXml because you are using CRM Online) that will fetch for the related leads of the selected campaign.
You can use Advanced Find to get the FetchXml to start.
Example:
you have the FetchXml from the Advanced Find, this will retrieve all the leads with the attribute new_campaignid as the selected GUID value.
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
<entity name="lead">
<attribute name="fullname" />
<attribute name="companyname" />
<attribute name="telephone1" />
<attribute name="leadid" />
<order attribute="fullname" descending="false" />
<filter type="and">
<condition attribute="new_campaignid" operator="eq" uiname="Test Campaign" uitype="campaign" value="{F7038DE4-B5A5-E211-8417-000C29E20CBC}" />
</filter>
</entity>
</fetch>
after create the dataset, I attached a screenshot of BIDS