There are advantages and disadvantages of having a factory near or within the urbanize city. The important thing is you have to weigh the pros and cons of having such factory in the city or a place where there are lot of people live.
Having a factory near the place is good for the people around because it generates job for the people. Aside from that they don't need to commute and spend a sum of money for the transportation. Indeed a lot of people from far away are coming in the city to look for a job and end up working in the factories sometimes unprotected by not following the health precaution.
Refinery for example produced a lot of toxic which is dangerous to our health as it can cause skin diseases and cancer. Chemical should be placed away from the community. The waste materials should be keep away and recycle to clean it and not be dump in the river or sea. This will overkill fish and other organism nearby.
There are many ways to make it fair to both the company owner and the people around it. Company provides job and livelihood for the people but the company must be responsible enough to save the environment and make it sure that they have proper waste disposal. They should maintain a high standard in keeping their toxic waste. By doing so they will save people from inhaling the chemical and it would be safe to all.