"Search within distance" API for OpenStreetMap [closed] - api

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
Is there any API for OpenStreetMap which allows me to obtain a list of POIs within a certain distance (e.g. 10 miles) from a reference location?

As far as I know, the API doesn't support this directly. The simplest approach is to select a (quasi-)rectangular bounding box that your circle fits into, and use this to retrieve your POIs. Then you can do a distance calculation to each point of interest, and discard those that exceed your radius. This will remove the small fraction of POIs that lie close to the corners of the box, and so aren't within your circle. You want to do it in this order so that you only have to do the distance calculation on a relatively small number of target locations.
Don't forget that the bounding box is defined by lat/long corners, so it isn't truly rectangular. Longitude lines converge at the poles, so the top of your box is not the same width as the bottom. How much this affects you depends on how close you are to a pole (a degree of long ~= (40000km / 360) * cos (lat)).
If you don't require supreme accuracy, then you calculate your distances using Pythagoras's theorem, remembering the cosine variation in longitude, and the factor 2 unit difference (360 degrees of longitude, but only 180 of latitude). If you do require accuracy, then you're into the realms of spherical trigonometry, and also need to consider the ellipsoidal earth. Here's an online calculator, complete with equations and open source code, that is helpful in this regard.

Yes. The Overpass API has an "Around" feature which does exactly this (search for items within a radius of the given point). You can combine that with other requirements (eg to get a list of a particular item type):
http://wiki.openstreetmap.org/wiki/Overpass_API#Around
For example using OverPass Turbo Api (List all towns near of "Manzanares, Spain" with latitude and longitude with a radius of 150 Km, try it live!):
<osm-script output="json" timeout="25">
<id-query {{nominatimArea:Spain}} into="area"/>
<query type="node">
<has-kv k="place" modv="" v="town"/>
<around lat="38.996507" lon="-3.371946" radius="150000"/>
</query>
<print e="" from="_" geometry="skeleton" limit="" mode="body" n="" order="id" s="" w=""/>
</osm-script>

Here is documentation:
http://developers.cloudmade.com/wiki/geocoding-http-api/Documentation
Here is example of what you need - HTML, JSON.

Related

Finding the Stokes Number of a Microcarrier Particle

I'm trying to model the flow and suspension of microcarriers (particles that are used as surfaces for cells to attach to and grow on) in a CFD application. I know some basic characteristics of the particles (they're called "Cytodex", about 180 µm big, density is 1.03g/cm^2) but I'd like to find the Stokes number to determine how strongly they are affected by turbulence and movement of the fluid. Can somebody point me to how to approach this (or at least approximate?). It's surprisingly hard to find any information for somebody like me who hasn't got a very strong background in fluid mechanics.
Here is the manufacturer's microcarrier manual. See page 62, Table 12 for Cytodex 1 physical properties.
https://www.gelifesciences.co.kr/wp-content/uploads/2016/07/023.8_Microcarrier-Cell-Culture.pdf
See this SlideShare, slide 15, for how to calculate the Stokes # for Cytodex 1 microcarriers: https://www.slideshare.net/rjrishabhjain/bs-4sedimentation?from_action=save
but for Cytodex 1 correct the d=180 um, for cell culture media=nutrient broth viscosity = 0.96 cP, media density ~ 1.007g/mL, microcarrier density 1.03 g/mL, to get settling velocity of 0.062cm/s = 3.72 cm/min. However, per the manufacturer's manual settling velocity is 12-16mL/min. Might be an error. I am seeing an answer.
For CFD modeling of microcarriers in bioreactors see: Loubière
https://pdfs.semanticscholar.org/d955/75b5c640c8268fd1ec51b2ce46862e7bbfbd.pdf
I have more related literature if you have interest.
DApple

automata theorem: existance of a DFA [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 8 years ago.
Improve this question
I need to prove that for every k, there's a DFA M with k+2 states, so in every automat M' who accepts the language reverse(L(M)) there are at least 2^k states.
Help would be really appreciated.
Thanks :)
Assuming that the alphabet set contains at least two elements, let it be {0,1}.
Next, let M be the automata accepting the language L defined as:
All the strings which k-th position is 1
defined as:
M = {Q,{0,1},q0,{qk+1},δ}, where
Q={q0,q1,...,qk,qF}
δ(qi,a) = qi+1, for a in {0,1} and i=0,1,...,k-2
δ(qk-1,0) = qF,
δ(qk-1,1) = qk,
δ(qF,a) = qF, for a in {0,1}
Note that M has exactly k+2 states, and that it accepts the language L.
Now, note that the language reverse(L(M)) can be translated as:
All the strings which k-th position from the end is 1
To recognize that language, note that we need to remember the last k symbols, because we don't know when the string will end. We know that there are at least 2k possible strings of length k (since the alphabet size is at least 2).
So using a DFA, we need at least 2k states, each to represent one possible string of length k. ▢
Author's note:
The idea of this proof is to find a language which is "easy" to be recognized in normal way, but "difficult" when is read backward. Through experience, I remember that fixing the k-th position from the beginning is "easy", while k-th position from the end is "difficult", hence my answer.

GIS data files converting each address to lat/lon in dbf shape data

I need Lat/LON from GIS data
I have data files from
http://www.mngeo.state.mn.us/chouse/land_own_property.html
given in the format of
.dbf, .prj, .sbn, .sbx, .shp, and .shx
in the .dbf I see
PIN, Shape_area, Shape_len
PARC_CODE Parcel Polygon to Parcel Point numeric 2
and PIN Relationship Code
and in the .prj
PROJCS["NAD_1983_UTM_Zone_15N",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-93.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]
I also know the polygon points for each county
polygons points
Anoka 129139 129138
Carver 38134 38133
Dakota 135925 150294
Hennepin 422976 446623
Ramsey 149169 168233
Scott 55191 55191
Washington 98915 103915
and I know the bounding coordinates
-94.012
-92.732
45.415
44.471
there seems to be tons of software applications for GIS
http://en.wikipedia.org/wiki/List_of_geographic_information_systems_software
but what do I need to do?
I want the lat, lon of every house
Is there a library that will do this for me?
What is the data I need?
I think you need to install one GIS software. You can try open-source Qgis.
Because, firstly your data is not in long/lat (geographic) coordinates. Your .prj part of the shapefile (yes, all .dbf, .prj, .sbn, .sbx, .shp, and .shx files with the same name are one shapefile for GIS) says that the data are in the projected coordinate system NAD 1983 UTM Zone 15N. So, you need to transform your data to geographic system. This you easy can do in GIS, or programmatically by proj.4 library. (In Qgis add the shapefile to the project, then select it in the table of contents, right mouse button and choose "save as...". It will ask you for the target coordinate system.) Note, that you need to decide which geographic coordinates you wish, because your data are in the North American Datum (NAD 1983), but the most common worldwide now is WGS 1984.
Secondly, in GIS you will see your data, are they really points, or maybe polygons. (In case your houses are polygons you will need to get centroids of them, in Qgis menu Vector - Geometry Tools - Polygon Centroids).
Finally, when you really have your houses as points in geographic coordinates, you can get their coordinates, for example using advices from these questions Get list of coordinates for points in a layer and How do I calculate the latitude and longitude of points using QGIS.
Besides, there is a good library to work with GIS vector data, OGR, which can be used by many programming languages.
The file extensions above show, that the files are in ESRI Shape File format. In Java you could use GeoTools libraries, to read that.
The example below shows the first lines, search Internet for a more complete example.
// init shapefile
File shpFile = new File(fileName);
if (!shpFile.exists()) {
LOGGER.fatal(fileName + " does not exist");
}
Map<String, URL> connect = new HashMap<String, URL>();
FeatureCollection collection = null;
FeatureIterator iterator = null;
try {
connect.put("url", shpFile.toURI().toURL());
DataStore dataStore = DataStoreFinder.getDataStore(connect);
String typeName = dataStore.getTypeNames()[0];
"I want the lat, lon of every house" suggests that what you want to do is the process called geocoding. There are services you can use for that, some free (for limited uses) some not. You could start by looking at the List of geocoding systems to get an idea of where to start. I don't think you want to start by learning GIS or shapefiles, other than to extract the addresses you are trying to geocode.
You could estimate the lat/lon of each house by computing the centroid of each parcel. You could more roughly estimate the lat/lon of each house by calculating the centroid of the bounding rectangle of each parcel. Either of those would require extracting the parcel coordinates. If you are doing that for every house in Minnesota you will processing lots of data. A geocoding service would be cheaper. The Census Geocoder might help.

Tesselation/CGR Details from CATPart_CATIA_API

I need to read the tessellation/cgr/visualisation details from a CATIA V5R18 Part file using CATIA V5R18 API.
Visualisation details such as:
Number of Vertices
Number of Triangles
Number of Strips
Number of Fans
Number of Normal
Bounding Sphere Centre and Radius
These details I have read from .cgr files using CAT3DRep/CATRep/CATSurfacicRep, but I am not able to read the same for .CATPart files.
From .CATPart with the help of CATIVisu I got CAT3DBagRep type, when I queried from PartFeatures. But to get Visualisation details I need CATSurfacicRep.
What interface should I query and from where should I query?
I am not sure about R18 but for R22 and R23 if you have the CAA documentation there is an example located at: C:\Program Files\Dassault Systemes\B23\CAADoc\CAATessellation.edu.
This example code has everything you need to get the tessellation data except normals and bounding spheres. I used this example code when I was teaching myself how to make a tessellated nurbs surface and it was quite useful for testing.

CATIA-CAA CATIVisu

Hi i need the flow to read the visualisation details from a CATIA V5R18 Part file.
Visualisation details lik,
1.No of Vertices
2.No of Triangles
3.No of Strips
4.No of Fans
5.No of Normal
6.Bouding Sphere Centre and Radius
These details i have red from .cgr files using CAT3DRep/CATRep/CATSurfacicRep...
But i am not able to read the same for .CATPart files.
From .CATPart with the help of CATIVisu i got CAT3DBagRep type When i queried from PartFeatures But to get Visualisation details i need CATSurfacicRep.
Can anyone help?
Wat Interface i should query and from where i should query?
Well, information about the mesh (triangle, strips, fans, etc) is only carried by leaf Reps, like CAT3DSurfacicRep.
For complex files like CATPart or CATProduct, where you have a hierarchy of geometries, there's also a hierarchy of Reps. CAT3DBagRep is the class that allows building this hierarchy, as it has children Reps (which can of course be also CAT3DBagReps).
One solution may be to recursively explore this Rep hierarchy from the root CAT3DBagRep you get. The method to get the children Reps of a CAT3DBagRep is:
list<CATRep> *GetChildren();
You can go down the Rep tree until you get Reps of the expected type, like CATSurfacicRep. You may find many of them depending on your model.
When retrieving the mesh coordinates, normals and bounding element, please take into account that they are given in local Rep coordinates. A CAT3DBagRep carries positioning and orientation information (used when you position CATProducts, for example). This is returned by the following CAT3DBagRep method:
const CAT4x4Matrix * GetMatrix() const;
Depending on your scenario/model, you may need to take this positioning information into account.